mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-06 15:48:51 +00:00
posix: add package
This commit is contained in:
@@ -0,0 +1,42 @@
|
||||
package posix
|
||||
|
||||
import "core:c"
|
||||
|
||||
when ODIN_OS == .Darwin {
|
||||
foreign import libc "system:System.framework"
|
||||
} else {
|
||||
foreign import libc "system:c"
|
||||
}
|
||||
|
||||
// sys/uio.h - definitions for vector I/O operations
|
||||
|
||||
foreign libc {
|
||||
/*
|
||||
Equivalent to read() but takes a vector of inputs.
|
||||
|
||||
iovcnt can be 0..=IOV_MAX in length.
|
||||
|
||||
[[ More; https://pubs.opengroup.org/onlinepubs/9699919799/functions/readv.html ]]
|
||||
*/
|
||||
readv :: proc(fildes: FD, iov: [^]iovec, iovcnt: c.int) -> c.ssize_t ---
|
||||
|
||||
/*
|
||||
Equivalent to write() but takes a vector of inputs.
|
||||
|
||||
iovcnt can be 0..=IOV_MAX in length.
|
||||
|
||||
[[ More; https://pubs.opengroup.org/onlinepubs/9699919799/functions/readv.html ]]
|
||||
*/
|
||||
writev :: proc(fildes: FD, iov: [^]iovec, iovcnt: c.int) -> c.ssize_t ---
|
||||
}
|
||||
|
||||
when ODIN_OS == .Darwin || ODIN_OS == .FreeBSD || ODIN_OS == .NetBSD || ODIN_OS == .OpenBSD {
|
||||
|
||||
iovec :: struct {
|
||||
iov_base: rawptr, /* [PSX] base address of I/O memory region */
|
||||
iov_len: c.size_t, /* [PSX] size of the region iov_base points to */
|
||||
}
|
||||
|
||||
} else {
|
||||
#panic("posix is unimplemented for the current target")
|
||||
}
|
||||
Reference in New Issue
Block a user