]>
Commit | Line | Data |
---|---|---|
1da177e4 LT |
1 | #ifndef _LINUX_SHM_H_ |
2 | #define _LINUX_SHM_H_ | |
3 | ||
1da177e4 | 4 | #include <asm/page.h> |
607ca46e | 5 | #include <uapi/linux/shm.h> |
1da177e4 | 6 | #include <asm/shmparam.h> |
060028ba | 7 | |
1da177e4 LT |
8 | struct shmid_kernel /* private to the kernel */ |
9 | { | |
10 | struct kern_ipc_perm shm_perm; | |
239521f3 | 11 | struct file *shm_file; |
1da177e4 LT |
12 | unsigned long shm_nattch; |
13 | unsigned long shm_segsz; | |
14 | time_t shm_atim; | |
15 | time_t shm_dtim; | |
16 | time_t shm_ctim; | |
17 | pid_t shm_cprid; | |
18 | pid_t shm_lprid; | |
19 | struct user_struct *mlock_user; | |
5774ed01 VK |
20 | |
21 | /* The task created the shm object. NULL if the task is dead. */ | |
22 | struct task_struct *shm_creator; | |
1da177e4 LT |
23 | }; |
24 | ||
25 | /* shm_mode upper byte flags */ | |
26 | #define SHM_DEST 01000 /* segment will be destroyed on last detach */ | |
27 | #define SHM_LOCKED 02000 /* segment will not be swapped */ | |
28 | #define SHM_HUGETLB 04000 /* segment will use huge TLB pages */ | |
bf8f972d | 29 | #define SHM_NORESERVE 010000 /* don't check for reservations */ |
1da177e4 | 30 | |
42d7395f AK |
31 | /* Bits [26:31] are reserved */ |
32 | ||
33 | /* | |
34 | * When SHM_HUGETLB is set bits [26:31] encode the log2 of the huge page size. | |
35 | * This gives us 6 bits, which is enough until someone invents 128 bit address | |
36 | * spaces. | |
37 | * | |
38 | * Assume these are all power of twos. | |
39 | * When 0 use the default page size. | |
40 | */ | |
41 | #define SHM_HUGE_SHIFT 26 | |
42 | #define SHM_HUGE_MASK 0x3f | |
43 | #define SHM_HUGE_2MB (21 << SHM_HUGE_SHIFT) | |
44 | #define SHM_HUGE_1GB (30 << SHM_HUGE_SHIFT) | |
45 | ||
1da177e4 | 46 | #ifdef CONFIG_SYSVIPC |
079a96ae WD |
47 | long do_shmat(int shmid, char __user *shmaddr, int shmflg, unsigned long *addr, |
48 | unsigned long shmlba); | |
516dffdc | 49 | extern int is_file_shm_hugepages(struct file *file); |
b34a6b1d | 50 | extern void exit_shm(struct task_struct *task); |
1da177e4 LT |
51 | #else |
52 | static inline long do_shmat(int shmid, char __user *shmaddr, | |
079a96ae WD |
53 | int shmflg, unsigned long *addr, |
54 | unsigned long shmlba) | |
1da177e4 LT |
55 | { |
56 | return -ENOSYS; | |
57 | } | |
516dffdc AL |
58 | static inline int is_file_shm_hugepages(struct file *file) |
59 | { | |
60 | return 0; | |
61 | } | |
b34a6b1d VK |
62 | static inline void exit_shm(struct task_struct *task) |
63 | { | |
64 | } | |
1da177e4 LT |
65 | #endif |
66 | ||
1da177e4 | 67 | #endif /* _LINUX_SHM_H_ */ |