aboutsummaryrefslogtreecommitdiff
path: root/core/sys
diff options
context:
space:
mode:
authorBeau McCartney <mccartney.beausl@gmail.com>2024-10-08 12:12:21 -0600
committerBeau McCartney <mccartney.beausl@gmail.com>2024-10-08 12:12:21 -0600
commit67252ff415f6c94a78c15fc1ad9ffe893d9322ca (patch)
treea03b067afa31194ac8fa6e954939b33b95640f41 /core/sys
parentdb8950922c62d4a75da068e8e17e4b27a892e11d (diff)
make some types and procs match the c apis
procs: | type | old | new (matching c api)| | --- | ---- | ------------------- | | kern_return_t | u64 | c.int | | thread_t | u64 | mach_port_t | | task_t | u64 | mach_port_t | | semaphore_t | u64 | mach_port_t | for mach_task_self(), return mach_port_t instead of task_t for semaphore_signal_thread(), accept a thread_t instead of a thread_act_t
Diffstat (limited to 'core/sys')
-rw-r--r--core/sys/darwin/mach_darwin.odin17
1 files changed, 6 insertions, 11 deletions
diff --git a/core/sys/darwin/mach_darwin.odin b/core/sys/darwin/mach_darwin.odin
index b40f26ada..722d182e4 100644
--- a/core/sys/darwin/mach_darwin.odin
+++ b/core/sys/darwin/mach_darwin.odin
@@ -4,20 +4,15 @@ foreign import mach "system:System.framework"
import "core:c"
-// NOTE(tetra): Unclear whether these should be aligned 16 or not.
-// However all other sync primitives are aligned for robustness.
-// I cannot currently align these though.
-// See core/sys/unix/pthread_linux.odin/pthread_t.
-task_t :: distinct u64
-semaphore_t :: distinct u64
-
-kern_return_t :: distinct u64
-thread_act_t :: distinct u64
+kern_return_t :: distinct c.int
mach_port_t :: distinct c.uint
vm_map_t :: mach_port_t
mem_entry_name_port_t :: mach_port_t
ipc_space_t :: mach_port_t
+thread_t :: mach_port_t
+task_t :: mach_port_t
+semaphore_t :: mach_port_t
vm_size_t :: distinct c.uintptr_t
@@ -34,14 +29,14 @@ mach_port_name_t :: distinct c.uint
@(default_calling_convention="c")
foreign mach {
- mach_task_self :: proc() -> task_t ---
+ mach_task_self :: proc() -> mach_port_t ---
semaphore_create :: proc(task: task_t, semaphore: ^semaphore_t, policy, value: c.int) -> kern_return_t ---
semaphore_destroy :: proc(task: task_t, semaphore: semaphore_t) -> kern_return_t ---
semaphore_signal :: proc(semaphore: semaphore_t) -> kern_return_t ---
semaphore_signal_all :: proc(semaphore: semaphore_t) -> kern_return_t ---
- semaphore_signal_thread :: proc(semaphore: semaphore_t, thread: thread_act_t) -> kern_return_t ---
+ semaphore_signal_thread :: proc(semaphore: semaphore_t, thread: thread_t) -> kern_return_t ---
semaphore_wait :: proc(semaphore: semaphore_t) -> kern_return_t ---