aboutsummaryrefslogtreecommitdiff
path: root/core/sys/posix/sys_uio.odin
blob: b4411851bb92d4775dcaa9edc6e9a63e6f425c20 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#+build linux, darwin, netbsd, openbsd, freebsd, haiku
package posix

import "core:c"

when ODIN_OS == .Darwin {
	foreign import libc "system:System"
} 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 || ODIN_OS == .Linux || ODIN_OS == .Haiku {

	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 */
	}

}