darwin: remove syscall usage (without -no-crt) to comply to Apple guidelines

This commit is contained in:
Laytan Laats
2024-07-08 15:39:23 +02:00
parent 861ad2037f
commit ddad2011e2
6 changed files with 78 additions and 22 deletions
@@ -3,6 +3,10 @@ package darwin
import "core:c"
import "base:runtime"
// IMPORTANT NOTE: direct syscall usage is not allowed by Apple's review process of apps and should
// be entirely avoided in the builtin Odin collections, these are here for users if they don't
// care about the Apple review process.
// this package uses the sys prefix for the proc names to indicate that these aren't native syscalls but directly call such
sys_write_string :: proc (fd: c.int, message: string) -> bool {
return syscall_write(fd, raw_data(message), cast(u64)len(message))
@@ -1,5 +1,9 @@
package darwin
// IMPORTANT NOTE: direct syscall usage is not allowed by Apple's review process of apps and should
// be entirely avoided in the builtin Odin collections, these are here for users if they don't
// care about the Apple review process.
unix_offset_syscall :: proc "contextless" (number: System_Call_Number) -> uintptr {
return uintptr(number) + uintptr(0x2000000)
}
@@ -3,6 +3,10 @@ package darwin
import "core:c"
import "base:intrinsics"
// IMPORTANT NOTE: direct syscall usage is not allowed by Apple's review process of apps and should
// be entirely avoided in the builtin Odin collections, these are here for users if they don't
// care about the Apple review process.
/* flock */
LOCK_SH :: 1 /* shared lock */
LOCK_EX :: 2 /* exclusive lock */