github.com/aykevl/tinygo@v0.5.0/src/syscall/syscall_darwin.go (about) 1 package syscall 2 3 // This file defines errno and constants to match the darwin libsystem ABI. 4 // Values have been determined experimentally by compiling some C code on macOS 5 // with Clang and looking at the resulting LLVM IR. 6 7 // This function returns the error location in the darwin ABI. 8 // Discovered by compiling the following code using Clang: 9 // 10 // #include <errno.h> 11 // int getErrno() { 12 // return errno; 13 // } 14 // 15 //go:export __error 16 func libc___error() *int32 17 18 // getErrno returns the current C errno. It may not have been caused by the last 19 // call, so it should only be relied upon when the last call indicates an error 20 // (for example, by returning -1). 21 func getErrno() Errno { 22 errptr := libc___error() 23 return Errno(uintptr(*errptr)) 24 } 25 26 const ( 27 ENOENT Errno = 2 28 EINTR Errno = 4 29 EMFILE Errno = 24 30 EAGAIN Errno = 35 31 ETIMEDOUT Errno = 60 32 ENOSYS Errno = 78 33 EWOULDBLOCK Errno = EAGAIN 34 ) 35 36 type Signal int 37 38 const ( 39 SIGCHLD Signal = 20 40 SIGINT Signal = 2 41 SIGKILL Signal = 9 42 SIGTRAP Signal = 5 43 SIGQUIT Signal = 3 44 SIGTERM Signal = 15 45 ) 46 47 const ( 48 O_RDONLY = 0 49 O_WRONLY = 1 50 O_RDWR = 2 51 )