home *** CD-ROM | disk | FTP | other *** search
- /*
- * @(#) sd.h 2.4 88/05/18
- *
- * Copyright (C) The Santa Cruz Operation, 1984, 1985, 1986, 1987, 1988.
- * Copyright (C) Microsoft Corporation, 1984, 1985, 1986, 1987, 1988.
- * This Module contains Proprietary Information of
- * The Santa Cruz Operation, Microsoft Corporation
- * and AT&T, and should be treated as Confidential.
- */
-
-
- /*
- * THIS FILE CONTAINS CODE WHICH IS DESIGNED TO BE
- * PORTABLE BETWEEN DIFFERENT MACHINE ARCHITECTURES
- * AND CONFIGURATIONS. IT SHOULD NOT REQUIRE ANY
- * MODIFICATIONS WHEN ADAPTING XENIX TO NEW HARDWARE.
- */
-
- #ifdef M_KERNEL
-
- #ifndef OLDSD /* for 68000 compatability */
- struct sd { /* shared data table */
- inodep_t sd_inode; /* pointer to inode for segment */
- #ifdef M_I386
- char *sd_addr; /* virt address in this proc's data space */
- caddr_t sd_laddr; /* linear address in this proc's data space */
- #else
- #ifndef M_I8086
- faddr_t sd_addr; /* address in this proc's data space */
- #else
- char far *sd_addr;
- #endif
- #endif
- int sd_vnum; /* version # for local copy */
- char sd_flags; /* describing state of this proc */
- char sd_res; /* reserved field to word align */
- struct sd *sd_link; /* ptr to next shared data seg for this proc */
- };
-
- struct shmid_ds {
- struct ipc_perm shm_perm; /* operation permission struct */
- unsigned int shm_segsz; /* segment size */
- ushort shm_ptbl; /* addr of sd segment */
- ushort shm_lpid; /* pid of last shared mem op */
- ushort shm_cpid; /* creator pid */
- ushort shm_nattch; /* current # attached */
- ushort shm_cnattch; /* in-core # attached */
- time_t shm_atime; /* last attach time */
- time_t shm_dtime; /* last detach time */
- time_t shm_ctime; /* last change time */
- };
-
- struct shmid_ent { /* shared data identifier table for SysV */
- key_t key;
- inodep_t ip;
- char shmid_flag;
- char shm_res; /* reserved field to word align */
- };
-
- struct shminfo { /* shared mem info structure for SysV */
- int shmmax, /* max shared memory segment size */
- shmmin, /* min shared memory segment size */
- shmmni, /* # of shared memory identifiers */
- shmseg, /* max attached shared memory */
- /* segments per process */
- shmbrk, /* clicks between user data and */
- /* start of shared data */
- shmall; /* max total shared memory system */
- /* wide (in clicks) */
- };
-
- extern struct sd sdtab[]; /* the shared data table itself */
- extern struct shmid_ent shmid_tab[];
- extern int shmid_pos;
-
- #ifdef M_I386
-
- extern struct sd *sdfreep; /* points to free list of sdtab entries */
- extern struct tabent *vtopte(), *ltopte();
- extern struct tabent *pagedir;
-
- #ifdef DEBUG
- extern void dump_tabent();
- #endif /* DEBUG */
-
- extern void sdfrcm();
- extern void sdatt_common();
- extern void sdcopy();
-
- #endif /* M_I386 */
-
- #endif /* OLDSD */
-
- #ifdef M_I386
-
- #define I_SD i_fdep.i_namef.i_ndata.i_sd
- #define SDNULL (faddr_t) NULL
- #define SDVERS_OVERRIDE (unsigned char) 1
- #define SDVERS_CHECK (unsigned char) 0
- #define SDSWTCH_TO 1
- #define SDSWTCH_FROM 0
- #define SHMPDE_NULL (unsigned short) -1
-
- #endif /* M_I386 */
-
- /* Shared Data flags */
-
- #define SDI_SWAPPING 0x01
- #define SDI_SHMV 0x02 /* denotes system V */
- #define SDI_LOCKED 0x10
- #define SDI_NTFY 0x20
- #define SDI_DEST 0x40
- #define SDI_CLEAR 0x80
-
- /* system V defines */
- #define SHM_RDONLY 010000 /* attach read-only, else read-write */
- #define SHM_RND 020000 /* round the attach address to start of seg. */
- #define SHMID_ORPHAN 0x01 /* no procs are attached anymore, but it has */
- /* not been removed via shmctl() yet */
- #define SHMID_WANTED 0x02 /* more than one process wants this but an */
- /* inode has not been allocated yet. */
- #define SD_BTWN 0x40
-
- /* sd segs start at addr given by (addr - (addr % SHMLBA)) */
- #ifdef M_I386
- #define SHMLBA 0x400000
- #else
- #define SHMLBA 0x10000
- #endif
-
- /* shmctl cmds */
- #define SHM_LOCK 3
- #define SHM_UNLOCK 4
-
- #else /* M_KERNEL end of kernel-only defines */
-
- extern char *sdget();
-
- #endif
-
- #define SD_RDONLY 0x00
- #define SD_WRITE 0x01
- #define SD_CREAT 0x02
- #define SD_UNLOCK 0x04
- #define SD_NOWAIT 0x08
-
-