1 #ifndef ROS_KERN_SYSCALL_H
2 #define ROS_KERN_SYSCALL_H
4 # error "This is ROS kernel header; user programs should not #include it"
7 #include <ros/common.h>
10 #define SYSTRACE_ON 0x01
11 #define SYSTRACE_LOUD 0x02
12 #define SYSTRACE_ALLPROC 0x04
14 #define MAX_NUM_TRACED 10
15 #define MAX_SYSTRACES 1024
17 #define SYSCALL_STRLEN 128
19 #define MAX_ASRC_BATCH 10
21 #define SYSTR_RECORD_SZ 256
22 #define SYSTR_BUF_SZ PGSIZE
23 #define SYSTR_PRETTY_BUF_SZ (SYSTR_BUF_SZ - \
24 sizeof(struct systrace_record))
25 struct systrace_record {
26 struct systrace_record_anon {
27 uint64_t start_timestamp, end_timestamp;
42 uint8_t data[SYSTR_RECORD_SZ - sizeof(struct systrace_record_anon)];
46 typedef intreg_t (*syscall_t)(struct proc *, uintreg_t, uintreg_t, uintreg_t,
47 uintreg_t, uintreg_t, uintreg_t);
48 struct sys_table_entry {
52 extern const struct sys_table_entry syscall_table[];
53 extern const int max_syscall;
54 /* Syscall invocation */
55 void prep_syscalls(struct proc *p, struct syscall *sysc, unsigned int nr_calls);
56 void run_local_syscall(struct syscall *sysc);
57 intreg_t syscall(struct proc *p, uintreg_t sc_num, uintreg_t a0, uintreg_t a1,
58 uintreg_t a2, uintreg_t a3, uintreg_t a4, uintreg_t a5);
59 void set_errno(int errno);
61 void unset_errno(void);
62 void set_errstr(char *errstr, ...);
63 char *current_errstr(void);
64 struct errbuf *get_cur_errbuf(void);
65 void set_cur_errbuf(struct errbuf *ebuf);
66 char *get_cur_genbuf(void);
67 void __signal_syscall(struct syscall *sysc, struct proc *p);
69 /* Tracing functions */
70 void systrace_start(bool silent);
71 void systrace_stop(void);
72 int systrace_reg(bool all, struct proc *p);
73 int systrace_dereg(bool all, struct proc *p);
74 void systrace_print(bool all, struct proc *p);
75 void systrace_clear_buffer(void);
78 bool syscall_uses_fd(struct syscall *sysc, int fd);
79 void print_sysc(struct proc *p, struct syscall *sysc);
81 #endif /* !ROS_KERN_SYSCALL_H */