Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

at 3882a734c19b3cd7feb9e30e1dbd8ae54ac0905a 107 lines 3.6 kB view raw
1#ifndef _UAPI_LINUX_SHM_H_ 2#define _UAPI_LINUX_SHM_H_ 3 4#include <linux/ipc.h> 5#include <linux/errno.h> 6#include <asm-generic/hugetlb_encode.h> 7#ifndef __KERNEL__ 8#include <unistd.h> 9#endif 10 11/* 12 * SHMMNI, SHMMAX and SHMALL are default upper limits which can be 13 * modified by sysctl. The SHMMAX and SHMALL values have been chosen to 14 * be as large possible without facilitating scenarios where userspace 15 * causes overflows when adjusting the limits via operations of the form 16 * "retrieve current limit; add X; update limit". It is therefore not 17 * advised to make SHMMAX and SHMALL any larger. These limits are 18 * suitable for both 32 and 64-bit systems. 19 */ 20#define SHMMIN 1 /* min shared seg size (bytes) */ 21#define SHMMNI 4096 /* max num of segs system wide */ 22#define SHMMAX (ULONG_MAX - (1UL << 24)) /* max shared seg size (bytes) */ 23#define SHMALL (ULONG_MAX - (1UL << 24)) /* max shm system wide (pages) */ 24#define SHMSEG SHMMNI /* max shared segs per process */ 25 26/* Obsolete, used only for backwards compatibility and libc5 compiles */ 27struct shmid_ds { 28 struct ipc_perm shm_perm; /* operation perms */ 29 int shm_segsz; /* size of segment (bytes) */ 30 __kernel_time_t shm_atime; /* last attach time */ 31 __kernel_time_t shm_dtime; /* last detach time */ 32 __kernel_time_t shm_ctime; /* last change time */ 33 __kernel_ipc_pid_t shm_cpid; /* pid of creator */ 34 __kernel_ipc_pid_t shm_lpid; /* pid of last operator */ 35 unsigned short shm_nattch; /* no. of current attaches */ 36 unsigned short shm_unused; /* compatibility */ 37 void *shm_unused2; /* ditto - used by DIPC */ 38 void *shm_unused3; /* unused */ 39}; 40 41/* Include the definition of shmid64_ds and shminfo64 */ 42#include <asm/shmbuf.h> 43 44/* 45 * shmget() shmflg values. 46 */ 47/* The bottom nine bits are the same as open(2) mode flags */ 48#define SHM_R 0400 /* or S_IRUGO from <linux/stat.h> */ 49#define SHM_W 0200 /* or S_IWUGO from <linux/stat.h> */ 50/* Bits 9 & 10 are IPC_CREAT and IPC_EXCL */ 51#define SHM_HUGETLB 04000 /* segment will use huge TLB pages */ 52#define SHM_NORESERVE 010000 /* don't check for reservations */ 53 54/* 55 * Huge page size encoding when SHM_HUGETLB is specified, and a huge page 56 * size other than the default is desired. See hugetlb_encode.h 57 */ 58#define SHM_HUGE_SHIFT HUGETLB_FLAG_ENCODE_SHIFT 59#define SHM_HUGE_MASK HUGETLB_FLAG_ENCODE_MASK 60 61#define SHM_HUGE_64KB HUGETLB_FLAG_ENCODE_64KB 62#define SHM_HUGE_512KB HUGETLB_FLAG_ENCODE_512KB 63#define SHM_HUGE_1MB HUGETLB_FLAG_ENCODE_1MB 64#define SHM_HUGE_2MB HUGETLB_FLAG_ENCODE_2MB 65#define SHM_HUGE_8MB HUGETLB_FLAG_ENCODE_8MB 66#define SHM_HUGE_16MB HUGETLB_FLAG_ENCODE_16MB 67#define SHM_HUGE_256MB HUGETLB_FLAG_ENCODE_256MB 68#define SHM_HUGE_1GB HUGETLB_FLAG_ENCODE_1GB 69#define SHM_HUGE_2GB HUGETLB_FLAG_ENCODE_2GB 70#define SHM_HUGE_16GB HUGETLB_FLAG_ENCODE_16GB 71 72/* 73 * shmat() shmflg values 74 */ 75#define SHM_RDONLY 010000 /* read-only access */ 76#define SHM_RND 020000 /* round attach address to SHMLBA boundary */ 77#define SHM_REMAP 040000 /* take-over region on attach */ 78#define SHM_EXEC 0100000 /* execution access */ 79 80/* super user shmctl commands */ 81#define SHM_LOCK 11 82#define SHM_UNLOCK 12 83 84/* ipcs ctl commands */ 85#define SHM_STAT 13 86#define SHM_INFO 14 87 88/* Obsolete, used only for backwards compatibility */ 89struct shminfo { 90 int shmmax; 91 int shmmin; 92 int shmmni; 93 int shmseg; 94 int shmall; 95}; 96 97struct shm_info { 98 int used_ids; 99 __kernel_ulong_t shm_tot; /* total allocated shm */ 100 __kernel_ulong_t shm_rss; /* total resident shm */ 101 __kernel_ulong_t shm_swp; /* total swapped shm */ 102 __kernel_ulong_t swap_attempts; 103 __kernel_ulong_t swap_successes; 104}; 105 106 107#endif /* _UAPI_LINUX_SHM_H_ */