Support atomic printks
[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 #define SYSTR_BUF_SZ                    PGSIZE
17
18 struct syscall {
19         unsigned int                            num;
20         int                                                     err;                    /* errno */
21         long                                            retval;
22         atomic_t                                        flags;
23         struct event_queue                      *ev_q;
24         void                                            *u_data;
25         long                                            arg0;
26         long                                            arg1;
27         long                                            arg2;
28         long                                            arg3;
29         long                                            arg4;
30         long                                            arg5;
31         char                                            errstr[MAX_ERRSTR_LEN];
32 };
33
34 struct childfdmap {
35         unsigned int                            parentfd;
36         unsigned int                            childfd;
37         int                                                     ok;
38 };
39
40 struct argenv {
41         size_t argc;
42         size_t envc;
43         char buf[];
44         /* The buf array is laid out as follows:
45          * buf {
46          *   char *argv[argc]; // Offset of arg relative to &argbuf[0]
47          *   char *envp[envc]; // Offset of envvar relative to &argbuf[0]
48          *   char argbuf[sum(map(strlen + 1, argv + envp))];
49          * }
50          */
51 };
52
53 #ifndef ROS_KERNEL
54
55 /* Temp hack, til the rest of glibc/userspace uses sys/syscall.h */
56 #include <sys/syscall.h>
57 #endif /* ifndef ROS_KERNEL */