1 /* 2 * Licensed under the LGPL v2.1 or later, see the file COPYING.LIB 3 * in this tarball. 4 */ 5 6 #ifndef _SYS_SHM_H 7 # error "Never include <bits/shm.h> directly; use <sys/shm.h> instead." 8 #endif 9 10 #include <bits/types.h> 11 12 /* Permission flag for shmget. */ 13 #define SHM_R 0400 /* or S_IRUGO from <linux/stat.h> */ 14 #define SHM_W 0200 /* or S_IWUGO from <linux/stat.h> */ 15 16 /* Flags for `shmat'. */ 17 #define SHM_RDONLY 010000 /* attach read-only else read-write */ 18 #define SHM_RND 020000 /* round attach address to SHMLBA */ 19 #define SHM_REMAP 040000 /* take-over region on attach */ 20 21 /* Commands for `shmctl'. */ 22 #define SHM_LOCK 11 /* lock segment (root only) */ 23 #define SHM_UNLOCK 12 /* unlock segment (root only) */ 24 25 __BEGIN_DECLS 26 27 /* Segment low boundary address multiple. */ 28 #define SHMLBA (__getpagesize () << 2) 29 extern int __getpagesize (void) __THROW __attribute__ ((__const__)); 30 31 32 /* Type to count number of attaches. */ 33 typedef unsigned long int shmatt_t; 34 35 /* Data structure describing a set of semaphores. */ 36 struct shmid_ds 37 { 38 struct ipc_perm shm_perm; /* operation permission struct */ 39 size_t shm_segsz; /* size of segment in bytes */ 40 __time_t shm_atime; /* time of last shmat() */ 41 unsigned long int __uclibc_unused1; 42 __time_t shm_dtime; /* time of last shmdt() */ 43 unsigned long int __uclibc_unused2; 44 __time_t shm_ctime; /* time of last change by shmctl() */ 45 unsigned long int __uclibc_unused3; 46 __pid_t shm_cpid; /* pid of creator */ 47 __pid_t shm_lpid; /* pid of last shmop */ 48 shmatt_t shm_nattch; /* number of current attaches */ 49 unsigned long int __uclibc_unused4; 50 unsigned long int __uclibc_unused5; 51 }; 52 53 #ifdef __USE_MISC 54 55 /* ipcs ctl commands */ 56 # define SHM_STAT 13 57 # define SHM_INFO 14 58 59 /* shm_mode upper byte flags */ 60 # define SHM_DEST 01000 /* segment will be destroyed on last detach */ 61 # define SHM_LOCKED 02000 /* segment will not be swapped */ 62 # define SHM_HUGETLB 04000 /* segment is mapped via hugetlb */ 63 # define SHM_NORESERVE 010000 /* don't check for reservations */ 64 65 struct shminfo 66 { 67 unsigned long int shmmax; 68 unsigned long int shmmin; 69 unsigned long int shmmni; 70 unsigned long int shmseg; 71 unsigned long int shmall; 72 unsigned long int __uclibc_unused1; 73 unsigned long int __uclibc_unused2; 74 unsigned long int __uclibc_unused3; 75 unsigned long int __uclibc_unused4; 76 }; 77 78 struct shm_info 79 { 80 int used_ids; 81 unsigned long int shm_tot; /* total allocated shm */ 82 unsigned long int shm_rss; /* total resident shm */ 83 unsigned long int shm_swp; /* total swapped shm */ 84 unsigned long int swap_attempts; 85 unsigned long int swap_successes; 86 }; 87 88 #endif /* __USE_MISC */ 89 90 __END_DECLS 91