home *** CD-ROM | disk | FTP | other *** search
/ Jason Aller Floppy Collection / 202.img / SCO386N2.TD0 / usr / include / sys / sd.h < prev    next >
Encoding:
C/C++ Source or Header  |  1988-05-18  |  4.0 KB  |  147 lines

  1. /*
  2.  *    @(#) sd.h 2.4 88/05/18 
  3.  *
  4.  *    Copyright (C) The Santa Cruz Operation, 1984, 1985, 1986, 1987, 1988.
  5.  *    Copyright (C) Microsoft Corporation, 1984, 1985, 1986, 1987, 1988.
  6.  *    This Module contains Proprietary Information of
  7.  *    The Santa Cruz Operation, Microsoft Corporation
  8.  *    and AT&T, and should be treated as Confidential.
  9.  */
  10.  
  11.  
  12. /*
  13.  * THIS FILE CONTAINS CODE WHICH IS DESIGNED TO BE
  14.  * PORTABLE BETWEEN DIFFERENT MACHINE ARCHITECTURES
  15.  * AND CONFIGURATIONS. IT SHOULD NOT REQUIRE ANY
  16.  * MODIFICATIONS WHEN ADAPTING XENIX TO NEW HARDWARE.
  17.  */
  18.  
  19. #ifdef M_KERNEL
  20.  
  21. #ifndef OLDSD            /* for 68000 compatability */
  22. struct sd {                 /* shared data table */
  23.     inodep_t     sd_inode;    /* pointer to inode for segment */
  24. #ifdef M_I386
  25.     char        *sd_addr;    /* virt address in this proc's data space */
  26.     caddr_t         sd_laddr;    /* linear address in this proc's data space */
  27. #else
  28. #ifndef M_I8086
  29.     faddr_t         sd_addr;    /* address in this proc's data space */
  30. #else
  31.     char far    *sd_addr;
  32. #endif
  33. #endif
  34.     int         sd_vnum;    /* version # for local copy */
  35.     char         sd_flags;    /* describing state of this proc */
  36.     char         sd_res;    /* reserved field to word align */
  37.     struct sd    *sd_link;    /* ptr to next shared data seg for this proc */
  38. };
  39.  
  40. struct    shmid_ds {
  41.     struct    ipc_perm shm_perm;    /* operation permission struct */
  42.     unsigned int     shm_segsz;    /* segment size */
  43.     ushort    shm_ptbl;        /* addr of sd segment */
  44.     ushort    shm_lpid;        /* pid of last shared mem op */
  45.     ushort    shm_cpid;        /* creator pid */
  46.     ushort    shm_nattch;        /* current # attached */
  47.     ushort    shm_cnattch;        /* in-core # attached */
  48.     time_t    shm_atime;        /* last attach time */
  49.     time_t    shm_dtime;        /* last detach time */
  50.     time_t    shm_ctime;        /* last change time */
  51. };        
  52.  
  53. struct  shmid_ent {    /* shared data identifier table for SysV */
  54.     key_t    key;
  55.     inodep_t ip;
  56.     char    shmid_flag;
  57.     char    shm_res;    /* reserved field to word align */
  58. };
  59.  
  60. struct  shminfo {    /* shared mem info structure for SysV */
  61.     int    shmmax,        /* max shared memory segment size */
  62.         shmmin,        /* min shared memory segment size */
  63.         shmmni,        /* # of shared memory identifiers */
  64.         shmseg,        /* max attached shared memory      */
  65.                 /* segments per process          */
  66.         shmbrk,        /* clicks between user data and   */
  67.                 /* start of shared data          */
  68.         shmall;        /* max total shared memory system */
  69.                 /* wide (in clicks)          */
  70. };
  71.  
  72. extern struct sd sdtab[];    /* the shared data table itself */
  73. extern struct shmid_ent shmid_tab[];
  74. extern int shmid_pos;
  75.  
  76. #ifdef M_I386
  77.  
  78. extern    struct sd     *sdfreep;    /* points to free list of sdtab entries */
  79. extern  struct tabent *vtopte(), *ltopte();
  80. extern  struct tabent *pagedir;
  81.  
  82. #ifdef DEBUG
  83. extern    void dump_tabent();
  84. #endif /* DEBUG */
  85.  
  86. extern    void sdfrcm();
  87. extern    void sdatt_common();
  88. extern    void sdcopy();
  89.  
  90. #endif /* M_I386 */
  91.  
  92. #endif                /* OLDSD */
  93.  
  94. #ifdef M_I386
  95.  
  96. #define I_SD i_fdep.i_namef.i_ndata.i_sd
  97. #define SDNULL    (faddr_t) NULL
  98. #define SDVERS_OVERRIDE      (unsigned char) 1
  99. #define SDVERS_CHECK       (unsigned char) 0
  100. #define SDSWTCH_TO      1
  101. #define SDSWTCH_FROM      0
  102. #define SHMPDE_NULL      (unsigned short) -1 
  103.  
  104. #endif /* M_I386 */
  105.  
  106. /* Shared Data flags */
  107.  
  108. #define SDI_SWAPPING    0x01
  109. #define SDI_SHMV    0x02    /* denotes system V */
  110. #define SDI_LOCKED    0x10
  111. #define    SDI_NTFY    0x20
  112. #define SDI_DEST    0x40
  113. #define SDI_CLEAR    0x80
  114.  
  115. /* system V defines */
  116. #define SHM_RDONLY    010000     /* attach read-only, else read-write */
  117. #define SHM_RND        020000     /* round the attach address to start of seg. */
  118. #define SHMID_ORPHAN    0x01      /* no procs are attached anymore, but it has */
  119.                  /*    not been removed via shmctl() yet      */
  120. #define    SHMID_WANTED    0x02     /* more than one process wants this but an   */
  121.                  /* inode has not been allocated yet.          */
  122. #define    SD_BTWN        0x40
  123.  
  124. /* sd segs start at addr given by (addr - (addr % SHMLBA)) */
  125. #ifdef M_I386
  126. #define SHMLBA        0x400000
  127. #else
  128. #define SHMLBA        0x10000
  129. #endif
  130.  
  131. /* shmctl cmds */
  132. #define SHM_LOCK    3
  133. #define SHM_UNLOCK    4
  134.  
  135. #else                 /* M_KERNEL end of kernel-only defines */
  136.  
  137. extern char *sdget();
  138.  
  139. #endif
  140.  
  141. #define    SD_RDONLY    0x00
  142. #define    SD_WRITE    0x01
  143. #define    SD_CREAT    0x02
  144. #define    SD_UNLOCK    0x04
  145. #define    SD_NOWAIT    0x08
  146.  
  147.