d93002ad6ee92529e40c306fab0f4b82071fa7d4
[platform/upstream/glibc.git] / sysdeps / unix / sysv / linux / sys / sem_buf.h
1 /* Copyright (C) 1995 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.
3 Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, August 1995.
4
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Library General Public License as
7 published by the Free Software Foundation; either version 2 of the
8 License, or (at your option) any later version.
9
10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13 Library General Public License for more details.
14
15 You should have received a copy of the GNU Library General Public
16 License along with the GNU C Library; see the file COPYING.LIB.  If
17 not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 Boston, MA 02111-1307, USA.  */
19
20 #ifndef _SYS_SEM_BUF_H
21 #define _SYS_SEM_BUF_H
22
23 #include <features.h>
24 #include <sys/types.h>
25
26 /* Flags for `semop'.  */
27 #define SEM_UNDO        0x1000          /* undo the operation on exit */
28
29 /* Commands for `semctl'.  */
30 #define GETPID          11              /* get sempid */
31 #define GETVAL          12              /* get semval */
32 #define GETALL          13              /* get all semval's */
33 #define GETNCNT         14              /* get semncnt */
34 #define GETZCNT         15              /* get semzcnt */
35 #define SETVAL          16              /* set semval */
36 #define SETALL          17              /* set all semval's */
37
38
39 __BEGIN_DECLS
40
41 /* Data structure describing a set of semaphores.  */
42 struct semid_ds
43 {
44   struct ipc_perm sem_perm;             /* operation permisson struct */
45   __time_t sem_otime;                   /* last semop() time */
46   __time_t sem_ctime;                   /* last time changed by semctl() */
47   struct sem *__sembase;                /* ptr to first semaphore in array */
48   struct sem_queue *__sem_pending;      /* pending operations */
49   struct sem_queue *__sem_pending_last; /* last pending operation */
50   struct sem_undo *__undo;              /* ondo requests on this array */
51   unsigned short int sem_nsems;         /* number of semaphores in set */
52 };
53
54 /* Union used for argument for `semctl'.  */
55 union semun
56 {
57   int val;                              /* value for SETVAL */
58   struct semid_ds *buf;                 /* buffer for IPC_STAT & IPC_SET */
59   unsigned short int *array;            /* array for GETALL & SETALL */
60   struct seminfo *__buf;                /* buffer for IPC_INFO */
61 };
62
63 __END_DECLS
64
65 #endif /* sys/sem_buf.h */