36 lines
765 B
Odin
36 lines
765 B
Odin
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")
|
|
}
|