syscall_arch.h 1.4 KB

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