sys_uio.odin 1.0 KB

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