mirror of
https://github.com/Ed94/Odin.git
synced 2026-07-17 16:31:25 -07:00
Merge branch 'master' into netbsd
This commit is contained in:
@@ -5,9 +5,9 @@ foreign import system "system:System.framework"
|
||||
// #define OS_WAIT_ON_ADDR_AVAILABILITY \
|
||||
// __API_AVAILABLE(macos(14.4), ios(17.4), tvos(17.4), watchos(10.4))
|
||||
when ODIN_OS == .Darwin {
|
||||
when ODIN_PLATFORM_SUBTARGET == .iOS && ODIN_MINIMUM_OS_VERSION > 17_04_00 {
|
||||
when ODIN_PLATFORM_SUBTARGET == .iOS && ODIN_MINIMUM_OS_VERSION >= 17_04_00 {
|
||||
WAIT_ON_ADDRESS_AVAILABLE :: true
|
||||
} else when ODIN_MINIMUM_OS_VERSION > 14_04_00 {
|
||||
} else when ODIN_MINIMUM_OS_VERSION >= 14_04_00 {
|
||||
WAIT_ON_ADDRESS_AVAILABLE :: true
|
||||
} else {
|
||||
WAIT_ON_ADDRESS_AVAILABLE :: false
|
||||
|
||||
+34
-15
@@ -153,23 +153,42 @@ Errno :: enum i32 {
|
||||
Open_Flags_Bits :: enum {
|
||||
WRONLY = 0,
|
||||
RDWR = 1,
|
||||
CREAT = 8,
|
||||
EXCL = 9,
|
||||
NOCTTY = 10,
|
||||
TRUNC = 11,
|
||||
APPEND = 12,
|
||||
NONBLOCK = 14,
|
||||
DSYNC = 16,
|
||||
ASYNC = 17,
|
||||
DIRECT = 18,
|
||||
LARGEFILE = 20,
|
||||
DIRECTORY = 21,
|
||||
NOFOLLOW = 22,
|
||||
NOATIME = 24,
|
||||
CLOEXEC = 25,
|
||||
PATH = 28,
|
||||
CREAT = 6,
|
||||
EXCL = 7,
|
||||
NOCTTY = 8,
|
||||
TRUNC = 9,
|
||||
APPEND = 10,
|
||||
NONBLOCK = 11,
|
||||
DSYNC = 12,
|
||||
ASYNC = 13,
|
||||
DIRECT = 14,
|
||||
LARGEFILE = 15,
|
||||
DIRECTORY = 16,
|
||||
NOFOLLOW = 17,
|
||||
NOATIME = 18,
|
||||
CLOEXEC = 19,
|
||||
PATH = 21,
|
||||
}
|
||||
|
||||
// https://github.com/torvalds/linux/blob/7367539ad4b0f8f9b396baf02110962333719a48/include/uapi/asm-generic/fcntl.h#L19
|
||||
#assert(1 << uint(Open_Flags_Bits.WRONLY) == 0o0000000_1)
|
||||
#assert(1 << uint(Open_Flags_Bits.RDWR) == 0o0000000_2)
|
||||
#assert(1 << uint(Open_Flags_Bits.CREAT) == 0o00000_100)
|
||||
#assert(1 << uint(Open_Flags_Bits.EXCL) == 0o00000_200)
|
||||
#assert(1 << uint(Open_Flags_Bits.NOCTTY) == 0o00000_400)
|
||||
#assert(1 << uint(Open_Flags_Bits.TRUNC) == 0o0000_1000)
|
||||
#assert(1 << uint(Open_Flags_Bits.APPEND) == 0o0000_2000)
|
||||
#assert(1 << uint(Open_Flags_Bits.NONBLOCK) == 0o0000_4000)
|
||||
#assert(1 << uint(Open_Flags_Bits.DSYNC) == 0o000_10000)
|
||||
#assert(1 << uint(Open_Flags_Bits.ASYNC) == 0o000_20000)
|
||||
#assert(1 << uint(Open_Flags_Bits.DIRECT) == 0o000_40000)
|
||||
#assert(1 << uint(Open_Flags_Bits.LARGEFILE) == 0o00_100000)
|
||||
#assert(1 << uint(Open_Flags_Bits.DIRECTORY) == 0o00_200000)
|
||||
#assert(1 << uint(Open_Flags_Bits.NOFOLLOW) == 0o00_400000)
|
||||
#assert(1 << uint(Open_Flags_Bits.NOATIME) == 0o0_1000000)
|
||||
#assert(1 << uint(Open_Flags_Bits.CLOEXEC) == 0o0_2000000)
|
||||
#assert(1 << uint(Open_Flags_Bits.PATH) == 0o_10000000)
|
||||
|
||||
/*
|
||||
Bits for FD_Flags bitset
|
||||
*/
|
||||
|
||||
+15
-15
@@ -26,7 +26,7 @@ where
|
||||
@(private)
|
||||
syscall2 :: #force_inline proc "contextless" (nr: uintptr,p1: $T1, p2: $T2) -> int
|
||||
where
|
||||
size_of(p1) <= size_of(uintptr) &&
|
||||
size_of(p1) <= size_of(uintptr),
|
||||
size_of(p2) <= size_of(uintptr)
|
||||
{
|
||||
return cast(int) intrinsics.syscall(nr,
|
||||
@@ -36,8 +36,8 @@ where
|
||||
@(private)
|
||||
syscall3 :: #force_inline proc "contextless" (nr: uintptr, p1: $T1, p2: $T2, p3: $T3) -> int
|
||||
where
|
||||
size_of(p1) <= size_of(uintptr) &&
|
||||
size_of(p2) <= size_of(uintptr) &&
|
||||
size_of(p1) <= size_of(uintptr),
|
||||
size_of(p2) <= size_of(uintptr),
|
||||
size_of(p3) <= size_of(uintptr)
|
||||
{
|
||||
return cast(int) intrinsics.syscall(nr,
|
||||
@@ -49,9 +49,9 @@ where
|
||||
@(private)
|
||||
syscall4 :: #force_inline proc "contextless" (nr: uintptr, p1: $T1, p2: $T2, p3: $T3, p4: $T4) -> int
|
||||
where
|
||||
size_of(p1) <= size_of(uintptr) &&
|
||||
size_of(p2) <= size_of(uintptr) &&
|
||||
size_of(p3) <= size_of(uintptr) &&
|
||||
size_of(p1) <= size_of(uintptr),
|
||||
size_of(p2) <= size_of(uintptr),
|
||||
size_of(p3) <= size_of(uintptr),
|
||||
size_of(p4) <= size_of(uintptr)
|
||||
{
|
||||
return cast(int) intrinsics.syscall(nr,
|
||||
@@ -64,10 +64,10 @@ where
|
||||
@(private)
|
||||
syscall5 :: #force_inline proc "contextless" (nr: uintptr, p1: $T1, p2: $T2, p3: $T3, p4: $T4, p5: $T5) -> int
|
||||
where
|
||||
size_of(p1) <= size_of(uintptr) &&
|
||||
size_of(p2) <= size_of(uintptr) &&
|
||||
size_of(p3) <= size_of(uintptr) &&
|
||||
size_of(p4) <= size_of(uintptr) &&
|
||||
size_of(p1) <= size_of(uintptr),
|
||||
size_of(p2) <= size_of(uintptr),
|
||||
size_of(p3) <= size_of(uintptr),
|
||||
size_of(p4) <= size_of(uintptr),
|
||||
size_of(p5) <= size_of(uintptr)
|
||||
{
|
||||
return cast(int) intrinsics.syscall(nr,
|
||||
@@ -81,11 +81,11 @@ where
|
||||
@(private)
|
||||
syscall6 :: #force_inline proc "contextless" (nr: uintptr, p1: $T1, p2: $T2, p3: $T3, p4: $T4, p5: $T5, p6: $T6) -> int
|
||||
where
|
||||
size_of(p1) <= size_of(uintptr) &&
|
||||
size_of(p2) <= size_of(uintptr) &&
|
||||
size_of(p3) <= size_of(uintptr) &&
|
||||
size_of(p4) <= size_of(uintptr) &&
|
||||
size_of(p5) <= size_of(uintptr) &&
|
||||
size_of(p1) <= size_of(uintptr),
|
||||
size_of(p2) <= size_of(uintptr),
|
||||
size_of(p3) <= size_of(uintptr),
|
||||
size_of(p4) <= size_of(uintptr),
|
||||
size_of(p5) <= size_of(uintptr),
|
||||
size_of(p6) <= size_of(uintptr)
|
||||
{
|
||||
return cast(int) intrinsics.syscall(nr,
|
||||
|
||||
@@ -2314,7 +2314,7 @@ futex :: proc {
|
||||
*/
|
||||
epoll_create :: proc(size: i32 = 1) -> (Fd, Errno) {
|
||||
when ODIN_ARCH != .arm64 {
|
||||
ret := syscall(SYS_epoll_create)
|
||||
ret := syscall(SYS_epoll_create, i32(1))
|
||||
return errno_unwrap(ret, Fd)
|
||||
} else {
|
||||
ret := syscall(SYS_epoll_create1, i32(0))
|
||||
|
||||
Reference in New Issue
Block a user