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/sem.h

Version: -  FREEBSD  -  FREEBSD-13-STABLE  -  FREEBSD-13-0  -  FREEBSD-12-STABLE  -  FREEBSD-12-0  -  FREEBSD-11-STABLE  -  FREEBSD-11-0  -  FREEBSD-10-STABLE  -  FREEBSD-10-0  -  FREEBSD-9-STABLE  -  FREEBSD-9-0  -  FREEBSD-8-STABLE  -  FREEBSD-8-0  -  FREEBSD-7-STABLE  -  FREEBSD-7-0  -  FREEBSD-6-STABLE  -  FREEBSD-6-0  -  FREEBSD-5-STABLE  -  FREEBSD-5-0  -  FREEBSD-4-STABLE  -  FREEBSD-3-STABLE  -  FREEBSD22  -  l41  -  OPENBSD  -  linux-2.6  -  MK84  -  PLAN9  -  xnu-8792 
SearchContext: -  none  -  3  -  10 

    1 /* $FreeBSD$ */
    2 /*      $NetBSD: sem.h,v 1.5 1994/06/29 06:45:15 cgd Exp $      */
    3 
    4 /*
    5  * SVID compatible sem.h file
    6  *
    7  * Author:  Daniel Boulet
    8  */
    9 
   10 #ifndef _SYS_SEM_H_
   11 #define _SYS_SEM_H_
   12 
   13 #include <sys/ipc.h>
   14 
   15 #ifndef _PID_T_DECLARED
   16 typedef __pid_t         pid_t;
   17 #define _PID_T_DECLARED
   18 #endif
   19 
   20 #ifndef _SIZE_T_DECLARED
   21 typedef __size_t        size_t;
   22 #define _SIZE_T_DECLARED
   23 #endif
   24 
   25 #ifndef _TIME_T_DECLARED
   26 typedef __time_t        time_t;
   27 #define _TIME_T_DECLARED
   28 #endif
   29 
   30 struct semid_ds {
   31         struct ipc_perm sem_perm;       /* operation permission struct */
   32         struct sem      *sem_base;      /* pointer to first semaphore in set */
   33         unsigned short  sem_nsems;      /* number of sems in set */
   34         time_t          sem_otime;      /* last operation time */
   35         long            sem_pad1;       /* SVABI/386 says I need this here */
   36         time_t          sem_ctime;      /* last change time */
   37                                         /* Times measured in secs since */
   38                                         /* 00:00:00 GMT, Jan. 1, 1970 */
   39         long            sem_pad2;       /* SVABI/386 says I need this here */
   40         long            sem_pad3[4];    /* SVABI/386 says I need this here */
   41 };
   42 
   43 /*
   44  * semop's sops parameter structure
   45  */
   46 struct sembuf {
   47         unsigned short  sem_num;        /* semaphore # */
   48         short           sem_op;         /* semaphore operation */
   49         short           sem_flg;        /* operation flags */
   50 };
   51 #define SEM_UNDO        010000
   52 
   53 /*
   54  * semctl's arg parameter structure
   55  */
   56 union semun {
   57         int             val;            /* value for SETVAL */
   58         struct          semid_ds *buf;  /* buffer for IPC_STAT & IPC_SET */
   59         unsigned short  *array;         /* array for GETALL & SETALL */
   60 };
   61 
   62 /*
   63  * commands for semctl
   64  */
   65 #define GETNCNT 3       /* Return the value of semncnt {READ} */
   66 #define GETPID  4       /* Return the value of sempid {READ} */
   67 #define GETVAL  5       /* Return the value of semval {READ} */
   68 #define GETALL  6       /* Return semvals into arg.array {READ} */
   69 #define GETZCNT 7       /* Return the value of semzcnt {READ} */
   70 #define SETVAL  8       /* Set the value of semval to arg.val {ALTER} */
   71 #define SETALL  9       /* Set semvals from arg.array {ALTER} */
   72 #define SEM_STAT 10     /* Like IPC_STAT but treats semid as sema-index */
   73 #define SEM_INFO 11     /* Like IPC_INFO but treats semid as sema-index */
   74 
   75 /*
   76  * Permissions
   77  */
   78 #define SEM_A           IPC_W   /* alter permission */
   79 #define SEM_R           IPC_R   /* read permission */
   80 
   81 #ifdef _KERNEL
   82 
   83 /*
   84  * semaphore info struct
   85  */
   86 struct seminfo {
   87         int     semmap,         /* # of entries in semaphore map */
   88                 semmni,         /* # of semaphore identifiers */
   89                 semmns,         /* # of semaphores in system */
   90                 semmnu,         /* # of undo structures in system */
   91                 semmsl,         /* max # of semaphores per id */
   92                 semopm,         /* max # of operations per semop call */
   93                 semume,         /* max # of undo entries per process */
   94                 semusz,         /* size in bytes of undo structure */
   95                 semvmx,         /* semaphore maximum value */
   96                 semaem;         /* adjust on exit max value */
   97 };
   98 extern struct seminfo   seminfo;
   99 
  100 /*
  101  * Kernel wrapper for the user-level structure
  102  */
  103 struct semid_kernel {
  104         struct  semid_ds u;
  105         struct  label *label;   /* MAC framework label */
  106 };
  107 
  108 /* internal "mode" bits */
  109 #define SEM_ALLOC       01000   /* semaphore is allocated */
  110 #define SEM_DEST        02000   /* semaphore will be destroyed on last detach */
  111 
  112 /*
  113  * Process sem_undo vectors at proc exit.
  114  */
  115 void    semexit(struct proc *p);
  116 
  117 #else /* ! _KERNEL */
  118 
  119 __BEGIN_DECLS
  120 int semsys(int, ...);
  121 int semctl(int, int, int, ...);
  122 int semget(key_t, int, int);
  123 int semop(int, struct sembuf *, size_t);
  124 __END_DECLS
  125 
  126 #endif /* !_KERNEL */
  127 
  128 #endif /* !_SYS_SEM_H_ */

Cache object: d8e7a345e580f34d9aec48c4c9b80a4e


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