Import 2.1.118
[davej-history.git] / include / linux / shm.h
blob50a7b772cb2f3561a8860fd4c57d9556c7aefb18
1 #ifndef _LINUX_SHM_H_
2 #define _LINUX_SHM_H_
4 #include <linux/ipc.h>
6 #include <asm/shmparam.h>
8 struct shmid_ds {
9 struct ipc_perm shm_perm; /* operation perms */
10 int shm_segsz; /* size of segment (bytes) */
11 __kernel_time_t shm_atime; /* last attach time */
12 __kernel_time_t shm_dtime; /* last detach time */
13 __kernel_time_t shm_ctime; /* last change time */
14 __kernel_ipc_pid_t shm_cpid; /* pid of creator */
15 __kernel_ipc_pid_t shm_lpid; /* pid of last operator */
16 unsigned short shm_nattch; /* no. of current attaches */
17 /* the following are private */
18 unsigned short shm_npages; /* size of segment (pages) */
19 unsigned long *shm_pages; /* array of ptrs to frames -> SHMMAX */
20 struct vm_area_struct *attaches; /* descriptors for attaches */
23 /* permission flag for shmget */
24 #define SHM_R 0400 /* or S_IRUGO from <linux/stat.h> */
25 #define SHM_W 0200 /* or S_IWUGO from <linux/stat.h> */
27 /* mode for attach */
28 #define SHM_RDONLY 010000 /* read-only access */
29 #define SHM_RND 020000 /* round attach address to SHMLBA boundary */
30 #define SHM_REMAP 040000 /* take-over region on attach */
32 /* super user shmctl commands */
33 #define SHM_LOCK 11
34 #define SHM_UNLOCK 12
36 /* ipcs ctl commands */
37 #define SHM_STAT 13
38 #define SHM_INFO 14
40 struct shminfo {
41 int shmmax;
42 int shmmin;
43 int shmmni;
44 int shmseg;
45 int shmall;
48 struct shm_info {
49 int used_ids;
50 unsigned long shm_tot; /* total allocated shm */
51 unsigned long shm_rss; /* total resident shm */
52 unsigned long shm_swp; /* total swapped shm */
53 unsigned long swap_attempts;
54 unsigned long swap_successes;
57 #ifdef __KERNEL__
59 /* shm_mode upper byte flags */
60 #define SHM_DEST 01000 /* segment will be destroyed on last detach */
61 #define SHM_LOCKED 02000 /* segment will not be swapped */
63 asmlinkage int sys_shmget (key_t key, int size, int flag);
64 asmlinkage int sys_shmat (int shmid, char *shmaddr, int shmflg, unsigned long *addr);
65 asmlinkage int sys_shmdt (char *shmaddr);
66 asmlinkage int sys_shmctl (int shmid, int cmd, struct shmid_ds *buf);
67 extern void shm_unuse(unsigned long entry, unsigned long page);
69 #endif /* __KERNEL__ */
71 #endif /* _LINUX_SHM_H_ */