The Design and Implementation of the FreeBSD Operating System, Second Edition
Now available: The Design and Implementation of the FreeBSD Operating System (Second Edition)


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]

FreeBSD/Linux Kernel Cross Reference
sys/sys/shm.h

Version: -  FREEBSD  -  FREEBSD11  -  FREEBSD10  -  FREEBSD9  -  FREEBSD92  -  FREEBSD91  -  FREEBSD90  -  FREEBSD8  -  FREEBSD82  -  FREEBSD81  -  FREEBSD80  -  FREEBSD7  -  FREEBSD74  -  FREEBSD73  -  FREEBSD72  -  FREEBSD71  -  FREEBSD70  -  FREEBSD6  -  FREEBSD64  -  FREEBSD63  -  FREEBSD62  -  FREEBSD61  -  FREEBSD60  -  FREEBSD5  -  FREEBSD55  -  FREEBSD54  -  FREEBSD53  -  FREEBSD52  -  FREEBSD51  -  FREEBSD50  -  FREEBSD4  -  FREEBSD3  -  FREEBSD22  -  linux-2.6  -  linux-2.4.22  -  MK83  -  MK84  -  PLAN9  -  DFBSD  -  NETBSD  -  NETBSD5  -  NETBSD4  -  NETBSD3  -  NETBSD20  -  OPENBSD  -  xnu-517  -  xnu-792  -  xnu-792.6.70  -  xnu-1228  -  xnu-1456.1.26  -  xnu-1699.24.8  -  xnu-2050.18.24  -  OPENSOLARIS  -  minix-3-1-1 
SearchContext: -  none  -  3  -  10 

    1 /* $FreeBSD$ */
    2 /*      $NetBSD: shm.h,v 1.15 1994/06/29 06:45:17 cgd Exp $     */
    3 
    4 /*-
    5  * Copyright (c) 1994 Adam Glass
    6  * All rights reserved.
    7  *
    8  * Redistribution and use in source and binary forms, with or without
    9  * modification, are permitted provided that the following conditions
   10  * are met:
   11  * 1. Redistributions of source code must retain the above copyright
   12  *    notice, this list of conditions and the following disclaimer.
   13  * 2. Redistributions in binary form must reproduce the above copyright
   14  *    notice, this list of conditions and the following disclaimer in the
   15  *    documentation and/or other materials provided with the distribution.
   16  * 3. All advertising materials mentioning features or use of this software
   17  *    must display the following acknowledgement:
   18  *      This product includes software developed by Adam Glass.
   19  * 4. The name of the author may not be used to endorse or promote products
   20  *    derived from this software without specific prior written permission
   21  *
   22  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
   23  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   24  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
   25  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
   26  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
   27  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
   28  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
   29  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
   30  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
   31  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
   32  */
   33 
   34 /*
   35  * As defined+described in "X/Open System Interfaces and Headers"
   36  *                         Issue 4, p. XXX
   37  */
   38 
   39 #ifndef _SYS_SHM_H_
   40 #define _SYS_SHM_H_
   41 
   42 #include <sys/ipc.h>
   43 
   44 #define SHM_RDONLY  010000  /* Attach read-only (else read-write) */
   45 #define SHM_RND     020000  /* Round attach address to SHMLBA */
   46 #define SHMLBA      PAGE_SIZE /* Segment low boundary address multiple */
   47 
   48 /* "official" access mode definitions; somewhat braindead since you have
   49    to specify (SHM_* >> 3) for group and (SHM_* >> 6) for world permissions */
   50 #define SHM_R       (IPC_R)
   51 #define SHM_W       (IPC_W)
   52 
   53 /* predefine tbd *LOCK shmctl commands */
   54 #define SHM_LOCK        11
   55 #define SHM_UNLOCK      12
   56 
   57 /* ipcs shmctl commands */
   58 #define SHM_STAT        13
   59 #define SHM_INFO        14
   60 
   61 struct shmid_ds {
   62         struct ipc_perm shm_perm;       /* operation permission structure */
   63         int             shm_segsz;      /* size of segment in bytes */
   64         pid_t           shm_lpid;   /* process ID of last shared memory op */
   65         pid_t           shm_cpid;       /* process ID of creator */
   66         short           shm_nattch;     /* number of current attaches */
   67         time_t          shm_atime;      /* time of last shmat() */
   68         time_t          shm_dtime;      /* time of last shmdt() */
   69         time_t          shm_ctime;      /* time of last change by shmctl() */
   70         void           *shm_internal;   /* sysv stupidity */
   71 };
   72 
   73 #ifdef _KERNEL
   74 
   75 /*
   76  * System 5 style catch-all structure for shared memory constants that
   77  * might be of interest to user programs.  Do we really want/need this?
   78  */
   79 struct shminfo {
   80         int     shmmax,         /* max shared memory segment size (bytes) */
   81                 shmmin,         /* min shared memory segment size (bytes) */
   82                 shmmni,         /* max number of shared memory identifiers */
   83                 shmseg,         /* max shared memory segments per process */
   84                 shmall;         /* max amount of shared memory (pages) */
   85 };
   86 
   87 /* 
   88  * Add a kernel wrapper to the shmid_ds struct so that private info (like the
   89  * MAC label) can be added to it, without changing the user interface.
   90  */
   91 struct shmid_kernel {
   92         struct shmid_ds u;
   93 };
   94 
   95 extern struct shminfo   shminfo;
   96 
   97 struct shm_info {
   98         int used_ids;
   99         unsigned long shm_tot;
  100         unsigned long shm_rss;
  101         unsigned long shm_swp;
  102         unsigned long swap_attempts;
  103         unsigned long swap_successes;
  104 };
  105 
  106 struct thread;
  107 struct proc;
  108 struct vmspace;
  109 
  110 void    shmexit(struct vmspace *);
  111 void    shmfork(struct proc *, struct proc *);
  112 #else /* !_KERNEL */
  113 
  114 #include <sys/cdefs.h>
  115 
  116 #ifndef _SIZE_T_DECLARED
  117 typedef __size_t        size_t;
  118 #define _SIZE_T_DECLARED
  119 #endif
  120 
  121 __BEGIN_DECLS
  122 int shmsys(int, ...);
  123 void *shmat(int, const void *, int);
  124 int shmget(key_t, size_t, int);
  125 int shmctl(int, int, struct shmid_ds *);
  126 int shmdt(const void *);
  127 __END_DECLS
  128 
  129 #endif /* !_KERNEL */
  130 
  131 #endif /* !_SYS_SHM_H_ */

Cache object: 87b1eb0eb78eb254206c817b73ce77e1


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]


This page is part of the FreeBSD/Linux Linux Kernel Cross-Reference, and was automatically generated using a modified version of the LXR engine.