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-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$ */
    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         unsigned 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         unsigned short  sem_num;        /* semaphore # */
   35         short           sem_op;         /* semaphore operation */
   36         short           sem_flg;        /* operation flags */
   37 };
   38 #define SEM_UNDO        010000
   39 
   40 /*
   41  * semctl's arg parameter structure
   42  */
   43 union semun {
   44         int             val;            /* value for SETVAL */
   45         struct          semid_ds *buf;  /* buffer for IPC_STAT & IPC_SET */
   46         unsigned short  *array;         /* array for GETALL & SETALL */
   47 };
   48 
   49 /*
   50  * commands for semctl
   51  */
   52 #define GETNCNT 3       /* Return the value of semncnt {READ} */
   53 #define GETPID  4       /* Return the value of sempid {READ} */
   54 #define GETVAL  5       /* Return the value of semval {READ} */
   55 #define GETALL  6       /* Return semvals into arg.array {READ} */
   56 #define GETZCNT 7       /* Return the value of semzcnt {READ} */
   57 #define SETVAL  8       /* Set the value of semval to arg.val {ALTER} */
   58 #define SETALL  9       /* Set semvals from arg.array {ALTER} */
   59 #define SEM_STAT 10     /* Like IPC_STAT but treats semid as sema-index */
   60 #define SEM_INFO 11     /* Like IPC_INFO but treats semid as sema-index */
   61 
   62 /*
   63  * Permissions
   64  */
   65 #define SEM_A           IPC_W   /* alter permission */
   66 #define SEM_R           IPC_R   /* 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 /*
   88  * Kernel wrapper for the user-level structure
   89  */
   90 struct semid_kernel {
   91         struct  semid_ds u;
   92 };
   93 
   94 /* internal "mode" bits */
   95 #define SEM_ALLOC       01000   /* semaphore is allocated */
   96 #define SEM_DEST        02000   /* semaphore will be destroyed on last detach */
   97 
   98 /*
   99  * Process sem_undo vectors at proc exit.
  100  */
  101 void    semexit(struct proc *p);
  102 #endif /* _KERNEL */
  103 
  104 #ifndef _KERNEL
  105 #include <sys/cdefs.h>
  106 #include <sys/_types.h>
  107 
  108 #ifndef _SIZE_T_DECLARED
  109 typedef __size_t        size_t;
  110 #define _SIZE_T_DECLARED
  111 #endif
  112 
  113 #ifndef _PID_T_DECLARED
  114 typedef __pid_t         pid_t;
  115 #define _PID_T_DECLARED
  116 #endif
  117 
  118 __BEGIN_DECLS
  119 int semsys(int, ...);
  120 int semctl(int, int, int, ...);
  121 int semget(key_t, int, int);
  122 int semop(int, struct sembuf *, size_t);
  123 __END_DECLS
  124 #endif /* !_KERNEL */
  125 
  126 #endif /* !_SYS_SEM_H_ */

Cache object: 7f019310959cd62a7e6b1260b3989542


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