Rev 422 | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
422 | giacomo | 1 | #ifndef _LINUX_SHM_H_ |
2 | #define _LINUX_SHM_H_ |
||
3 | |||
4 | #include <linux/ipc.h> |
||
5 | #include <asm/page.h> |
||
6 | |||
7 | /* |
||
8 | * SHMMAX, SHMMNI and SHMALL are upper limits are defaults which can |
||
9 | * be increased by sysctl |
||
10 | */ |
||
11 | |||
12 | #define SHMMAX 0x2000000 /* max shared seg size (bytes) */ |
||
13 | #define SHMMIN 1 /* min shared seg size (bytes) */ |
||
14 | #define SHMMNI 4096 /* max num of segs system wide */ |
||
15 | #define SHMALL (SHMMAX/PAGE_SIZE*(SHMMNI/16)) /* max shm system wide (pages) */ |
||
16 | #define SHMSEG SHMMNI /* max shared segs per process */ |
||
17 | |||
18 | #include <asm/shmparam.h> |
||
19 | |||
20 | /* Obsolete, used only for backwards compatibility and libc5 compiles */ |
||
21 | struct shmid_ds { |
||
22 | struct ipc_perm shm_perm; /* operation perms */ |
||
23 | int shm_segsz; /* size of segment (bytes) */ |
||
24 | __kernel_time_t shm_atime; /* last attach time */ |
||
25 | __kernel_time_t shm_dtime; /* last detach time */ |
||
26 | __kernel_time_t shm_ctime; /* last change time */ |
||
27 | __kernel_ipc_pid_t shm_cpid; /* pid of creator */ |
||
28 | __kernel_ipc_pid_t shm_lpid; /* pid of last operator */ |
||
29 | unsigned short shm_nattch; /* no. of current attaches */ |
||
30 | unsigned short shm_unused; /* compatibility */ |
||
31 | void *shm_unused2; /* ditto - used by DIPC */ |
||
32 | void *shm_unused3; /* unused */ |
||
33 | }; |
||
34 | |||
35 | /* Include the definition of shmid64_ds and shminfo64 */ |
||
36 | #include <asm/shmbuf.h> |
||
37 | |||
38 | /* permission flag for shmget */ |
||
39 | #define SHM_R 0400 /* or S_IRUGO from <linux/stat.h> */ |
||
40 | #define SHM_W 0200 /* or S_IWUGO from <linux/stat.h> */ |
||
41 | |||
42 | /* mode for attach */ |
||
43 | #define SHM_RDONLY 010000 /* read-only access */ |
||
44 | #define SHM_RND 020000 /* round attach address to SHMLBA boundary */ |
||
45 | #define SHM_REMAP 040000 /* take-over region on attach */ |
||
46 | |||
47 | /* super user shmctl commands */ |
||
48 | #define SHM_LOCK 11 |
||
49 | #define SHM_UNLOCK 12 |
||
50 | |||
51 | /* ipcs ctl commands */ |
||
52 | #define SHM_STAT 13 |
||
53 | #define SHM_INFO 14 |
||
54 | |||
55 | /* Obsolete, used only for backwards compatibility */ |
||
56 | struct shminfo { |
||
57 | int shmmax; |
||
58 | int shmmin; |
||
59 | int shmmni; |
||
60 | int shmseg; |
||
61 | int shmall; |
||
62 | }; |
||
63 | |||
64 | struct shm_info { |
||
65 | int used_ids; |
||
66 | unsigned long shm_tot; /* total allocated shm */ |
||
67 | unsigned long shm_rss; /* total resident shm */ |
||
68 | unsigned long shm_swp; /* total swapped shm */ |
||
69 | unsigned long swap_attempts; |
||
70 | unsigned long swap_successes; |
||
71 | }; |
||
72 | |||
73 | #ifdef __KERNEL__ |
||
74 | struct shmid_kernel /* private to the kernel */ |
||
75 | { |
||
76 | struct kern_ipc_perm shm_perm; |
||
77 | struct file * shm_file; |
||
78 | int id; |
||
79 | unsigned long shm_nattch; |
||
80 | unsigned long shm_segsz; |
||
81 | time_t shm_atim; |
||
82 | time_t shm_dtim; |
||
83 | time_t shm_ctim; |
||
84 | pid_t shm_cprid; |
||
85 | pid_t shm_lprid; |
||
86 | }; |
||
87 | |||
88 | /* shm_mode upper byte flags */ |
||
89 | #define SHM_DEST 01000 /* segment will be destroyed on last detach */ |
||
90 | #define SHM_LOCKED 02000 /* segment will not be swapped */ |
||
91 | #define SHM_HUGETLB 04000 /* segment will use huge TLB pages */ |
||
92 | |||
93 | long sys_shmat (int shmid, char __user *shmaddr, int shmflg, unsigned long *addr); |
||
94 | asmlinkage long sys_shmget (key_t key, size_t size, int flag); |
||
95 | asmlinkage long sys_shmdt (char __user *shmaddr); |
||
96 | asmlinkage long sys_shmctl (int shmid, int cmd, struct shmid_ds __user *buf); |
||
97 | |||
98 | #endif /* __KERNEL__ */ |
||
99 | |||
100 | #endif /* _LINUX_SHM_H_ */ |