1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef _LINUX_SHM_H_
3 #define _LINUX_SHM_H_
4 
5 #include <linux/list.h>
6 #include <asm/page.h>
7 #include <uapi/linux/shm.h>
8 #include <asm/shmparam.h>
9 
10 struct file;
11 
12 #ifdef CONFIG_SYSVIPC
13 struct sysv_shm {
14 	struct list_head shm_clist;
15 };
16 
17 long do_shmat(int shmid, char __user *shmaddr, int shmflg, unsigned long *addr,
18 	      unsigned long shmlba);
19 bool is_file_shm_hugepages(struct file *file);
20 void exit_shm(struct task_struct *task);
21 #define shm_init_task(task) INIT_LIST_HEAD(&(task)->sysvshm.shm_clist)
22 #else
23 struct sysv_shm {
24 	/* empty */
25 };
26 
do_shmat(int shmid,char __user * shmaddr,int shmflg,unsigned long * addr,unsigned long shmlba)27 static inline long do_shmat(int shmid, char __user *shmaddr,
28 			    int shmflg, unsigned long *addr,
29 			    unsigned long shmlba)
30 {
31 	return -ENOSYS;
32 }
is_file_shm_hugepages(struct file * file)33 static inline bool is_file_shm_hugepages(struct file *file)
34 {
35 	return false;
36 }
exit_shm(struct task_struct * task)37 static inline void exit_shm(struct task_struct *task)
38 {
39 }
shm_init_task(struct task_struct * task)40 static inline void shm_init_task(struct task_struct *task)
41 {
42 }
43 #endif
44 
45 #endif /* _LINUX_SHM_H_ */
46