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

Cache object: a08b1aa19f4bc63391b2b32c435ab08a


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