Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | #ifndef _LINUX_SHM_H_ |
| 2 | #define _LINUX_SHM_H_ |
| 3 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4 | #include <asm/page.h> |
David Howells | 607ca46 | 2012-10-13 10:46:48 +0100 | [diff] [blame] | 5 | #include <uapi/linux/shm.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7 | #define SHMALL (SHMMAX/PAGE_SIZE*(SHMMNI/16)) /* max shm system wide (pages) */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8 | #include <asm/shmparam.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 9 | struct shmid_kernel /* private to the kernel */ |
| 10 | { |
| 11 | struct kern_ipc_perm shm_perm; |
| 12 | struct file * shm_file; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 13 | unsigned long shm_nattch; |
| 14 | unsigned long shm_segsz; |
| 15 | time_t shm_atim; |
| 16 | time_t shm_dtim; |
| 17 | time_t shm_ctim; |
| 18 | pid_t shm_cprid; |
| 19 | pid_t shm_lprid; |
| 20 | struct user_struct *mlock_user; |
Vasiliy Kulikov | 5774ed0 | 2011-07-29 03:55:31 +0400 | [diff] [blame] | 21 | |
| 22 | /* The task created the shm object. NULL if the task is dead. */ |
| 23 | struct task_struct *shm_creator; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 24 | }; |
| 25 | |
| 26 | /* shm_mode upper byte flags */ |
| 27 | #define SHM_DEST 01000 /* segment will be destroyed on last detach */ |
| 28 | #define SHM_LOCKED 02000 /* segment will not be swapped */ |
| 29 | #define SHM_HUGETLB 04000 /* segment will use huge TLB pages */ |
Badari Pulavarty | bf8f972 | 2005-11-07 00:59:27 -0800 | [diff] [blame] | 30 | #define SHM_NORESERVE 010000 /* don't check for reservations */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 31 | |
| 32 | #ifdef CONFIG_SYSVIPC |
Will Deacon | 079a96a | 2012-07-30 14:42:38 -0700 | [diff] [blame] | 33 | long do_shmat(int shmid, char __user *shmaddr, int shmflg, unsigned long *addr, |
| 34 | unsigned long shmlba); |
Adam Litke | 516dffd | 2007-03-01 15:46:08 -0800 | [diff] [blame] | 35 | extern int is_file_shm_hugepages(struct file *file); |
Vasiliy Kulikov | b34a6b1 | 2011-07-26 16:08:48 -0700 | [diff] [blame] | 36 | extern void exit_shm(struct task_struct *task); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 37 | #else |
| 38 | static inline long do_shmat(int shmid, char __user *shmaddr, |
Will Deacon | 079a96a | 2012-07-30 14:42:38 -0700 | [diff] [blame] | 39 | int shmflg, unsigned long *addr, |
| 40 | unsigned long shmlba) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 41 | { |
| 42 | return -ENOSYS; |
| 43 | } |
Adam Litke | 516dffd | 2007-03-01 15:46:08 -0800 | [diff] [blame] | 44 | static inline int is_file_shm_hugepages(struct file *file) |
| 45 | { |
| 46 | return 0; |
| 47 | } |
Vasiliy Kulikov | b34a6b1 | 2011-07-26 16:08:48 -0700 | [diff] [blame] | 48 | static inline void exit_shm(struct task_struct *task) |
| 49 | { |
| 50 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 51 | #endif |
| 52 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 53 | #endif /* _LINUX_SHM_H_ */ |