os_specific_darwin.odin 331 B

123456789101112131415
  1. //+build darwin
  2. //+private
  3. package runtime
  4. import "base:intrinsics"
  5. _stderr_write :: proc "contextless" (data: []byte) -> (int, _OS_Errno) {
  6. WRITE :: 0x2000004
  7. STDERR :: 2
  8. ret := intrinsics.syscall(WRITE, STDERR, uintptr(raw_data(data)), uintptr(len(data)))
  9. if ret < 0 {
  10. return 0, _OS_Errno(-ret)
  11. }
  12. return int(ret), 0
  13. }