Skip to content

Commit 4ed0936

Browse files
dkegel-fastlydeadprogram
authored andcommitted
darwin: adjust syscall suffix for arm64
1 parent 7a5d4c9 commit 4ed0936

File tree

3 files changed

+62
-25
lines changed

3 files changed

+62
-25
lines changed

src/syscall/syscall_libc_darwin.go

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -267,31 +267,6 @@ func readdir_r(dir uintptr, entry *Dirent, result **Dirent) (err error) {
267267
return
268268
}
269269

270-
// The odd $INODE64 suffix is an Apple compatibility feature, see
271-
// https://assert.cc/posts/darwin_use_64_bit_inode_vs_ctypes/
272-
// and https://github.com/golang/go/issues/35269
273-
// Without it, you get the old, smaller struct stat from mac os 10.2 or so.
274-
275-
// struct DIR * buf fdopendir(int fd);
276-
//export fdopendir$INODE64
277-
func libc_fdopendir(fd int32) unsafe.Pointer
278-
279-
// int readdir_r(struct DIR * buf, struct dirent *entry, struct dirent **result);
280-
//export readdir_r$INODE64
281-
func libc_readdir_r(unsafe.Pointer, unsafe.Pointer, unsafe.Pointer) int32
282-
283-
// int stat(const char *path, struct stat * buf);
284-
//export stat$INODE64
285-
func libc_stat(pathname *byte, ptr unsafe.Pointer) int32
286-
287-
// int fstat(int fd, struct stat * buf);
288-
//export fstat$INODE64
289-
func libc_fstat(fd int32, ptr unsafe.Pointer) int32
290-
291-
// int lstat(const char *path, struct stat * buf);
292-
//export lstat$INODE64
293-
func libc_lstat(pathname *byte, ptr unsafe.Pointer) int32
294-
295270
// int pipe(int32 *fds);
296271
//export pipe
297272
func libc_pipe(fds *int32) int32
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
//go:build darwin
2+
// +build darwin
3+
4+
package syscall
5+
6+
import (
7+
"unsafe"
8+
)
9+
10+
// The odd $INODE64 suffix is an Apple compatibility feature, see
11+
// __DARWIN_INODE64 in /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/sys/cdefs.h
12+
// and https://assert.cc/posts/darwin_use_64_bit_inode_vs_ctypes/
13+
// Without it, you get the old, smaller struct stat from mac os 10.2 or so.
14+
// It not needed on arm64.
15+
16+
// struct DIR * buf fdopendir(int fd);
17+
//export fdopendir$INODE64
18+
func libc_fdopendir(fd int32) unsafe.Pointer
19+
20+
// int readdir_r(struct DIR * buf, struct dirent *entry, struct dirent **result);
21+
//export readdir_r$INODE64
22+
func libc_readdir_r(unsafe.Pointer, unsafe.Pointer, unsafe.Pointer) int32
23+
24+
// int stat(const char *path, struct stat * buf);
25+
//export stat$INODE64
26+
func libc_stat(pathname *byte, ptr unsafe.Pointer) int32
27+
28+
// int fstat(int fd, struct stat * buf);
29+
//export fstat$INODE64
30+
func libc_fstat(fd int32, ptr unsafe.Pointer) int32
31+
32+
// int lstat(const char *path, struct stat * buf);
33+
//export lstat$INODE64
34+
func libc_lstat(pathname *byte, ptr unsafe.Pointer) int32
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
//go:build darwin
2+
// +build darwin
3+
4+
package syscall
5+
6+
import (
7+
"unsafe"
8+
)
9+
10+
// struct DIR * buf fdopendir(int fd);
11+
//export fdopendir
12+
func libc_fdopendir(fd int32) unsafe.Pointer
13+
14+
// int readdir_r(struct DIR * buf, struct dirent *entry, struct dirent **result);
15+
//export readdir_r
16+
func libc_readdir_r(unsafe.Pointer, unsafe.Pointer, unsafe.Pointer) int32
17+
18+
// int stat(const char *path, struct stat * buf);
19+
//export stat
20+
func libc_stat(pathname *byte, ptr unsafe.Pointer) int32
21+
22+
// int fstat(int fd, struct stat * buf);
23+
//export fstat
24+
func libc_fstat(fd int32, ptr unsafe.Pointer) int32
25+
26+
// int lstat(const char *path, struct stat * buf);
27+
//export lstat
28+
func libc_lstat(pathname *byte, ptr unsafe.Pointer) int32

0 commit comments

Comments
 (0)