spawn.odin 776 B

123456789101112131415161718192021
  1. #+build linux, darwin, openbsd, freebsd, netbsd, haiku
  2. package posix
  3. when ODIN_OS == .Darwin {
  4. foreign import lib "system:System.framework"
  5. } else {
  6. foreign import lib "system:c"
  7. }
  8. foreign lib {
  9. /*
  10. Creates a child process from a provided filepath
  11. spawnp searches directories on the path for the file
  12. Returns: 0 on success, with the child pid returned in the pid argument, or error values on failure.
  13. [[ More; https://pubs.opengroup.org/onlinepubs/9699919799/functions/posix_spawn.html ]]
  14. */
  15. posix_spawn :: proc(pid: ^pid_t, path: cstring, file_actions: rawptr, attrp: rawptr, argv: [^]cstring, envp: [^]cstring) -> Errno ---
  16. posix_spawnp :: proc(pid: ^pid_t, file: cstring, file_actions: rawptr, attrp: rawptr, argv: [^]cstring, envp: [^]cstring) -> Errno ---
  17. }