1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
use super::ipc::*;
use super::types::*;
pub const SEM_UNDO: i32 = 0x1000;
pub const GETPID: i32 = 11;
pub const GETVAL: i32 = 12;
pub const GETALL: i32 = 13;
pub const GETNCNT: i32 = 14;
pub const GETZCNT: i32 = 15;
pub const SETVAL: i32 = 16;
pub const SETALL: i32 = 17;
pub const SEM_STAT: i32 = 18;
pub const SEM_INFO: i32 = 19;
pub const SEM_STAT_ANY: i32 = 20;
#[repr(C)]
#[derive(Clone, Copy)]
pub struct semid_ds_t {
pub sem_perm: ipc_perm_t,
pub sem_otime: time_t,
pub sem_ctime: time_t,
pub sem_base: usize,
pub sem_pending: usize,
pub sem_pending_last: usize,
pub undo: usize,
pub sem_nsems: u16,
}
#[repr(C)]
#[derive(Clone, Copy)]
pub struct sembuf_t {
pub sem_num: u16,
pub sem_op: i16,
pub sem_flg: i16,
}
#[repr(C)]
#[derive(Clone, Copy)]
pub union semun_t {
pub val: i32,
pub buf: *mut semid_ds_t,
pub array: *mut u16,
pub info_buf: seminfo_t,
pad: usize,
}
#[repr(C)]
#[derive(Clone, Copy)]
pub struct seminfo_t {
pub semmap: i32,
pub semmni: i32,
pub semmns: i32,
pub semmnu: i32,
pub semmsl: i32,
pub semopm: i32,
pub semume: i32,
pub semusz: i32,
pub semvmx: i32,
pub semaem: i32,
}
pub const SEMMNI: i32 = 32000;
pub const SEMMSL: i32 = 32000;
pub const SEMMNS: i32 = SEMMNI * SEMMSL;
pub const SEMOPM: i32 = 500;
pub const SEMVMX: i32 = 32767;
pub const SEMAEM: i32 = SEMVMX;
pub const SEMUME: i32 = SEMOPM;
pub const SEMMNU: i32 = SEMMNS;
pub const SEMMAP: i32 = SEMMNS;
pub const SEMUSZ: i32 = 20;