ipc.h 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. #ifndef IPC_H
  2. #define IPC_H
  3. #include <syscall.h>
  4. #include <bits/kernel-features.h>
  5. #include <bits/wordsize.h>
  6. #ifdef __mips__
  7. #include <sgidefs.h>
  8. #endif
  9. #ifndef __ARCH_HAS_DEPRECATED_SYSCALLS__
  10. # define __IPC_64 0x0
  11. #elif defined __mips__ && _MIPS_SIM != _ABIO32
  12. /* n32/n64 route the *ctl syscalls through sys_old_*ctl (n32: the compat_
  13. variants), which call ipc_parse_version() and so strip IPC_64 out of cmd to
  14. select the layout on every kernel version. The bit must therefore always be
  15. set, otherwise the kernel returns the ancient struct and e.g. sem_nsems
  16. comes back as 0. */
  17. # define __IPC_64 0x100
  18. #elif defined __m68k__ || defined __i386__ || defined __mips__
  19. /* 5.1+ uses the direct *ctl syscalls, which (unlike ipc()) do not strip
  20. IPC_64 -- passing it would make them fail with EINVAL. mips o32 got them
  21. as 394/396/402 and belongs here; n32/n64 are handled above. */
  22. # if __LINUX_KERNEL_VERSION < 0x050100
  23. # define __IPC_64 0x100
  24. # else
  25. # define __IPC_64 0x0
  26. # endif
  27. #elif defined __hppa__
  28. /* parisc has no ARCH_WANT_IPC_PARSE_VERSION: the kernel never strips
  29. IPC_64, so passing it makes semctl & co. fail with EINVAL. */
  30. # define __IPC_64 0x0
  31. #else
  32. # if __WORDSIZE == 32 || defined __alpha__
  33. # define __IPC_64 0x100
  34. # else
  35. # define __IPC_64 0x0
  36. # endif
  37. #endif
  38. #ifdef __NR_ipc
  39. /* The actual system call: all functions are multiplexed by this. */
  40. extern int __syscall_ipc (unsigned int __call, long __first, long __second,
  41. long __third, void *__ptr, void *__fifth) attribute_hidden;
  42. /* The codes for the functions to use the multiplexer `__syscall_ipc'. */
  43. #define IPCOP_semop 1
  44. #define IPCOP_semget 2
  45. #define IPCOP_semctl 3
  46. #define IPCOP_semtimedop 4
  47. #define IPCOP_msgsnd 11
  48. #define IPCOP_msgrcv 12
  49. #define IPCOP_msgget 13
  50. #define IPCOP_msgctl 14
  51. #define IPCOP_shmat 21
  52. #define IPCOP_shmdt 22
  53. #define IPCOP_shmget 23
  54. #define IPCOP_shmctl 24
  55. #endif
  56. #endif /* IPC_H */