diff options
author | Dan Kegel <[email protected]> | 2022-05-12 08:48:44 -0700 |
---|---|---|
committer | Ron Evans <[email protected]> | 2022-05-20 18:47:30 +0200 |
commit | 4ed0936c0ec2b56af4f8f0cdce2ef16ef71eafe1 (patch) | |
tree | 8db08e1136ad60c72f04bd08da8a8fe040cf8a91 /src/syscall | |
parent | 7a5d4c95371b4bc8ddb1a8992129cb6f3b45e215 (diff) | |
download | tinygo-4ed0936c0ec2b56af4f8f0cdce2ef16ef71eafe1.tar.gz tinygo-4ed0936c0ec2b56af4f8f0cdce2ef16ef71eafe1.zip |
darwin: adjust syscall suffix for arm64
Diffstat (limited to 'src/syscall')
-rw-r--r-- | src/syscall/syscall_libc_darwin.go | 25 | ||||
-rw-r--r-- | src/syscall/syscall_libc_darwin_amd64.go | 34 | ||||
-rw-r--r-- | src/syscall/syscall_libc_darwin_arm64.go | 28 |
3 files changed, 62 insertions, 25 deletions
diff --git a/src/syscall/syscall_libc_darwin.go b/src/syscall/syscall_libc_darwin.go index 80acebfc2..0342add2e 100644 --- a/src/syscall/syscall_libc_darwin.go +++ b/src/syscall/syscall_libc_darwin.go @@ -267,31 +267,6 @@ func readdir_r(dir uintptr, entry *Dirent, result **Dirent) (err error) { return } -// The odd $INODE64 suffix is an Apple compatibility feature, see -// https://assert.cc/posts/darwin_use_64_bit_inode_vs_ctypes/ -// and https://github.com/golang/go/issues/35269 -// Without it, you get the old, smaller struct stat from mac os 10.2 or so. - -// struct DIR * buf fdopendir(int fd); -//export fdopendir$INODE64 -func libc_fdopendir(fd int32) unsafe.Pointer - -// int readdir_r(struct DIR * buf, struct dirent *entry, struct dirent **result); -//export readdir_r$INODE64 -func libc_readdir_r(unsafe.Pointer, unsafe.Pointer, unsafe.Pointer) int32 - -// int stat(const char *path, struct stat * buf); -//export stat$INODE64 -func libc_stat(pathname *byte, ptr unsafe.Pointer) int32 - -// int fstat(int fd, struct stat * buf); -//export fstat$INODE64 -func libc_fstat(fd int32, ptr unsafe.Pointer) int32 - -// int lstat(const char *path, struct stat * buf); -//export lstat$INODE64 -func libc_lstat(pathname *byte, ptr unsafe.Pointer) int32 - // int pipe(int32 *fds); //export pipe func libc_pipe(fds *int32) int32 diff --git a/src/syscall/syscall_libc_darwin_amd64.go b/src/syscall/syscall_libc_darwin_amd64.go new file mode 100644 index 000000000..81e06efdd --- /dev/null +++ b/src/syscall/syscall_libc_darwin_amd64.go @@ -0,0 +1,34 @@ +//go:build darwin +// +build darwin + +package syscall + +import ( + "unsafe" +) + +// The odd $INODE64 suffix is an Apple compatibility feature, see +// __DARWIN_INODE64 in /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/sys/cdefs.h +// and https://assert.cc/posts/darwin_use_64_bit_inode_vs_ctypes/ +// Without it, you get the old, smaller struct stat from mac os 10.2 or so. +// It not needed on arm64. + +// struct DIR * buf fdopendir(int fd); +//export fdopendir$INODE64 +func libc_fdopendir(fd int32) unsafe.Pointer + +// int readdir_r(struct DIR * buf, struct dirent *entry, struct dirent **result); +//export readdir_r$INODE64 +func libc_readdir_r(unsafe.Pointer, unsafe.Pointer, unsafe.Pointer) int32 + +// int stat(const char *path, struct stat * buf); +//export stat$INODE64 +func libc_stat(pathname *byte, ptr unsafe.Pointer) int32 + +// int fstat(int fd, struct stat * buf); +//export fstat$INODE64 +func libc_fstat(fd int32, ptr unsafe.Pointer) int32 + +// int lstat(const char *path, struct stat * buf); +//export lstat$INODE64 +func libc_lstat(pathname *byte, ptr unsafe.Pointer) int32 diff --git a/src/syscall/syscall_libc_darwin_arm64.go b/src/syscall/syscall_libc_darwin_arm64.go new file mode 100644 index 000000000..74075000b --- /dev/null +++ b/src/syscall/syscall_libc_darwin_arm64.go @@ -0,0 +1,28 @@ +//go:build darwin +// +build darwin + +package syscall + +import ( + "unsafe" +) + +// struct DIR * buf fdopendir(int fd); +//export fdopendir +func libc_fdopendir(fd int32) unsafe.Pointer + +// int readdir_r(struct DIR * buf, struct dirent *entry, struct dirent **result); +//export readdir_r +func libc_readdir_r(unsafe.Pointer, unsafe.Pointer, unsafe.Pointer) int32 + +// int stat(const char *path, struct stat * buf); +//export stat +func libc_stat(pathname *byte, ptr unsafe.Pointer) int32 + +// int fstat(int fd, struct stat * buf); +//export fstat +func libc_fstat(fd int32, ptr unsafe.Pointer) int32 + +// int lstat(const char *path, struct stat * buf); +//export lstat +func libc_lstat(pathname *byte, ptr unsafe.Pointer) int32 |