shm.h 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. #ifndef _UAPI_LINUX_SHM_H_
  2. #define _UAPI_LINUX_SHM_H_
  3. #include <linux/ipc.h>
  4. #include <linux/errno.h>
  5. #ifndef __KERNEL__
  6. #include <unistd.h>
  7. #endif
  8. /*
  9. * SHMMAX, SHMMNI and SHMALL are upper limits are defaults which can
  10. * be increased by sysctl
  11. */
  12. #define SHMMAX 0x2000000 /* max shared seg size (bytes) */
  13. #define SHMMIN 1 /* min shared seg size (bytes) */
  14. #define SHMMNI 4096 /* max num of segs system wide */
  15. #ifndef __KERNEL__
  16. #define SHMALL (SHMMAX/getpagesize()*(SHMMNI/16))
  17. #endif
  18. #define SHMSEG SHMMNI /* max shared segs per process */
  19. /* Obsolete, used only for backwards compatibility and libc5 compiles */
  20. struct shmid_ds {
  21. struct ipc_perm shm_perm; /* operation perms */
  22. int shm_segsz; /* size of segment (bytes) */
  23. __kernel_time_t shm_atime; /* last attach time */
  24. __kernel_time_t shm_dtime; /* last detach time */
  25. __kernel_time_t shm_ctime; /* last change time */
  26. __kernel_ipc_pid_t shm_cpid; /* pid of creator */
  27. __kernel_ipc_pid_t shm_lpid; /* pid of last operator */
  28. unsigned short shm_nattch; /* no. of current attaches */
  29. unsigned short shm_unused; /* compatibility */
  30. void *shm_unused2; /* ditto - used by DIPC */
  31. void *shm_unused3; /* unused */
  32. };
  33. /* Include the definition of shmid64_ds and shminfo64 */
  34. #include <asm/shmbuf.h>
  35. /* permission flag for shmget */
  36. #define SHM_R 0400 /* or S_IRUGO from <linux/stat.h> */
  37. #define SHM_W 0200 /* or S_IWUGO from <linux/stat.h> */
  38. /* mode for attach */
  39. #define SHM_RDONLY 010000 /* read-only access */
  40. #define SHM_RND 020000 /* round attach address to SHMLBA boundary */
  41. #define SHM_REMAP 040000 /* take-over region on attach */
  42. #define SHM_EXEC 0100000 /* execution access */
  43. /* super user shmctl commands */
  44. #define SHM_LOCK 11
  45. #define SHM_UNLOCK 12
  46. /* ipcs ctl commands */
  47. #define SHM_STAT 13
  48. #define SHM_INFO 14
  49. /* Obsolete, used only for backwards compatibility */
  50. struct shminfo {
  51. int shmmax;
  52. int shmmin;
  53. int shmmni;
  54. int shmseg;
  55. int shmall;
  56. };
  57. struct shm_info {
  58. int used_ids;
  59. unsigned long shm_tot; /* total allocated shm */
  60. unsigned long shm_rss; /* total resident shm */
  61. unsigned long shm_swp; /* total swapped shm */
  62. unsigned long swap_attempts;
  63. unsigned long swap_successes;
  64. };
  65. #endif /* _UAPI_LINUX_SHM_H_ */