diff options
author | Ralf Baechle <ralf@linux-mips.org> | 1997-01-07 02:33:00 +0000 |
---|---|---|
committer | <ralf@linux-mips.org> | 1997-01-07 02:33:00 +0000 |
commit | beb116954b9b7f3bb56412b2494b562f02b864b1 (patch) | |
tree | 120e997879884e1b9d93b265221b939d2ef1ade1 /include/linux/shm.h | |
parent | 908d4681a1dc3792ecafbe64265783a86c4cccb6 (diff) |
Import of Linux/MIPS 2.1.14
Diffstat (limited to 'include/linux/shm.h')
-rw-r--r-- | include/linux/shm.h | 96 |
1 files changed, 35 insertions, 61 deletions
diff --git a/include/linux/shm.h b/include/linux/shm.h index 2faa4e63d..f890c7356 100644 --- a/include/linux/shm.h +++ b/include/linux/shm.h @@ -1,20 +1,23 @@ #ifndef _LINUX_SHM_H_ #define _LINUX_SHM_H_ + #include <linux/ipc.h> +#include <asm/shmparam.h> + struct shmid_ds { - struct ipc_perm shm_perm; /* operation perms */ - int shm_segsz; /* size of segment (bytes) */ - time_t shm_atime; /* last attach time */ - time_t shm_dtime; /* last detach time */ - time_t shm_ctime; /* last change time */ - unsigned short shm_cpid; /* pid of creator */ - unsigned short shm_lpid; /* pid of last operator */ - short shm_nattch; /* no. of current attaches */ + struct ipc_perm shm_perm; /* operation perms */ + int shm_segsz; /* size of segment (bytes) */ + __kernel_time_t shm_atime; /* last attach time */ + __kernel_time_t shm_dtime; /* last detach time */ + __kernel_time_t shm_ctime; /* last change time */ + __kernel_ipc_pid_t shm_cpid; /* pid of creator */ + __kernel_ipc_pid_t shm_lpid; /* pid of last operator */ + unsigned short shm_nattch; /* no. of current attaches */ /* the following are private */ - unsigned short shm_npages; /* size of segment (pages) */ - unsigned long *shm_pages; /* array of ptrs to frames -> SHMMAX */ - struct vm_area_struct *attaches; /* descriptors for attaches */ + unsigned short shm_npages; /* size of segment (pages) */ + unsigned long *shm_pages; /* array of ptrs to frames -> SHMMAX */ + struct vm_area_struct *attaches; /* descriptors for attaches */ }; /* permission flag for shmget */ @@ -30,47 +33,26 @@ struct shmid_ds { #define SHM_LOCK 11 #define SHM_UNLOCK 12 +/* ipcs ctl commands */ +#define SHM_STAT 13 +#define SHM_INFO 14 + struct shminfo { - int shmmax; - int shmmin; - int shmmni; - int shmseg; - int shmall; + int shmmax; + int shmmin; + int shmmni; + int shmseg; + int shmall; }; -/* address range for shared memory attaches if no address passed to shmat() */ -#define SHM_RANGE_START 0x50000000 -#define SHM_RANGE_END 0x60000000 - -/* format of page table entries that correspond to shared memory pages - currently out in swap space (see also mm/swap.c): - bit 0 (PAGE_PRESENT) is = 0 - bits 7..1 (SWP_TYPE) are = SHM_SWP_TYPE - bits 31..8 are used like this: - bits 14..8 (SHM_ID) the id of the shared memory segment - bits 29..15 (SHM_IDX) the index of the page within the shared memory segment - (actually only bits 24..15 get used since SHMMAX is so low) -*/ - -#define SHM_ID_SHIFT 8 -/* Keep _SHM_ID_BITS as low as possible since SHMMNI depends on it and - there is a static array of size SHMMNI. */ -#define _SHM_ID_BITS 7 -#define SHM_ID_MASK ((1<<_SHM_ID_BITS)-1) - -#define SHM_IDX_SHIFT (SHM_ID_SHIFT+_SHM_ID_BITS) -#define _SHM_IDX_BITS 15 -#define SHM_IDX_MASK ((1<<_SHM_IDX_BITS)-1) - -/* We must have SHM_ID_SHIFT + _SHM_ID_BITS + _SHM_IDX_BITS <= 32 - and SHMMAX <= (PAGE_SIZE << _SHM_IDX_BITS). */ - -#define SHMMAX 0x3fa000 /* max shared seg size (bytes) */ -#define SHMMIN 1 /* really PAGE_SIZE */ /* min shared seg size (bytes) */ -#define SHMMNI (1<<_SHM_ID_BITS) /* max num of segs system wide */ -#define SHMALL (1<<(_SHM_IDX_BITS+_SHM_ID_BITS))/* max shm system wide (pages) */ -#define SHMLBA 0x1000 /* attach addr a multiple of this */ -#define SHMSEG SHMMNI /* max shared segs per process */ +struct shm_info { + int used_ids; + unsigned long shm_tot; /* total allocated shm */ + unsigned long shm_rss; /* total resident shm */ + unsigned long shm_swp; /* total swapped shm */ + unsigned long swap_attempts; + unsigned long swap_successes; +}; #ifdef __KERNEL__ @@ -78,19 +60,11 @@ struct shminfo { #define SHM_DEST 01000 /* segment will be destroyed on last detach */ #define SHM_LOCKED 02000 /* segment will not be swapped */ -/* ipcs ctl commands */ -#define SHM_STAT 13 -#define SHM_INFO 14 -struct shm_info { - int used_ids; - ulong shm_tot; /* total allocated shm */ - ulong shm_rss; /* total resident shm */ - ulong shm_swp; /* total swapped shm */ - ulong swap_attempts; - ulong swap_successes; -}; +asmlinkage int sys_shmget (key_t key, int size, int flag); +asmlinkage int sys_shmat (int shmid, char *shmaddr, int shmflg, unsigned long *addr); +asmlinkage int sys_shmdt (char *shmaddr); +asmlinkage int sys_shmctl (int shmid, int cmd, struct shmid_ds *buf); #endif /* __KERNEL__ */ #endif /* _LINUX_SHM_H_ */ - |