file_posix_netbsd.odin 405 B

123456789101112131415161718
  1. //+private
  2. package os2
  3. import "base:runtime"
  4. import "core:sys/posix"
  5. _posix_absolute_path :: proc(fd: posix.FD, name: string, allocator: runtime.Allocator) -> (path: cstring, err: Error) {
  6. F_GETPATH :: 15
  7. buf: [posix.PATH_MAX]byte
  8. if posix.fcntl(fd, posix.FCNTL_Cmd(F_GETPATH), &buf) != 0 {
  9. err = _get_platform_error()
  10. return
  11. }
  12. return clone_to_cstring(string(cstring(&buf[0])), allocator)
  13. }