1#ifndef _SYS_SEM_H
2#define _SYS_SEM_H
3#ifdef __cplusplus
4extern "C" {
5#endif
6
7#include <features.h>
8
9#define __NEED_size_t
10#define __NEED_pid_t
11#define __NEED_time_t
12#ifdef _GNU_SOURCE
13#define __NEED_struct_timespec
14#endif
15#include <bits/alltypes.h>
16
17#include <sys/ipc.h>
18
19#define SEM_UNDO	0x1000
20#define GETPID		11
21#define GETVAL		12
22#define GETALL		13
23#define GETNCNT		14
24#define GETZCNT		15
25#define SETVAL		16
26#define SETALL		17
27
28#include <endian.h>
29
30#include <bits/sem.h>
31
32#define _SEM_SEMUN_UNDEFINED 1
33
34#define SEM_STAT 18
35#define SEM_INFO 19
36
37struct  seminfo {
38	int semmap;
39	int semmni;
40	int semmns;
41	int semmnu;
42	int semmsl;
43	int semopm;
44	int semume;
45	int semusz;
46	int semvmx;
47	int semaem;
48};
49
50struct sembuf {
51	unsigned short sem_num;
52	short sem_op;
53	short sem_flg;
54};
55
56int semctl(int, int, int, ...);
57int semget(key_t, int, int);
58int semop(int, struct sembuf *, size_t);
59
60#ifdef _GNU_SOURCE
61int semtimedop(int, struct sembuf *, size_t, const struct timespec *);
62#endif
63
64#ifdef __cplusplus
65}
66#endif
67#endif
68