1570af302Sopenharmony_ci#ifndef _SYS_SEM_H
2570af302Sopenharmony_ci#define _SYS_SEM_H
3570af302Sopenharmony_ci#ifdef __cplusplus
4570af302Sopenharmony_ciextern "C" {
5570af302Sopenharmony_ci#endif
6570af302Sopenharmony_ci
7570af302Sopenharmony_ci#include <features.h>
8570af302Sopenharmony_ci
9570af302Sopenharmony_ci#define __NEED_size_t
10570af302Sopenharmony_ci#define __NEED_pid_t
11570af302Sopenharmony_ci#define __NEED_time_t
12570af302Sopenharmony_ci#ifdef _GNU_SOURCE
13570af302Sopenharmony_ci#define __NEED_struct_timespec
14570af302Sopenharmony_ci#endif
15570af302Sopenharmony_ci#include <bits/alltypes.h>
16570af302Sopenharmony_ci
17570af302Sopenharmony_ci#include <sys/ipc.h>
18570af302Sopenharmony_ci
19570af302Sopenharmony_ci#define SEM_UNDO	0x1000
20570af302Sopenharmony_ci#define GETPID		11
21570af302Sopenharmony_ci#define GETVAL		12
22570af302Sopenharmony_ci#define GETALL		13
23570af302Sopenharmony_ci#define GETNCNT		14
24570af302Sopenharmony_ci#define GETZCNT		15
25570af302Sopenharmony_ci#define SETVAL		16
26570af302Sopenharmony_ci#define SETALL		17
27570af302Sopenharmony_ci
28570af302Sopenharmony_ci#include <bits/sem.h>
29570af302Sopenharmony_ci
30570af302Sopenharmony_ci#define _SEM_SEMUN_UNDEFINED 1
31570af302Sopenharmony_ci
32570af302Sopenharmony_ci#define SEM_STAT (18 | (IPC_STAT & 0x100))
33570af302Sopenharmony_ci#define SEM_INFO 19
34570af302Sopenharmony_ci#define SEM_STAT_ANY (20 | (IPC_STAT & 0x100))
35570af302Sopenharmony_ci
36570af302Sopenharmony_cistruct  seminfo {
37570af302Sopenharmony_ci	int semmap;
38570af302Sopenharmony_ci	int semmni;
39570af302Sopenharmony_ci	int semmns;
40570af302Sopenharmony_ci	int semmnu;
41570af302Sopenharmony_ci	int semmsl;
42570af302Sopenharmony_ci	int semopm;
43570af302Sopenharmony_ci	int semume;
44570af302Sopenharmony_ci	int semusz;
45570af302Sopenharmony_ci	int semvmx;
46570af302Sopenharmony_ci	int semaem;
47570af302Sopenharmony_ci};
48570af302Sopenharmony_ci
49570af302Sopenharmony_cistruct sembuf {
50570af302Sopenharmony_ci	unsigned short sem_num;
51570af302Sopenharmony_ci	short sem_op;
52570af302Sopenharmony_ci	short sem_flg;
53570af302Sopenharmony_ci};
54570af302Sopenharmony_ci
55570af302Sopenharmony_ciint semctl(int, int, int, ...);
56570af302Sopenharmony_ciint semget(key_t, int, int);
57570af302Sopenharmony_ciint semop(int, struct sembuf *, size_t);
58570af302Sopenharmony_ci
59570af302Sopenharmony_ci#ifdef _GNU_SOURCE
60570af302Sopenharmony_ciint semtimedop(int, struct sembuf *, size_t, const struct timespec *);
61570af302Sopenharmony_ci#endif
62570af302Sopenharmony_ci
63570af302Sopenharmony_ci#if _REDIR_TIME64
64570af302Sopenharmony_ci#ifdef _GNU_SOURCE
65570af302Sopenharmony_ci__REDIR(semtimedop, __semtimedop_time64);
66570af302Sopenharmony_ci#endif
67570af302Sopenharmony_ci#endif
68570af302Sopenharmony_ci
69570af302Sopenharmony_ci#ifdef __cplusplus
70570af302Sopenharmony_ci}
71570af302Sopenharmony_ci#endif
72570af302Sopenharmony_ci#endif
73