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. || defined __sh__ || defined __powerpc__ || defined __sparc__ \
  20. || defined __hppa__
  21. /* A direct semctl/msgctl/shmctl pointing at sys_*ctl sets IPC_64 in the
  22. kernel and rejects a cmd that carries the bit; without such a number the
  23. call goes through ipc(), which reads it out of cmd. arm, xtensa,
  24. microblaze and alpha stay out: their direct number is sys_old_*ctl, which
  25. wants the bit either way. */
  26. # ifdef __NR_semctl
  27. # define __IPC_64 0x0
  28. # else
  29. # define __IPC_64 0x100
  30. # endif
  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 */