@@ -18,7 +18,7 @@ foreign lib {
1818 [[ More; https://pubs.opengroup.org/onlinepubs/9699919799/functions/semctl.html ]]
1919 */
2020 @ (link_name=LSEMCTL)
21- semctl :: proc (semid: FD, semnum: c.int , cmd: Sem_Cmd, arg: ^ semun = nil ) -> c.int ---
21+ semctl :: proc (semid: FD, semnum: c.int , cmd: Sem_Cmd, #c_vararg args: .. semun) -> c.int ---
2222
2323 /*
2424 Returns the semaphore identifier associated with key.
@@ -39,6 +39,9 @@ foreign lib {
3939}
4040
4141Sem_Cmd :: enum c.int {
42+ RMID = IPC_RMID,
43+ SET = IPC_SET,
44+ STAT = IPC_STAT,
4245 // Returns the value of semncnt.
4346 GETNCNT = GETNCNT,
4447 // Returns the value of sempid.
@@ -137,15 +140,26 @@ when ODIN_OS == .Darwin || ODIN_OS == .FreeBSD || ODIN_OS == .NetBSD || ODIN_OS
137140 SETVAL :: 16
138141 SETALL :: 17
139142
140- semid_ds :: struct {
141- sem_perm: ipc_perm, // [PSX] operation permission structure
142- sem_otime: time_t, // [PSX] last semop()
143- __sem_otime_high: c.ulong,
144- sem_ctime: time_t, // [PSX] last time changed by semctl()
145- __sem_ctime_high: c.ulong,
146- sem_nsems: c.ulong, // [PSX] number of semaphores in set
147- __glibc_reserved3: c.ulong,
148- __glibc_reserved4: c.ulong,
143+ when ODIN_ARCH == .arm64 {
144+ semid_ds :: struct {
145+ sem_perm: ipc_perm, // [PSX] operation permission structure
146+ sem_otime: time_t, // [PSX] last semop()
147+ sem_ctime: time_t, // [PSX] last time changed by semctl()
148+ sem_nsems: c.ulong, // [PSX] number of semaphores in set
149+ __glibc_reserved3: c.ulong,
150+ __glibc_reserved4: c.ulong,
151+ }
152+ } else {
153+ semid_ds :: struct {
154+ sem_perm: ipc_perm, // [PSX] operation permission structure
155+ sem_otime: time_t, // [PSX] last semop()
156+ __sem_otime_high: c.ulong,
157+ sem_ctime: time_t, // [PSX] last time changed by semctl()
158+ __sem_ctime_high: c.ulong,
159+ sem_nsems: c.ulong, // [PSX] number of semaphores in set
160+ __glibc_reserved3: c.ulong,
161+ __glibc_reserved4: c.ulong,
162+ }
149163 }
150164
151165 sembuf :: struct {
0 commit comments