perf: Clean up perf_{session,alloc} management
[akaros.git] / kern / include / ros / syscall.h
1 #pragma once
2
3 #include <ros/bits/syscall.h>
4 #include <ros/arch/syscall.h>
5 #include <ros/event.h>
6 #include <ros/atomic.h>
7
8 /* Flags for an individual syscall. */
9 #define SC_DONE                                 0x0001          /* SC is done */
10 #define SC_PROGRESS                             0x0002          /* SC made progress */
11 #define SC_UEVENT                               0x0004          /* user has an ev_q */
12 #define SC_K_LOCK                               0x0008          /* kernel locked sysc */
13 #define SC_ABORT                                0x0010          /* syscall abort attempted */
14
15 #define MAX_ERRSTR_LEN                  128
16
17 struct syscall {
18         unsigned int                            num;
19         int                                                     err;                    /* errno */
20         long                                            retval;
21         atomic_t                                        flags;
22         struct event_queue                      *ev_q;
23         void                                            *u_data;
24         long                                            arg0;
25         long                                            arg1;
26         long                                            arg2;
27         long                                            arg3;
28         long                                            arg4;
29         long                                            arg5;
30         char                                            errstr[MAX_ERRSTR_LEN];
31 };
32
33 struct childfdmap {
34         unsigned int                            parentfd;
35         unsigned int                            childfd;
36         int                                                     ok;
37 };
38
39 struct argenv {
40         size_t argc;
41         size_t envc;
42         char buf[];
43         /* The buf array is laid out as follows:
44          * buf {
45          *   char *argv[argc]; // Offset of arg relative to &argbuf[0]
46          *   char *envp[envc]; // Offset of envvar relative to &argbuf[0]
47          *   char argbuf[sum(map(strlen + 1, argv + envp))];
48          * }
49          */
50 };
51
52 #ifndef ROS_KERNEL
53
54 /* Temp hack, til the rest of glibc/userspace uses sys/syscall.h */
55 #include <sys/syscall.h>
56 #endif /* ifndef ROS_KERNEL */