]>
Commit | Line | Data |
---|---|---|
b2441318 | 1 | /* SPDX-License-Identifier: GPL-2.0 */ |
1da177e4 LT |
2 | #ifndef _LINUX_SHM_H_ |
3 | #define _LINUX_SHM_H_ | |
4 | ||
ab602f79 | 5 | #include <linux/list.h> |
1da177e4 | 6 | #include <asm/page.h> |
607ca46e | 7 | #include <uapi/linux/shm.h> |
1da177e4 | 8 | #include <asm/shmparam.h> |
060028ba | 9 | |
1da177e4 LT |
10 | struct shmid_kernel /* private to the kernel */ |
11 | { | |
12 | struct kern_ipc_perm shm_perm; | |
239521f3 | 13 | struct file *shm_file; |
1da177e4 LT |
14 | unsigned long shm_nattch; |
15 | unsigned long shm_segsz; | |
7ff2819e DD |
16 | time64_t shm_atim; |
17 | time64_t shm_dtim; | |
18 | time64_t shm_ctim; | |
1da177e4 LT |
19 | pid_t shm_cprid; |
20 | pid_t shm_lprid; | |
21 | struct user_struct *mlock_user; | |
5774ed01 VK |
22 | |
23 | /* The task created the shm object. NULL if the task is dead. */ | |
24 | struct task_struct *shm_creator; | |
ab602f79 | 25 | struct list_head shm_clist; /* list by creator */ |
3859a271 | 26 | } __randomize_layout; |
1da177e4 LT |
27 | |
28 | /* shm_mode upper byte flags */ | |
29 | #define SHM_DEST 01000 /* segment will be destroyed on last detach */ | |
30 | #define SHM_LOCKED 02000 /* segment will not be swapped */ | |
42d7395f | 31 | |
1da177e4 | 32 | #ifdef CONFIG_SYSVIPC |
ab602f79 JM |
33 | struct sysv_shm { |
34 | struct list_head shm_clist; | |
35 | }; | |
36 | ||
079a96ae WD |
37 | long do_shmat(int shmid, char __user *shmaddr, int shmflg, unsigned long *addr, |
38 | unsigned long shmlba); | |
2954e440 | 39 | bool is_file_shm_hugepages(struct file *file); |
ab602f79 JM |
40 | void exit_shm(struct task_struct *task); |
41 | #define shm_init_task(task) INIT_LIST_HEAD(&(task)->sysvshm.shm_clist) | |
1da177e4 | 42 | #else |
ab602f79 JM |
43 | struct sysv_shm { |
44 | /* empty */ | |
45 | }; | |
46 | ||
1da177e4 | 47 | static inline long do_shmat(int shmid, char __user *shmaddr, |
079a96ae WD |
48 | int shmflg, unsigned long *addr, |
49 | unsigned long shmlba) | |
1da177e4 LT |
50 | { |
51 | return -ENOSYS; | |
52 | } | |
2954e440 | 53 | static inline bool is_file_shm_hugepages(struct file *file) |
516dffdc | 54 | { |
2954e440 | 55 | return false; |
516dffdc | 56 | } |
b34a6b1d VK |
57 | static inline void exit_shm(struct task_struct *task) |
58 | { | |
59 | } | |
ab602f79 JM |
60 | static inline void shm_init_task(struct task_struct *task) |
61 | { | |
62 | } | |
1da177e4 LT |
63 | #endif |
64 | ||
1da177e4 | 65 | #endif /* _LINUX_SHM_H_ */ |