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

Cache object: 5513f26e2b6eb0ccf85600e3aee3e975


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