Helper, check for the existence of local RKMS
[akaros.git] / kern / include / syscall.h
index f4be19a..223133f 100644 (file)
 #define MAX_NUM_TRACED                         10
 #define MAX_SYSTRACES                          1024
 
+#define SYSCALL_STRLEN                         128
+
 #define MAX_ASRC_BATCH                         10
 
-/* Consider cache aligning this */
+#define SYSTR_RECORD_SZ                                256
+#define SYSTR_BUF_SZ                           PGSIZE
+#define SYSTR_PRETTY_BUF_SZ                    (SYSTR_BUF_SZ -                            \
+                                     sizeof(struct systrace_record))
 struct systrace_record {
-       uint64_t                timestamp;
-       uintreg_t               syscallno;
-       uintreg_t               arg0;
-       uintreg_t               arg1;
-       uintreg_t               arg2;
-       uintreg_t               arg3;
-       uintreg_t               arg4;
-       uintreg_t               arg5;
-       int                             pid;
-       uint32_t                coreid;
-       uint32_t                vcoreid;
+       struct systrace_record_anon {
+               uint64_t                start_timestamp, end_timestamp;
+               uintreg_t               syscallno;
+               uintreg_t               arg0;
+               uintreg_t               arg1;
+               uintreg_t               arg2;
+               uintreg_t               arg3;
+               uintreg_t               arg4;
+               uintreg_t               arg5;
+               uintreg_t               retval;
+               int                             pid;
+               uint32_t                coreid;
+               uint32_t                vcoreid;
+               char                    *pretty_buf;
+               uint8_t                 datalen;
+       };
+       uint8_t                 data[SYSTR_RECORD_SZ - sizeof(struct systrace_record_anon)];
 };
 
 /* Syscall table */
@@ -57,10 +68,15 @@ void __signal_syscall(struct syscall *sysc, struct proc *p);
 
 /* Tracing functions */
 void systrace_start(bool silent);
+int systrace_trace_pid(struct proc *p);
 void systrace_stop(void);
 int systrace_reg(bool all, struct proc *p);
 int systrace_dereg(bool all, struct proc *p);
 void systrace_print(bool all, struct proc *p);
 void systrace_clear_buffer(void);
 
+/* Utility */
+bool syscall_uses_fd(struct syscall *sysc, int fd);
+void print_sysc(struct proc *p, struct syscall *sysc);
+
 #endif /* !ROS_KERN_SYSCALL_H */