| 1 | #ifndef _LINUX_SHM_H_ |
|---|
| 2 | #define _LINUX_SHM_H_ |
|---|
| 3 | |
|---|
| 4 | #include <linux/ipc.h> |
|---|
| 5 | #include <linux/errno.h> |
|---|
| 6 | #include <asm/page.h> |
|---|
| 7 | |
|---|
| 8 | /* |
|---|
| 9 | * SHMMAX, SHMMNI and SHMALL are upper limits are defaults which can |
|---|
| 10 | * be increased by sysctl |
|---|
| 11 | */ |
|---|
| 12 | |
|---|
| 13 | #define SHMMAX 0x2000000 /* max shared seg size (bytes) */ |
|---|
| 14 | #define SHMMIN 1 /* min shared seg size (bytes) */ |
|---|
| 15 | #define SHMMNI 4096 /* max num of segs system wide */ |
|---|
| 16 | #define SHMALL (SHMMAX/PAGE_SIZE*(SHMMNI/16)) /* max shm system wide (pages) */ |
|---|
| 17 | #define SHMSEG SHMMNI /* max shared segs per process */ |
|---|
| 18 | |
|---|
| 19 | #include <asm/shmparam.h> |
|---|
| 20 | |
|---|
| 21 | /* Obsolete, used only for backwards compatibility and libc5 compiles */ |
|---|
| 22 | struct shmid_ds { |
|---|
| 23 | struct ipc_perm shm_perm; /* operation perms */ |
|---|
| 24 | int shm_segsz; /* size of segment (bytes) */ |
|---|
| 25 | __kernel_time_t shm_atime; /* last attach time */ |
|---|
| 26 | __kernel_time_t shm_dtime; /* last detach time */ |
|---|
| 27 | __kernel_time_t shm_ctime; /* last change time */ |
|---|
| 28 | __kernel_ipc_pid_t shm_cpid; /* pid of creator */ |
|---|
| 29 | __kernel_ipc_pid_t shm_lpid; /* pid of last operator */ |
|---|
| 30 | unsigned short shm_nattch; /* no. of current attaches */ |
|---|
| 31 | unsigned short shm_unused; /* compatibility */ |
|---|
| 32 | void *shm_unused2; /* ditto - used by DIPC */ |
|---|
| 33 | void *shm_unused3; /* unused */ |
|---|
| 34 | }; |
|---|
| 35 | |
|---|
| 36 | /* Include the definition of shmid64_ds and shminfo64 */ |
|---|
| 37 | #include <asm/shmbuf.h> |
|---|
| 38 | |
|---|
| 39 | /* permission flag for shmget */ |
|---|
| 40 | #define SHM_R 0400 /* or S_IRUGO from <linux/stat.h> */ |
|---|
| 41 | #define SHM_W 0200 /* or S_IWUGO from <linux/stat.h> */ |
|---|
| 42 | |
|---|
| 43 | /* mode for attach */ |
|---|
| 44 | #define SHM_RDONLY 010000 /* read-only access */ |
|---|
| 45 | #define SHM_RND 020000 /* round attach address to SHMLBA boundary */ |
|---|
| 46 | #define SHM_REMAP 040000 /* take-over region on attach */ |
|---|
| 47 | #define SHM_EXEC 0100000 /* execution access */ |
|---|
| 48 | |
|---|
| 49 | /* super user shmctl commands */ |
|---|
| 50 | #define SHM_LOCK 11 |
|---|
| 51 | #define SHM_UNLOCK 12 |
|---|
| 52 | |
|---|
| 53 | /* ipcs ctl commands */ |
|---|
| 54 | #define SHM_STAT 13 |
|---|
| 55 | #define SHM_INFO 14 |
|---|
| 56 | |
|---|
| 57 | /* Obsolete, used only for backwards compatibility */ |
|---|
| 58 | struct shminfo { |
|---|
| 59 | int shmmax; |
|---|
| 60 | int shmmin; |
|---|
| 61 | int shmmni; |
|---|
| 62 | int shmseg; |
|---|
| 63 | int shmall; |
|---|
| 64 | }; |
|---|
| 65 | |
|---|
| 66 | struct shm_info { |
|---|
| 67 | int used_ids; |
|---|
| 68 | unsigned long shm_tot; /* total allocated shm */ |
|---|
| 69 | unsigned long shm_rss; /* total resident shm */ |
|---|
| 70 | unsigned long shm_swp; /* total swapped shm */ |
|---|
| 71 | unsigned long swap_attempts; |
|---|
| 72 | unsigned long swap_successes; |
|---|
| 73 | }; |
|---|
| 74 | |
|---|
| 75 | #endif /* _LINUX_SHM_H_ */ |
|---|