Temporarily added partial posix libraris from Odin because posix support for Linux isn't done in Odin yet
This commit is contained in:
35
posix/sys_select.odin
Normal file
35
posix/sys_select.odin
Normal 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")
|
||||
}
|
Reference in New Issue
Block a user