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