syscall_arch.h 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. #define __SYSCALL_LL_E(x) \
  2. ((union { long long ll; long l[2]; }){ .ll = x }).l[0], \
  3. ((union { long long ll; long l[2]; }){ .ll = x }).l[1]
  4. #define __SYSCALL_LL_O(x) 0, __SYSCALL_LL_E((x))
  5. #define _NSIG 64
  6. #define __SYSCALL_SSLEN (_NSIG/8)
  7. long (__syscall)(long, ...);
  8. static inline long __syscall0(long n)
  9. {
  10. return (__syscall)(n, 0, 0, 0, 0, 0, 0);
  11. }
  12. static inline long __syscall1(long n, long a)
  13. {
  14. return (__syscall)(n, a, 0, 0, 0, 0, 0);
  15. }
  16. static inline long __syscall2(long n, long a, long b)
  17. {
  18. return (__syscall)(n, a, b, 0, 0, 0, 0);
  19. }
  20. static inline long __syscall3(long n, long a, long b, long c)
  21. {
  22. return (__syscall)(n, a, b, c, 0, 0, 0);
  23. }
  24. static inline long __syscall4(long n, long a, long b, long c, long d)
  25. {
  26. return (__syscall)(n, a, b, c, d, 0, 0);
  27. }
  28. static inline long __syscall5(long n, long a, long b, long c, long d, long e)
  29. {
  30. return (__syscall)(n, a, b, c, d, e, 0);
  31. }
  32. static inline long __syscall6(long n, long a, long b, long c, long d, long e, long f)
  33. {
  34. return (__syscall)(n, a, b, c, d, e, f);
  35. }
  36. #define __SC_socket 1
  37. #define __SC_bind 2
  38. #define __SC_connect 3
  39. #define __SC_listen 4
  40. #define __SC_accept 5
  41. #define __SC_getsockname 6
  42. #define __SC_getpeername 7
  43. #define __SC_socketpair 8
  44. #define __SC_send 9
  45. #define __SC_recv 10
  46. #define __SC_sendto 11
  47. #define __SC_recvfrom 12
  48. #define __SC_shutdown 13
  49. #define __SC_setsockopt 14
  50. #define __SC_getsockopt 15
  51. #define __SC_sendmsg 16
  52. #define __SC_recvmsg 17