tinygo/src/syscall/syscall_darwin.go
Ayke van Laethem 6bcb40fe01 os: implement virtual filesystem support
This allows applications to mount filesystems in the os package. This is
useful for mounting external flash filesystems, for example.
2020-05-13 08:08:57 +02:00

56 строки
1,2 КиБ
Go

package syscall
// This file defines errno and constants to match the darwin libsystem ABI.
// Values have been copied from src/syscall/zerrors_darwin_amd64.go.
// This function returns the error location in the darwin ABI.
// Discovered by compiling the following code using Clang:
//
// #include <errno.h>
// int getErrno() {
// return errno;
// }
//
//export __error
func libc___error() *int32
// getErrno returns the current C errno. It may not have been caused by the last
// call, so it should only be relied upon when the last call indicates an error
// (for example, by returning -1).
func getErrno() Errno {
errptr := libc___error()
return Errno(uintptr(*errptr))
}
const (
ENOENT Errno = 0x2
EEXIST Errno = 0x11
EINTR Errno = 0x4
EMFILE Errno = 0x18
EAGAIN Errno = 0x23
ETIMEDOUT Errno = 0x3c
ENOSYS Errno = 0x4e
EWOULDBLOCK Errno = EAGAIN
)
type Signal int
const (
SIGCHLD Signal = 0x14
SIGINT Signal = 0x2
SIGKILL Signal = 0x9
SIGTRAP Signal = 0x5
SIGQUIT Signal = 0x3
SIGTERM Signal = 0xf
)
const (
O_RDONLY = 0x0
O_WRONLY = 0x1
O_RDWR = 0x2
O_APPEND = 0x8
O_SYNC = 0x80
O_CREAT = 0x200
O_TRUNC = 0x400
O_EXCL = 0x800
)