shm.h 2.1 KB

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