1 /* SPDX-License-Identifier: GPL-2.0 */
5 #include <linux/list.h>
7 #include <uapi/linux/shm.h>
8 #include <asm/shmparam.h>
10 struct shmid_kernel
/* private to the kernel */
12 struct kern_ipc_perm shm_perm
;
13 struct file
*shm_file
;
14 unsigned long shm_nattch
;
15 unsigned long shm_segsz
;
21 struct user_struct
*mlock_user
;
23 /* The task created the shm object. NULL if the task is dead. */
24 struct task_struct
*shm_creator
;
25 struct list_head shm_clist
; /* list by creator */
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 */
34 struct list_head shm_clist
;
37 long do_shmat(int shmid
, char __user
*shmaddr
, int shmflg
, unsigned long *addr
,
38 unsigned long shmlba
);
39 bool is_file_shm_hugepages(struct file
*file
);
40 void exit_shm(struct task_struct
*task
);
41 #define shm_init_task(task) INIT_LIST_HEAD(&(task)->sysvshm.shm_clist)
47 static inline long do_shmat(int shmid
, char __user
*shmaddr
,
48 int shmflg
, unsigned long *addr
,
53 static inline bool is_file_shm_hugepages(struct file
*file
)
57 static inline void exit_shm(struct task_struct
*task
)
60 static inline void shm_init_task(struct task_struct
*task
)
65 #endif /* _LINUX_SHM_H_ */