sys_uio.odin 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. #+build linux, darwin, netbsd, openbsd, freebsd
  2. package posix
  3. import "core:c"
  4. when ODIN_OS == .Darwin {
  5. foreign import libc "system:System.framework"
  6. } else {
  7. foreign import libc "system:c"
  8. }
  9. // sys/uio.h - definitions for vector I/O operations
  10. foreign libc {
  11. /*
  12. Equivalent to read() but takes a vector of inputs.
  13. iovcnt can be 0..=IOV_MAX in length.
  14. [[ More; https://pubs.opengroup.org/onlinepubs/9699919799/functions/readv.html ]]
  15. */
  16. readv :: proc(fildes: FD, iov: [^]iovec, iovcnt: c.int) -> c.ssize_t ---
  17. /*
  18. Equivalent to write() but takes a vector of inputs.
  19. iovcnt can be 0..=IOV_MAX in length.
  20. [[ More; https://pubs.opengroup.org/onlinepubs/9699919799/functions/readv.html ]]
  21. */
  22. writev :: proc(fildes: FD, iov: [^]iovec, iovcnt: c.int) -> c.ssize_t ---
  23. }
  24. when ODIN_OS == .Darwin || ODIN_OS == .FreeBSD || ODIN_OS == .NetBSD || ODIN_OS == .OpenBSD || ODIN_OS == .Linux {
  25. iovec :: struct {
  26. iov_base: rawptr, /* [PSX] base address of I/O memory region */
  27. iov_len: c.size_t, /* [PSX] size of the region iov_base points to */
  28. }
  29. }