home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 4 / Apprentice-Release4.iso / Source Code / C / Applications / Portable Patmos / usr / include / sys / shm.h < prev    next >
Encoding:
C/C++ Source or Header  |  1994-11-08  |  3.9 KB  |  109 lines  |  [TEXT/R*ch]

  1. /*
  2.  * Copyright (c) 1988 University of Utah.
  3.  * Copyright (c) 1990 The Regents of the University of California.
  4.  * All rights reserved.
  5.  *
  6.  * This code is derived from software contributed to Berkeley by
  7.  * the Systems Programming Group of the University of Utah Computer
  8.  * Science Department.
  9.  *
  10.  * Redistribution and use in source and binary forms, with or without
  11.  * modification, are permitted provided that the following conditions
  12.  * are met:
  13.  * 1. Redistributions of source code must retain the above copyright
  14.  *    notice, this list of conditions and the following disclaimer.
  15.  * 2. Redistributions in binary form must reproduce the above copyright
  16.  *    notice, this list of conditions and the following disclaimer in the
  17.  *    documentation and/or other materials provided with the distribution.
  18.  * 3. All advertising materials mentioning features or use of this software
  19.  *    must display the following acknowledgement:
  20.  *    This product includes software developed by the University of
  21.  *    California, Berkeley and its contributors.
  22.  * 4. Neither the name of the University nor the names of its contributors
  23.  *    may be used to endorse or promote products derived from this software
  24.  *    without specific prior written permission.
  25.  *
  26.  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
  27.  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  28.  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  29.  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
  30.  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  31.  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  32.  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  33.  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  34.  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  35.  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  36.  * SUCH DAMAGE.
  37.  *
  38.  *    from: @(#)shm.h    7.2 (Berkeley) 2/5/91
  39.  *    $Id: shm.h,v 1.6 1993/11/19 03:10:22 brezak Exp $
  40.  */
  41.  
  42. #ifndef _SHM_H_
  43. #define _SHM_H_
  44.  
  45. /*
  46.  * SVID compatible shm.h file
  47.  */
  48.  
  49. #ifdef KERNEL
  50. #include "ipc.h"
  51. #else
  52. #include <sys/ipc.h>
  53. #endif
  54.  
  55. struct shmid_ds {
  56.     struct    ipc_perm shm_perm;    /* operation perms */
  57.     int    shm_segsz;        /* size of segment (bytes) */
  58.     ushort    shm_cpid;        /* pid, creator */
  59.     ushort    shm_lpid;        /* pid, last operation */
  60.     short    shm_nattch;        /* no. of current attaches */
  61.     time_t    shm_atime;        /* last attach time */
  62.     time_t    shm_dtime;        /* last detach time */
  63.     time_t    shm_ctime;        /* last change time */
  64.     void    *shm_handle;        /* internal handle for shm segment */
  65. };
  66.  
  67. /*
  68.  * System 5 style catch-all structure for shared memory constants that
  69.  * might be of interest to user programs.  Do we really want/need this?
  70.  */
  71. struct    shminfo {
  72.     int    shmmax;        /* max shared memory segment size (bytes) */
  73.     int    shmmin;        /* min shared memory segment size (bytes) */
  74.     int    shmmni;        /* max number of shared memory identifiers */
  75.     int    shmseg;        /* max shared memory segments per process */
  76.     int    shmall;        /* max amount of shared memory (pages) */
  77. };
  78.  
  79. /* internal "mode" bits */
  80. #define    SHM_ALLOC    01000    /* segment is allocated */
  81. #define    SHM_DEST    02000    /* segment will be destroyed on last detach */
  82.  
  83. /* SVID required constants (same values as system 5) */
  84. #define    SHM_RDONLY    010000    /* read-only access */
  85. #define    SHM_RND        020000    /* round attach address to SHMLBA boundary */
  86.  
  87. /* implementation constants */
  88. #define    SHMLBA        CLBYTES    /* segment low boundary address multiple */
  89. #define    SHMMMNI        512    /* maximum value for shminfo.shmmni */
  90.  
  91. #ifdef KERNEL
  92. struct    shmid_ds    *shmsegs;
  93. struct    shminfo        shminfo;
  94. #endif
  95.  
  96. #ifndef KERNEL
  97. #include <sys/cdefs.h>
  98.  
  99. __BEGIN_DECLS
  100. int shmsys __P((int, ...));
  101. void *shmat  __P((int, void *, int));
  102. int shmget __P((key_t, int, int));
  103. int shmctl __P((int, int, struct shmid_ds *));
  104. int shmdt  __P((void *));
  105. __END_DECLS
  106. #endif
  107.         
  108. #endif /* !_SHM_H_ */
  109.