blob: d8e69aed3d322d2b5a1ad05c4e6032fa25e68daf [file] [log] [blame]
Greg Kroah-Hartmanb2441312017-11-01 15:07:57 +01001/* SPDX-License-Identifier: GPL-2.0 */
Linus Torvalds1da177e2005-04-16 15:20:36 -07002#ifndef _LINUX_SHM_H_
3#define _LINUX_SHM_H_
4
Jack Millerab602f72014-08-08 14:23:19 -07005#include <linux/list.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -07006#include <asm/page.h>
David Howells607ca462012-10-13 10:46:48 +01007#include <uapi/linux/shm.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -07008#include <asm/shmparam.h>
Manfred Spraul060028b2014-06-06 14:37:42 -07009
Stephen Rothwell8ecd2952018-03-28 18:41:25 +110010struct file;
11
Linus Torvalds1da177e2005-04-16 15:20:36 -070012#ifdef CONFIG_SYSVIPC
Jack Millerab602f72014-08-08 14:23:19 -070013struct sysv_shm {
14 struct list_head shm_clist;
15};
16
Will Deacon079a96a2012-07-30 14:42:38 -070017long do_shmat(int shmid, char __user *shmaddr, int shmflg, unsigned long *addr,
18 unsigned long shmlba);
Yaowei Bai2954e4402016-01-20 15:01:11 -080019bool is_file_shm_hugepages(struct file *file);
Jack Millerab602f72014-08-08 14:23:19 -070020void exit_shm(struct task_struct *task);
21#define shm_init_task(task) INIT_LIST_HEAD(&(task)->sysvshm.shm_clist)
Linus Torvalds1da177e2005-04-16 15:20:36 -070022#else
Jack Millerab602f72014-08-08 14:23:19 -070023struct sysv_shm {
24 /* empty */
25};
26
Linus Torvalds1da177e2005-04-16 15:20:36 -070027static inline long do_shmat(int shmid, char __user *shmaddr,
Will Deacon079a96a2012-07-30 14:42:38 -070028 int shmflg, unsigned long *addr,
29 unsigned long shmlba)
Linus Torvalds1da177e2005-04-16 15:20:36 -070030{
31 return -ENOSYS;
32}
Yaowei Bai2954e4402016-01-20 15:01:11 -080033static inline bool is_file_shm_hugepages(struct file *file)
Adam Litke516dffd2007-03-01 15:46:08 -080034{
Yaowei Bai2954e4402016-01-20 15:01:11 -080035 return false;
Adam Litke516dffd2007-03-01 15:46:08 -080036}
Vasiliy Kulikovb34a6b12011-07-26 16:08:48 -070037static inline void exit_shm(struct task_struct *task)
38{
39}
Jack Millerab602f72014-08-08 14:23:19 -070040static inline void shm_init_task(struct task_struct *task)
41{
42}
Linus Torvalds1da177e2005-04-16 15:20:36 -070043#endif
44
Linus Torvalds1da177e2005-04-16 15:20:36 -070045#endif /* _LINUX_SHM_H_ */