home *** CD-ROM | disk | FTP | other *** search
- /*
- * $Header: /ax/networking:include/sys/shm.h:networking 1.1 $
- * $Source: /ax/networking:include/sys/shm.h: $
- *
- * Copyright (c) 1988 Acorn Computers Ltd., Cambridge, England
- *
- * $Log: shm.h,v $
- * Revision 1.1 95/01/11 10:19:44 kwelton
- * Initial revision
- *
- * Revision 1.3 88/06/17 20:20:58 beta
- * Acorn Unix initial beta version
- *
- */
- /*
- ** IPC Shared Memory Facility.
- */
-
- #ifndef _SHM_
- #define _SHM_
-
- /*
- ** Implementation Constants and system limits.
- */
-
- #define SHMLBA NBPG /* segment low boundary address multiple */
- /* (SHMLBA must be a multiple of page size) */
-
- #define NSHMID (10) /* Max shared memory segs in system */
- #define NSHMAT (5) /* Max segs attached to one process */
- #define NSHMVPAGES (32) /* Amount of virtual address space */
- /* reserved for shm in each process */
- #define SHMMINPAGES (1) /* Min shared region size */
- #define SHMMAXPAGES (8) /* Max shared region size */
- #define SHMTOTPAGES (16) /* Limit on total system shm size */
-
- /*
- ** Permission Definitions.
- */
-
- #define SHM_R 0400 /* read permission */
- #define SHM_W 0200 /* write permission */
-
- /*
- ** ipc_perm Mode Definitions.
- */
-
- #define SHM_INIT 01000 /* grow segment on next attach */
- #define SHM_DEST 02000 /* destroy segment when # attached = 0 */
-
- /*
- ** Message Operation Flags.
- */
-
- #define SHM_RDONLY 010000 /* attach read-only (else read-write) */
- #define SHM_RND 020000 /* round attach address to SHMLBA */
-
- /*
- ** Structure Definitions.
- */
-
- /*
- ** There is a shared mem id data structure for each segment in the system.
- */
-
- struct shmid_ds {
- struct ipc_perm shm_perm; /* operation permission struct */
- int shm_segsz; /* size of segment in bytes */
- ushort shm_lpid; /* pid of last shmop */
- ushort shm_cpid; /* pid of creator */
- time_t shm_atime; /* last shmat time */
- time_t shm_dtime; /* last shmdt time */
- time_t shm_ctime; /* last change time */
- short shm_nattch; /* number of current attachments */
- struct shmat_ds *shm_shmat; /* linked list of attachments */
- #ifdef KERNEL
- struct region *shm_reg; /* ptr to region structure */
- #else KERNEL
- char *shm_reg; /* so user progs don't need region.h */
- #endif KERNEL
- };
-
- /*
- * There is a shmat_ds for each instance of a shared region being
- * attached to a process's address space.
- */
-
- struct shmat_ds
- {
- struct shmid_ds *sa_shm; /* Pointer to shared memory table entry */
- /* (0 if this shmat_ds is not in use) */
- struct shmat_ds *sa_link; /* Link to other attachments of this seg */
- #ifdef KERNEL
- struct proc *sa_proc; /* Process to which attached */
- #else KERNEL
- char *sa_proc; /* so user progs don't need proc.h */
- #endif KERNEL
- caddr_t sa_baseaddr; /* Where segment mapped in proc addr space */
- int sa_access; /* Access allowed to segment (SHM_R always, */
- /* SHM_W optional). */
- };
-
-
- /* The rest is for the kernel only */
-
- #ifdef KERNEL
- extern char *shm_base; /* Lowest virtual address available for mapping */
- /* shared memory segments. There are SHMVPAGES */
- /* available starting here. */
- extern char *shm_limit; /* Points just after highest virtual address */
- /* reserved for mapping shared memory. */
-
- extern struct pte *shm_vtopte(); /* Find pte for given shm virtual page no. */
- #endif KERNEL
-
- #endif _SHM_
-
- /* EOF shm.h */
-