diff options
| author | Laytan Laats <laytanlaats@hotmail.com> | 2024-09-30 16:39:14 +0200 |
|---|---|---|
| committer | Laytan Laats <laytanlaats@hotmail.com> | 2024-09-30 16:39:14 +0200 |
| commit | ab54ad3a7501bed670ae4ff57908c1782b567d74 (patch) | |
| tree | 0621eb9860b582cda22e56249afb797343d838d0 | |
| parent | 9919a0cacdaaf500563954d9aca1f71ca3df36a7 (diff) | |
sys/posix: use '#max_field_align'
| -rw-r--r-- | core/sys/posix/sys_msg.odin | 30 | ||||
| -rw-r--r-- | core/sys/posix/sys_sem.odin | 20 | ||||
| -rw-r--r-- | core/sys/posix/sys_shm.odin | 24 |
3 files changed, 30 insertions, 44 deletions
diff --git a/core/sys/posix/sys_msg.odin b/core/sys/posix/sys_msg.odin index a8b86e501..98b76c3a5 100644 --- a/core/sys/posix/sys_msg.odin +++ b/core/sys/posix/sys_msg.odin @@ -64,28 +64,22 @@ when ODIN_OS == .Darwin { MSG_NOERROR :: 0o10000 - // NOTE: this is #pragma pack(4) - - msqid_ds :: struct #align(4) { - msg_perm: ipc_perm, /* [PSX] operation permission structure */ + msqid_ds :: struct #max_field_align(4) { + msg_perm: ipc_perm, /* [PSX] operation permission structure */ msg_first: c.int32_t, msg_last: c.int32_t, msg_cbytes: msglen_t, - msg_qnum: msgqnum_t, /* [PSX] number of messages currently on queue */ - msg_qbytes: msglen_t, /* [PSX] maximum number of bytes allowed on queue */ - msg_lspid: pid_t, /* [PSX] process ID of last msgsnd() */ - msg_lrpid: pid_t, /* [PSX] process ID of last msgrcv() */ - msg_stime: time_t, /* [PSX] time of last msgsnd() */ + msg_qnum: msgqnum_t, /* [PSX] number of messages currently on queue */ + msg_qbytes: msglen_t, /* [PSX] maximum number of bytes allowed on queue */ + msg_lspid: pid_t, /* [PSX] process ID of last msgsnd() */ + msg_lrpid: pid_t, /* [PSX] process ID of last msgrcv() */ + msg_stime: time_t, /* [PSX] time of last msgsnd() */ msg_pad1: c.int32_t, - using _: struct #align(4) { - msg_rtime: time_t, /* [PSX] time of last msgrcv() */ - msg_pad2: c.int32_t, - using _: struct #align(4) { - msg_ctime: time_t, /* [PSX] time of last change */ - msg_pad3: c.int32_t, - msg_pad4: [4]c.int32_t, - }, - }, + msg_rtime: time_t, /* [PSX] time of last msgrcv() */ + msg_pad2: c.int32_t, + msg_ctime: time_t, /* [PSX] time of last change */ + msg_pad3: c.int32_t, + msg_pad4: [4]c.int32_t, } } else when ODIN_OS == .FreeBSD { diff --git a/core/sys/posix/sys_sem.odin b/core/sys/posix/sys_sem.odin index 3fcde325b..2a9c8fcb6 100644 --- a/core/sys/posix/sys_sem.odin +++ b/core/sys/posix/sys_sem.odin @@ -79,19 +79,15 @@ when ODIN_OS == .Darwin || ODIN_OS == .FreeBSD || ODIN_OS == .NetBSD || ODIN_OS SETALL :: 9 when ODIN_OS == .Darwin { - // NOTE: this is #pragma pack(4) - - semid_ds :: struct #align(4) { - sem_perm: ipc_perm, /* [PSX] operation permission structure */ - sem_base: c.int32_t, /* 32 bit base ptr for semaphore set */ - sem_nsems: c.ushort, /* [PSX] number of semaphores in set */ - sem_otime: time_t, /* [PSX] last semop() */ + semid_ds :: struct #max_field_align(4) { + sem_perm: ipc_perm, /* [PSX] operation permission structure */ + sem_base: c.int32_t, /* 32 bit base ptr for semaphore set */ + sem_nsems: c.ushort, /* [PSX] number of semaphores in set */ + sem_otime: time_t, /* [PSX] last semop() */ sem_pad1: c.int32_t, - using _: struct #align(4) { - sem_ctime: time_t, /* [PSX] last time changed by semctl() */ - sem_pad2: c.int32_t, - sem_pad3: [4]c.int32_t, - }, + sem_ctime: time_t, /* [PSX] last time changed by semctl() */ + sem_pad2: c.int32_t, + sem_pad3: [4]c.int32_t, } } else when ODIN_OS == .FreeBSD { semid_ds :: struct { diff --git a/core/sys/posix/sys_shm.odin b/core/sys/posix/sys_shm.odin index 3bc883ce4..ff56ba441 100644 --- a/core/sys/posix/sys_shm.odin +++ b/core/sys/posix/sys_shm.odin @@ -67,20 +67,16 @@ when ODIN_OS == .Darwin { shmatt_t :: distinct c.ushort - // NOTE: this is #pragma pack(4) - - shmid_ds :: struct #align(4) { - shm_perm: ipc_perm, /* [PSX] operation permission structure */ - shm_segsz: c.size_t, /* [PSX] size of segment in bytes */ - shm_lpid: pid_t, /* [PSX] process ID of last shared memory operation */ - shm_cpid: pid_t, /* [PSX] process ID of creator */ - shm_nattch: shmatt_t, /* [PSX] number of current attaches */ - using _: struct #align(4) { - shm_atime: time_t, /* [PSX] time of last shmat() */ - shm_dtime: time_t, /* [PSX] time of last shmdt() */ - shm_ctime: time_t, /* [PSX] time of last change by shmctl() */ - shm_internal: rawptr, - }, + shmid_ds :: struct #max_field_align(4) { + shm_perm: ipc_perm, /* [PSX] operation permission structure */ + shm_segsz: c.size_t, /* [PSX] size of segment in bytes */ + shm_lpid: pid_t, /* [PSX] process ID of last shared memory operation */ + shm_cpid: pid_t, /* [PSX] process ID of creator */ + shm_nattch: shmatt_t, /* [PSX] number of current attaches */ + shm_atime: time_t, /* [PSX] time of last shmat() */ + shm_dtime: time_t, /* [PSX] time of last shmdt() */ + shm_ctime: time_t, /* [PSX] time of last change by shmctl() */ + shm_internal: rawptr, } } else when ODIN_OS == .FreeBSD || ODIN_OS == .NetBSD { |