Resuscitate POSIX subsystem from revision 21378.
[reactos.git] / rossubsys / posix / include / sys / sem.h
1 /* $Id: sem.h,v 1.5 2002/10/29 04:45:21 rex Exp $
2 */
3 /*
4 * sys/sem.h
5 *
6 * semaphore facility. Conforming to the Single UNIX(r) Specification
7 * Version 2, System Interface & Headers Issue 5
8 *
9 * This file is part of the ReactOS Operating System.
10 *
11 * Contributors:
12 * Created by KJK::Hyperion <noog@libero.it>
13 *
14 * THIS SOFTWARE IS NOT COPYRIGHTED
15 *
16 * This source code is offered for use in the public domain. You may
17 * use, modify or distribute it freely.
18 *
19 * This code is distributed in the hope that it will be useful but
20 * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
21 * DISCLAMED. This includes but is not limited to warranties of
22 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
23 *
24 */
25 #ifndef __SYS_SEM_H_INCLUDED__
26 #define __SYS_SEM_H_INCLUDED__
27
28 /* INCLUDES */
29 #include <sys/ipc.h>
30
31 /* OBJECTS */
32
33 /* TYPES */
34 struct semid_ds
35 {
36 struct ipc_perm sem_perm; /* operation permission structure */
37 unsigned short int sem_nsems; /* number of semaphores in set */
38 time_t sem_otime; /* last semop time */
39 time_t sem_ctime; /* last time changed by semctl() */
40 };
41
42 struct sembuf
43 {
44 unsigned short int sem_num; /* semaphore number */
45 short int sem_op; /* semaphore operation */
46 short int sem_flg; /* operation flags */
47 };
48
49 /* CONSTANTS */
50 /* Semaphore operation flags */
51 #define SEM_UNDO (0x00001000) /* Set up adjust on exit entry */
52
53 /* Command definitions for the function semctl() */
54 #define GETNCNT (1) /* Get semncnt */
55 #define GETPID (2) /* Get sempid */
56 #define GETVAL (3) /* Get semval */
57 #define GETALL (4) /* Get all cases of semval */
58 #define GETZCNT (5) /* Get semzcnt */
59 #define SETVAL (6) /* Set semval */
60 #define SETALL (7) /* Set all cases of semval */
61
62 /* PROTOTYPES */
63 int semctl(int, int, int, ...);
64 int semget(key_t, int, int);
65 int semop(int, struct sembuf *, size_t);
66
67 /* MACROS */
68
69 #endif /* __SYS_SEM_H_INCLUDED__ */
70
71 /* EOF */
72