5 #include <linux/errno.h>
13 * SHMMAX, SHMMNI and SHMALL are upper limits are defaults which can
14 * be increased by sysctl
17 #define SHMMAX 0x2000000 /* max shared seg size (bytes) */
18 #define SHMMIN 1 /* min shared seg size (bytes) */
19 #define SHMMNI 4096 /* max num of segs system wide */
21 #define SHMALL (SHMMAX/PAGE_SIZE*(SHMMNI/16)) /* max shm system wide (pages) */
23 #define SHMALL (SHMMAX/getpagesize()*(SHMMNI/16))
25 #define SHMSEG SHMMNI /* max shared segs per process */
28 #include <asm/shmparam.h>
31 /* Obsolete, used only for backwards compatibility and libc5 compiles */
33 struct ipc_perm shm_perm; /* operation perms */
34 int shm_segsz; /* size of segment (bytes) */
35 __kernel_time_t shm_atime; /* last attach time */
36 __kernel_time_t shm_dtime; /* last detach time */
37 __kernel_time_t shm_ctime; /* last change time */
38 __kernel_ipc_pid_t shm_cpid; /* pid of creator */
39 __kernel_ipc_pid_t shm_lpid; /* pid of last operator */
40 unsigned short shm_nattch; /* no. of current attaches */
41 unsigned short shm_unused; /* compatibility */
42 void *shm_unused2; /* ditto - used by DIPC */
43 void *shm_unused3; /* unused */
46 /* Include the definition of shmid64_ds and shminfo64 */
47 #include <asm/shmbuf.h>
49 /* permission flag for shmget */
50 #define SHM_R 0400 /* or S_IRUGO from <linux/stat.h> */
51 #define SHM_W 0200 /* or S_IWUGO from <linux/stat.h> */
54 #define SHM_RDONLY 010000 /* read-only access */
55 #define SHM_RND 020000 /* round attach address to SHMLBA boundary */
56 #define SHM_REMAP 040000 /* take-over region on attach */
57 #define SHM_EXEC 0100000 /* execution access */
59 /* super user shmctl commands */
63 /* ipcs ctl commands */
67 /* Obsolete, used only for backwards compatibility */
78 unsigned long shm_tot; /* total allocated shm */
79 unsigned long shm_rss; /* total resident shm */
80 unsigned long shm_swp; /* total swapped shm */
81 unsigned long swap_attempts;
82 unsigned long swap_successes;
86 struct shmid_kernel /* private to the kernel */
88 struct kern_ipc_perm shm_perm;
89 struct file * shm_file;
90 unsigned long shm_nattch;
91 unsigned long shm_segsz;
97 struct user_struct *mlock_user;
100 /* shm_mode upper byte flags */
101 #define SHM_DEST 01000 /* segment will be destroyed on last detach */
102 #define SHM_LOCKED 02000 /* segment will not be swapped */
103 #define SHM_HUGETLB 04000 /* segment will use huge TLB pages */
104 #define SHM_NORESERVE 010000 /* don't check for reservations */
106 #ifdef CONFIG_SYSVIPC
107 long do_shmat(int shmid, char __user *shmaddr, int shmflg, unsigned long *addr);
108 extern int is_file_shm_hugepages(struct file *file);
110 static inline long do_shmat(int shmid, char __user *shmaddr,
111 int shmflg, unsigned long *addr)
115 static inline int is_file_shm_hugepages(struct file *file)
121 #endif /* __KERNEL__ */
123 #endif /* _LINUX_SHM_H_ */