Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(143)

Side by Side Diff: fusl/src/internal/syscall.h

Issue 1730723002: [fusl] Remove socketcall abstraction (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | fusl/src/network/accept.c » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #ifndef _INTERNAL_SYSCALL_H 1 #ifndef _INTERNAL_SYSCALL_H
2 #define _INTERNAL_SYSCALL_H 2 #define _INTERNAL_SYSCALL_H
3 3
4 #include <sys/syscall.h> 4 #include <sys/syscall.h>
5 #include "syscall_arch.h" 5 #include "syscall_arch.h"
6 6
7 #ifndef SYSCALL_RLIM_INFINITY 7 #ifndef SYSCALL_RLIM_INFINITY
8 #define SYSCALL_RLIM_INFINITY (~0ULL) 8 #define SYSCALL_RLIM_INFINITY (~0ULL)
9 #endif 9 #endif
10 10
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 #define __SYSCALL_NARGS(...) \ 56 #define __SYSCALL_NARGS(...) \
57 __SYSCALL_NARGS_X(__VA_ARGS__, 7, 6, 5, 4, 3, 2, 1, 0, ) 57 __SYSCALL_NARGS_X(__VA_ARGS__, 7, 6, 5, 4, 3, 2, 1, 0, )
58 #define __SYSCALL_CONCAT_X(a, b) a##b 58 #define __SYSCALL_CONCAT_X(a, b) a##b
59 #define __SYSCALL_CONCAT(a, b) __SYSCALL_CONCAT_X(a, b) 59 #define __SYSCALL_CONCAT(a, b) __SYSCALL_CONCAT_X(a, b)
60 #define __SYSCALL_DISP(b, ...) \ 60 #define __SYSCALL_DISP(b, ...) \
61 __SYSCALL_CONCAT(b, __SYSCALL_NARGS(__VA_ARGS__))(__VA_ARGS__) 61 __SYSCALL_CONCAT(b, __SYSCALL_NARGS(__VA_ARGS__))(__VA_ARGS__)
62 62
63 #define __syscall(...) __SYSCALL_DISP(__syscall, __VA_ARGS__) 63 #define __syscall(...) __SYSCALL_DISP(__syscall, __VA_ARGS__)
64 #define syscall(...) __syscall_ret(__syscall(__VA_ARGS__)) 64 #define syscall(...) __syscall_ret(__syscall(__VA_ARGS__))
65 65
66 #define socketcall __socketcall
67 #define socketcall_cp __socketcall_cp
68
69 #define __syscall_cp0(n) (__syscall_cp)(n, 0, 0, 0, 0, 0, 0) 66 #define __syscall_cp0(n) (__syscall_cp)(n, 0, 0, 0, 0, 0, 0)
70 #define __syscall_cp1(n, a) (__syscall_cp)(n, __scc(a), 0, 0, 0, 0, 0) 67 #define __syscall_cp1(n, a) (__syscall_cp)(n, __scc(a), 0, 0, 0, 0, 0)
71 #define __syscall_cp2(n, a, b) (__syscall_cp)(n, __scc(a), __scc(b), 0, 0, 0, 0) 68 #define __syscall_cp2(n, a, b) (__syscall_cp)(n, __scc(a), __scc(b), 0, 0, 0, 0)
72 #define __syscall_cp3(n, a, b, c) \ 69 #define __syscall_cp3(n, a, b, c) \
73 (__syscall_cp)(n, __scc(a), __scc(b), __scc(c), 0, 0, 0) 70 (__syscall_cp)(n, __scc(a), __scc(b), __scc(c), 0, 0, 0)
74 #define __syscall_cp4(n, a, b, c, d) \ 71 #define __syscall_cp4(n, a, b, c, d) \
75 (__syscall_cp)(n, __scc(a), __scc(b), __scc(c), __scc(d), 0, 0) 72 (__syscall_cp)(n, __scc(a), __scc(b), __scc(c), __scc(d), 0, 0)
76 #define __syscall_cp5(n, a, b, c, d, e) \ 73 #define __syscall_cp5(n, a, b, c, d, e) \
77 (__syscall_cp)(n, __scc(a), __scc(b), __scc(c), __scc(d), __scc(e), 0) 74 (__syscall_cp)(n, __scc(a), __scc(b), __scc(c), __scc(d), __scc(e), 0)
78 #define __syscall_cp6(n, a, b, c, d, e, f) \ 75 #define __syscall_cp6(n, a, b, c, d, e, f) \
79 (__syscall_cp)(n, __scc(a), __scc(b), __scc(c), __scc(d), __scc(e), __scc(f)) 76 (__syscall_cp)(n, __scc(a), __scc(b), __scc(c), __scc(d), __scc(e), __scc(f))
80 77
81 #define __syscall_cp(...) __SYSCALL_DISP(__syscall_cp, __VA_ARGS__) 78 #define __syscall_cp(...) __SYSCALL_DISP(__syscall_cp, __VA_ARGS__)
82 #define syscall_cp(...) __syscall_ret(__syscall_cp(__VA_ARGS__)) 79 #define syscall_cp(...) __syscall_ret(__syscall_cp(__VA_ARGS__))
83 80
84 #ifndef SYSCALL_USE_SOCKETCALL
85 #define __socketcall(nm, a, b, c, d, e, f) syscall(SYS_##nm, a, b, c, d, e, f)
86 #define __socketcall_cp(nm, a, b, c, d, e, f) \
87 syscall_cp(SYS_##nm, a, b, c, d, e, f)
88 #else
89 #define __socketcall(nm, a, b, c, d, e, f) \
90 syscall(SYS_socketcall, __SC_##nm, \
91 ((long[6]){(long)a, (long)b, (long)c, (long)d, (long)e, (long)f}))
92 #define __socketcall_cp(nm, a, b, c, d, e, f) \
93 syscall_cp( \
94 SYS_socketcall, __SC_##nm, \
95 ((long[6]){(long)a, (long)b, (long)c, (long)d, (long)e, (long)f}))
96 #endif
97
98 /* fixup legacy 16-bit junk */ 81 /* fixup legacy 16-bit junk */
99 82
100 #ifdef SYS_getuid32 83 #ifdef SYS_getuid32
101 #undef SYS_lchown 84 #undef SYS_lchown
102 #undef SYS_getuid 85 #undef SYS_getuid
103 #undef SYS_getgid 86 #undef SYS_getgid
104 #undef SYS_geteuid 87 #undef SYS_geteuid
105 #undef SYS_getegid 88 #undef SYS_getegid
106 #undef SYS_setreuid 89 #undef SYS_setreuid
107 #undef SYS_setregid 90 #undef SYS_setregid
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
213 #elif defined(SYS_fadvise64) 196 #elif defined(SYS_fadvise64)
214 #undef SYS_fadvise 197 #undef SYS_fadvise
215 #define SYS_fadvise SYS_fadvise64 198 #define SYS_fadvise SYS_fadvise64
216 #endif 199 #endif
217 200
218 #ifdef SYS_sendfile64 201 #ifdef SYS_sendfile64
219 #undef SYS_sendfile 202 #undef SYS_sendfile
220 #define SYS_sendfile SYS_sendfile64 203 #define SYS_sendfile SYS_sendfile64
221 #endif 204 #endif
222 205
223 /* socketcall calls */
224
225 #define __SC_socket 1
226 #define __SC_bind 2
227 #define __SC_connect 3
228 #define __SC_listen 4
229 #define __SC_accept 5
230 #define __SC_getsockname 6
231 #define __SC_getpeername 7
232 #define __SC_socketpair 8
233 #define __SC_send 9
234 #define __SC_recv 10
235 #define __SC_sendto 11
236 #define __SC_recvfrom 12
237 #define __SC_shutdown 13
238 #define __SC_setsockopt 14
239 #define __SC_getsockopt 15
240 #define __SC_sendmsg 16
241 #define __SC_recvmsg 17
242 #define __SC_accept4 18
243 #define __SC_recvmmsg 19
244 #define __SC_sendmmsg 20
245
246 #ifdef SYS_open 206 #ifdef SYS_open
247 #define __sys_open2(x, pn, fl) __syscall2(SYS_open, pn, (fl) | O_LARGEFILE) 207 #define __sys_open2(x, pn, fl) __syscall2(SYS_open, pn, (fl) | O_LARGEFILE)
248 #define __sys_open3(x, pn, fl, mo) \ 208 #define __sys_open3(x, pn, fl, mo) \
249 __syscall3(SYS_open, pn, (fl) | O_LARGEFILE, mo) 209 __syscall3(SYS_open, pn, (fl) | O_LARGEFILE, mo)
250 #define __sys_open_cp2(x, pn, fl) \ 210 #define __sys_open_cp2(x, pn, fl) \
251 __syscall_cp2(SYS_open, pn, (fl) | O_LARGEFILE) 211 __syscall_cp2(SYS_open, pn, (fl) | O_LARGEFILE)
252 #define __sys_open_cp3(x, pn, fl, mo) \ 212 #define __sys_open_cp3(x, pn, fl, mo) \
253 __syscall_cp3(SYS_open, pn, (fl) | O_LARGEFILE, mo) 213 __syscall_cp3(SYS_open, pn, (fl) | O_LARGEFILE, mo)
254 #else 214 #else
255 #define __sys_open2(x, pn, fl) \ 215 #define __sys_open2(x, pn, fl) \
256 __syscall3(SYS_openat, AT_FDCWD, pn, (fl) | O_LARGEFILE) 216 __syscall3(SYS_openat, AT_FDCWD, pn, (fl) | O_LARGEFILE)
257 #define __sys_open3(x, pn, fl, mo) \ 217 #define __sys_open3(x, pn, fl, mo) \
258 __syscall4(SYS_openat, AT_FDCWD, pn, (fl) | O_LARGEFILE, mo) 218 __syscall4(SYS_openat, AT_FDCWD, pn, (fl) | O_LARGEFILE, mo)
259 #define __sys_open_cp2(x, pn, fl) \ 219 #define __sys_open_cp2(x, pn, fl) \
260 __syscall_cp3(SYS_openat, AT_FDCWD, pn, (fl) | O_LARGEFILE) 220 __syscall_cp3(SYS_openat, AT_FDCWD, pn, (fl) | O_LARGEFILE)
261 #define __sys_open_cp3(x, pn, fl, mo) \ 221 #define __sys_open_cp3(x, pn, fl, mo) \
262 __syscall_cp4(SYS_openat, AT_FDCWD, pn, (fl) | O_LARGEFILE, mo) 222 __syscall_cp4(SYS_openat, AT_FDCWD, pn, (fl) | O_LARGEFILE, mo)
263 #endif 223 #endif
264 224
265 #define __sys_open(...) __SYSCALL_DISP(__sys_open, , __VA_ARGS__) 225 #define __sys_open(...) __SYSCALL_DISP(__sys_open, , __VA_ARGS__)
266 #define sys_open(...) __syscall_ret(__sys_open(__VA_ARGS__)) 226 #define sys_open(...) __syscall_ret(__sys_open(__VA_ARGS__))
267 227
268 #define __sys_open_cp(...) __SYSCALL_DISP(__sys_open_cp, , __VA_ARGS__) 228 #define __sys_open_cp(...) __SYSCALL_DISP(__sys_open_cp, , __VA_ARGS__)
269 #define sys_open_cp(...) __syscall_ret(__sys_open_cp(__VA_ARGS__)) 229 #define sys_open_cp(...) __syscall_ret(__sys_open_cp(__VA_ARGS__))
270 230
271 #endif 231 #endif
OLDNEW
« no previous file with comments | « no previous file | fusl/src/network/accept.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698