Temporarily added partial posix libraris from Odin because posix support for Linux isn't done in Odin yet

This commit is contained in:
Zachary
2024-10-27 20:23:14 -07:00
parent dad9772659
commit 5400ef419a
4 changed files with 211 additions and 28 deletions

35
posix/sys_select.odin Normal file
View File

@ -0,0 +1,35 @@
package posix
import "base:intrinsics"
import "core:c"
import "core:c/libc"
when ODIN_OS == .Darwin {
foreign import lib "system:System.framework"
} else {
foreign import lib "system:c"
}
// sys/select.h - select types
when ODIN_OS == .NetBSD {
LPSELECT :: "__pselect50"
LSELECT :: "__select50"
} else {
LPSELECT :: "pselect"
LSELECT :: "select"
}
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)
timeval :: struct {
tv_sec: libc.time_t, /* [PSX] seconds */
tv_usec: suseconds_t, /* [PSX] microseconds */
}
} else {
#panic("posix is unimplemented for the current target")
}