|
|
1.1 ! root 1: /* @(#)shm.h 6.1 */ ! 2: /* ! 3: ** IPC Shared Memory Facility. ! 4: */ ! 5: ! 6: /* ! 7: ** Implementation Constants. ! 8: */ ! 9: ! 10: #define SHMLBA NBPG /* segment low boundary address multiple */ ! 11: #define P0MASK 0xc0000000 /* P0 address mask */ ! 12: ! 13: /* ! 14: ** Permission Definitions. ! 15: */ ! 16: ! 17: #define SHM_R 0x0100 /* read permission */ ! 18: #define SHM_W 0x0080 /* write permission */ ! 19: ! 20: /* ! 21: ** ipc_perm Mode Definitions. ! 22: */ ! 23: ! 24: #define SHM_CLEAR 0x0200 /* clear segment on next attach */ ! 25: #define SHM_DEST 0x0400 /* destroy segment when # attached = 0 */ ! 26: ! 27: /* ! 28: ** Message Operation Flags. ! 29: */ ! 30: ! 31: #define SHM_RDONLY 0x1000 /* attach read-only (else read-write) */ ! 32: #define SHM_RND 0x2000 /* round attach address to SHMLBA */ ! 33: ! 34: /* ! 35: * Defines for shared memory limits ! 36: */ ! 37: ! 38: #define SHMMAX (128*NBPG) /* max. shared memory segment size */ ! 39: #define SHMMIN 1 /* min. shared memory segment size */ ! 40: #define SHMMNI 100 /* max. no. shared memory identifers */ ! 41: #define SHMSEG 6 /* max. attached shared memory segs per proc */ ! 42: #define SHMBRK 16 /* gap (clicks) between data and shared mem */ ! 43: #define SHMALL 1024 /* max shared memory clicks system wide */ ! 44: ! 45: /* ! 46: * Defines for swapping ! 47: */ ! 48: ! 49: #define DMSHM 1024 /* page segment size for disk addresses */ ! 50: #define NSHMDAD 12 /* number of shared memory disk addresses */ ! 51: #define SHM_SWAP 0x010 /* shared memory segment swapped out */ ! 52: #define SHM_UNLINK 0x020 /* proc unlinked from shared memory segment */ ! 53: ! 54: ! 55: /* ! 56: ** Structure Definitions. ! 57: */ ! 58: ! 59: /* ! 60: ** There is a shmem data structure for each segment in the system. ! 61: */ ! 62: ! 63: struct shmid_ds { ! 64: struct ipc_perm shm_perm; /* operation permission struct */ ! 65: int shm_segsz; /* segment size */ ! 66: struct proc *shm_proc; /* ptr to linked proc, if loaded */ ! 67: short shm_pidx; /* shm_pt index of that proc */ ! 68: u_short shm_lpid; /* pid of last shmop */ ! 69: u_short shm_cpid; /* pid of creator */ ! 70: u_short shm_cnattch; /* # attached in memory */ ! 71: u_short shm_nattch; /* current # attached */ ! 72: time_t shm_atime; /* last shmat time */ ! 73: time_t shm_dtime; /* last shmdt time */ ! 74: time_t shm_ctime; /* last change time */ ! 75: swblk_t shm_daddr[NSHMDAD]; /* disk add. of DMSHM pages */ ! 76: swblk_t shm_ptdaddr; /* disk add. of page tables */ ! 77: short shm_rssize; /* resident size */ ! 78: short shm_poip; /* page out in progress count */ ! 79: u_char shm_status; /* status - e.g. swapped out */ ! 80: }; ! 81: ! 82: struct shminfo { ! 83: int shmmax, /* max shared memory segment size */ ! 84: shmmin, /* min shared memory segment size */ ! 85: shmmni, /* # of shared memory identifiers */ ! 86: shmseg, /* max attached shared memory segments per process */ ! 87: shmbrk, /* gap (in clicks) between data and shared memory */ ! 88: shmall; /* max total shared memory system wide (in clicks) */ ! 89: }; ! 90: ! 91: struct shm_pt { ! 92: u_int shm_sva; /* starting virtual page address */ ! 93: struct shmid_ds *shm_shmp; /* ptr to associated shmem */ ! 94: struct proc *shm_link; /* next proc sharing this segment */ ! 95: short shm_idx; /* shm_pt index of that proc */ ! 96: struct pte *shm_spte; /* starting pte entry */ ! 97: struct pte *shm_epte; /* ending pte entry */ ! 98: int shm_sflg; /* status flag */ ! 99: }; ! 100: struct shm_pt *vtoshmpt(); ! 101: ! 102: #ifdef KERNEL ! 103: struct shmid_ds *shmem, *shmemNSHMEM; ! 104: int dmshm, nshmem; ! 105: #endif KERNEL
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.