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  -  FREEBSD-12-STABLE  -  FREEBSD-12-0  -  FREEBSD-11-STABLE  -  FREEBSD-11-2  -  FREEBSD-11-1  -  FREEBSD-11-0  -  FREEBSD-10-STABLE  -  FREEBSD-10-4  -  FREEBSD-10-3  -  FREEBSD-10-2  -  FREEBSD-10-1  -  FREEBSD-10-0  -  FREEBSD-9-STABLE  -  FREEBSD-9-3  -  FREEBSD-9-2  -  FREEBSD-9-1  -  FREEBSD-9-0  -  FREEBSD-8-STABLE  -  FREEBSD-8-4  -  FREEBSD-8-3  -  FREEBSD-8-2  -  FREEBSD-8-1  -  FREEBSD-8-0  -  FREEBSD-7-STABLE  -  FREEBSD-7-4  -  FREEBSD-7-3  -  FREEBSD-7-2  -  FREEBSD-7-1  -  FREEBSD-7-0  -  FREEBSD-6-STABLE  -  FREEBSD-6-4  -  FREEBSD-6-3  -  FREEBSD-6-2  -  FREEBSD-6-1  -  FREEBSD-6-0  -  FREEBSD-5-STABLE  -  FREEBSD-5-5  -  FREEBSD-5-4  -  FREEBSD-5-3  -  FREEBSD-5-2  -  FREEBSD-5-1  -  FREEBSD-5-0  -  FREEBSD-4-STABLE  -  FREEBSD-3-STABLE  -  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: releng/10.1/sys/sys/shm.h 220388 2011-04-06 16:59:54Z trasz $ */
    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/cdefs.h>
   43 #include <sys/ipc.h>
   44 #include <sys/_types.h>
   45 
   46 #define SHM_RDONLY  010000  /* Attach read-only (else read-write) */
   47 #define SHM_RND     020000  /* Round attach address to SHMLBA */
   48 #define SHMLBA      PAGE_SIZE /* Segment low boundary address multiple */
   49 
   50 /* "official" access mode definitions; somewhat braindead since you have
   51    to specify (SHM_* >> 3) for group and (SHM_* >> 6) for world permissions */
   52 #define SHM_R       (IPC_R)
   53 #define SHM_W       (IPC_W)
   54 
   55 /* predefine tbd *LOCK shmctl commands */
   56 #define SHM_LOCK        11
   57 #define SHM_UNLOCK      12
   58 
   59 /* ipcs shmctl commands for Linux compatability */
   60 #define SHM_STAT        13
   61 #define SHM_INFO        14
   62 
   63 #ifndef _PID_T_DECLARED
   64 typedef __pid_t         pid_t;
   65 #define _PID_T_DECLARED
   66 #endif
   67 
   68 #ifndef _TIME_T_DECLARED
   69 typedef __time_t        time_t;
   70 #define _TIME_T_DECLARED
   71 #endif
   72 
   73 #ifndef _SIZE_T_DECLARED
   74 typedef __size_t        size_t;
   75 #define _SIZE_T_DECLARED
   76 #endif
   77 
   78 #if defined(COMPAT_FREEBSD4) || defined(COMPAT_FREEBSD5) || \
   79     defined(COMPAT_FREEBSD6) || defined(COMPAT_FREEBSD7)
   80 struct shmid_ds_old {
   81         struct ipc_perm_old shm_perm;   /* operation permission structure */
   82         int             shm_segsz;      /* size of segment in bytes */
   83         pid_t           shm_lpid;   /* process ID of last shared memory op */
   84         pid_t           shm_cpid;       /* process ID of creator */
   85         short           shm_nattch;     /* number of current attaches */
   86         time_t          shm_atime;      /* time of last shmat() */
   87         time_t          shm_dtime;      /* time of last shmdt() */
   88         time_t          shm_ctime;      /* time of last change by shmctl() */
   89         void           *shm_internal;   /* sysv stupidity */
   90 };
   91 #endif
   92 
   93 struct shmid_ds {
   94         struct ipc_perm shm_perm;       /* operation permission structure */
   95         size_t          shm_segsz;      /* size of segment in bytes */
   96         pid_t           shm_lpid;   /* process ID of last shared memory op */
   97         pid_t           shm_cpid;       /* process ID of creator */
   98         int             shm_nattch;     /* number of current attaches */
   99         time_t          shm_atime;      /* time of last shmat() */
  100         time_t          shm_dtime;      /* time of last shmdt() */
  101         time_t          shm_ctime;      /* time of last change by shmctl() */
  102 };
  103 
  104 #ifdef _KERNEL
  105 #include <vm/vm.h>
  106 
  107 /*
  108  * System 5 style catch-all structure for shared memory constants that
  109  * might be of interest to user programs.  Do we really want/need this?
  110  */
  111 struct shminfo {
  112         u_long  shmmax;         /* max shared memory segment size (bytes) */
  113         u_long  shmmin;         /* max shared memory segment size (bytes) */
  114         u_long  shmmni;         /* max number of shared memory identifiers */
  115         u_long  shmseg;         /* max shared memory segments per process */
  116         u_long  shmall;         /* max amount of shared memory (pages) */
  117 };
  118 
  119 /* 
  120  * Add a kernel wrapper to the shmid_ds struct so that private info (like the
  121  * MAC label) can be added to it, without changing the user interface.
  122  */
  123 struct shmid_kernel {
  124         struct shmid_ds u;
  125         vm_object_t object;
  126         struct label *label;    /* MAC label */
  127         struct ucred *cred;     /* creator's credendials */
  128 };
  129 
  130 extern struct shminfo   shminfo;
  131 
  132 struct shm_info {
  133         int used_ids;
  134         unsigned long shm_tot;
  135         unsigned long shm_rss;
  136         unsigned long shm_swp;
  137         unsigned long swap_attempts;
  138         unsigned long swap_successes;
  139 };
  140 
  141 struct thread;
  142 struct proc;
  143 struct vmspace;
  144 
  145 void    shmexit(struct vmspace *);
  146 void    shmfork(struct proc *, struct proc *);
  147 #else /* !_KERNEL */
  148 
  149 #include <sys/cdefs.h>
  150 
  151 #ifndef _SIZE_T_DECLARED
  152 typedef __size_t        size_t;
  153 #define _SIZE_T_DECLARED
  154 #endif
  155 
  156 __BEGIN_DECLS
  157 #ifdef __BSD_VISIBLE
  158 int shmsys(int, ...);
  159 #endif
  160 void *shmat(int, const void *, int);
  161 int shmget(key_t, size_t, int);
  162 int shmctl(int, int, struct shmid_ds *);
  163 int shmdt(const void *);
  164 __END_DECLS
  165 
  166 #endif /* !_KERNEL */
  167 
  168 #endif /* !_SYS_SHM_H_ */

Cache object: 80b637dff42335b78d9f716d7e844c52


[ 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.