aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/sys/posix/sys_sem.odin34
1 files changed, 24 insertions, 10 deletions
diff --git a/core/sys/posix/sys_sem.odin b/core/sys/posix/sys_sem.odin
index e876cf74a..3f60907e1 100644
--- a/core/sys/posix/sys_sem.odin
+++ b/core/sys/posix/sys_sem.odin
@@ -18,7 +18,7 @@ foreign lib {
[[ More; https://pubs.opengroup.org/onlinepubs/9699919799/functions/semctl.html ]]
*/
@(link_name=LSEMCTL)
- semctl :: proc(semid: FD, semnum: c.int, cmd: Sem_Cmd, arg: ^semun = nil) -> c.int ---
+ semctl :: proc(semid: FD, semnum: c.int, cmd: Sem_Cmd, #c_vararg args: ..semun) -> c.int ---
/*
Returns the semaphore identifier associated with key.
@@ -39,6 +39,9 @@ foreign lib {
}
Sem_Cmd :: enum c.int {
+ RMID = IPC_RMID,
+ SET = IPC_SET,
+ STAT = IPC_STAT,
// Returns the value of semncnt.
GETNCNT = GETNCNT,
// Returns the value of sempid.
@@ -137,15 +140,26 @@ when ODIN_OS == .Darwin || ODIN_OS == .FreeBSD || ODIN_OS == .NetBSD || ODIN_OS
SETVAL :: 16
SETALL :: 17
- semid_ds :: struct {
- sem_perm: ipc_perm, // [PSX] operation permission structure
- sem_otime: time_t, // [PSX] last semop()
- __sem_otime_high: c.ulong,
- sem_ctime: time_t, // [PSX] last time changed by semctl()
- __sem_ctime_high: c.ulong,
- sem_nsems: c.ulong, // [PSX] number of semaphores in set
- __glibc_reserved3: c.ulong,
- __glibc_reserved4: c.ulong,
+ when ODIN_ARCH == .arm64 {
+ semid_ds :: struct {
+ sem_perm: ipc_perm, // [PSX] operation permission structure
+ sem_otime: time_t, // [PSX] last semop()
+ __sem_otime_high: c.ulong,
+ sem_ctime: time_t, // [PSX] last time changed by semctl()
+ __sem_ctime_high: c.ulong,
+ sem_nsems: c.ulong, // [PSX] number of semaphores in set
+ __glibc_reserved3: c.ulong,
+ __glibc_reserved4: c.ulong,
+ }
+ } else {
+ semid_ds :: struct {
+ sem_perm: ipc_perm, // [PSX] operation permission structure
+ sem_otime: time_t, // [PSX] last semop()
+ sem_ctime: time_t, // [PSX] last time changed by semctl()
+ sem_nsems: c.ulong, // [PSX] number of semaphores in set
+ __glibc_reserved3: c.ulong,
+ __glibc_reserved4: c.ulong,
+ }
}
sembuf :: struct {