Implement Linux POSIX compliance for poll, sched, sys/select. Fix enum in fcntl.

This commit is contained in:
Isaac Andrade
2024-09-14 20:23:42 -06:00
parent aa91479870
commit 8616842ec6
4 changed files with 10 additions and 10 deletions

View File

@@ -128,7 +128,7 @@ O_Flag_Bits :: enum c.int {
// RSYNC = O_RSYNC,
// Execute only.
EXEC = log2(O_EXEC),
EXEC = O_EXEC when ODIN_OS == .Linux else log2(O_EXEC),
// Reading and writing.
RDWR = log2(O_RDWR),
// Writing only.
@@ -177,7 +177,7 @@ when ODIN_OS == .Darwin {
O_DIRECTORY :: 0x00100000
O_EXCL :: 0x00000800
O_NOCTTY :: 0x00020000
O_NOFOLLOW :: 0x00000100
O_NOFOLLOW :: 0x00000100
O_TRUNC :: 0x00000400
_O_TTY_INIT :: 0
@@ -242,7 +242,7 @@ when ODIN_OS == .Darwin {
O_DIRECTORY :: 0x00020000
O_EXCL :: 0x0800
O_NOCTTY :: 0x8000
O_NOFOLLOW :: 0x0100
O_NOFOLLOW :: 0x0100
O_TRUNC :: 0x0400
_O_TTY_INIT :: 0x00080000
@@ -307,7 +307,7 @@ when ODIN_OS == .Darwin {
O_DIRECTORY :: 0x0020000
O_EXCL :: 0x0800
O_NOCTTY :: 0x8000
O_NOFOLLOW :: 0x0100
O_NOFOLLOW :: 0x0100
O_TRUNC :: 0x0400
_O_TTY_INIT :: 0
@@ -372,7 +372,7 @@ when ODIN_OS == .Darwin {
O_DIRECTORY :: 0x20000
O_EXCL :: 0x0800
O_NOCTTY :: 0x8000
O_NOFOLLOW :: 0x0100
O_NOFOLLOW :: 0x0100
O_TRUNC :: 0x0400
_O_TTY_INIT :: 0

View File

@@ -27,9 +27,9 @@ foreign lib {
nfds_t :: c.uint
Poll_Error :: enum c.int {
EAGAIN = Errno.EAGAIN,
EINTR = Errno.EINTR,
EINVAL = Errno.EINVAL,
EAGAIN = cast(c.int)Errno.EAGAIN,
EINTR = cast(c.int)Errno.EINTR,
EINVAL = cast(c.int)Errno.EINVAL,
}
Poll_Event_Bits :: enum c.short {

View File

@@ -94,7 +94,7 @@ when ODIN_OS == .Darwin {
SCHED_RR :: 3
SCHED_OTHER :: 2
} else when ODIN_OS == .NetBSD {
} else when ODIN_OS == .NetBSD || ODIN_OS == .Linux {
SCHED_OTHER :: 0
SCHED_FIFO :: 1

View File

@@ -55,7 +55,7 @@ when ODIN_OS == .NetBSD {
LSELECT :: "select"
}
when ODIN_OS == .Darwin || ODIN_OS == .FreeBSD || ODIN_OS == .NetBSD || ODIN_OS == .OpenBSD {
when ODIN_OS == .Darwin || ODIN_OS == .FreeBSD || ODIN_OS == .NetBSD || ODIN_OS == .OpenBSD || ODIN_OS == .Linux {
suseconds_t :: distinct (c.int32_t when ODIN_OS == .Darwin || ODIN_OS == .NetBSD else c.long)