Skip to content

Commit 4dcd0b7

Browse files
committed
unix: remove raw syscall from Getfsstat
Use libc version instead. Update golang/go#17490 Change-Id: Ibcedccb9715961904d12fc85f69a7139b6c26658 Reviewed-on: https://go-review.googlesource.com/c/154660 Reviewed-by: Ian Lance Taylor <[email protected]>
1 parent 54d2441 commit 4dcd0b7

18 files changed

+118
-6
lines changed

unix/darwin_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,4 +206,5 @@ var darwinTests = [...]darwinTest{
206206
{"mmap", libc_mmap_trampoline},
207207
{"munmap", libc_munmap_trampoline},
208208
{"gettimeofday", libc_gettimeofday_trampoline},
209+
{"getfsstat64", libc_getfsstat64_trampoline},
209210
}

unix/syscall_darwin.go

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -168,12 +168,7 @@ func Getfsstat(buf []Statfs_t, flags int) (n int, err error) {
168168
_p0 = unsafe.Pointer(&buf[0])
169169
bufsize = unsafe.Sizeof(Statfs_t{}) * uintptr(len(buf))
170170
}
171-
r0, _, e1 := Syscall(SYS_GETFSSTAT64, uintptr(_p0), bufsize, uintptr(flags))
172-
n = int(r0)
173-
if e1 != 0 {
174-
err = e1
175-
}
176-
return
171+
return getfsstat(_p0, bufsize, flags)
177172
}
178173

179174
func xattrPointer(dest []byte) *byte {

unix/syscall_darwin_386.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ const SYS___SYSCTL = SYS_SYSCTL
7171
//sys Fstatat(fd int, path string, stat *Stat_t, flags int) (err error) = SYS_FSTATAT64
7272
//sys Fstatfs(fd int, stat *Statfs_t) (err error) = SYS_FSTATFS64
7373
//sys Getdirentries(fd int, buf []byte, basep *uintptr) (n int, err error) = SYS_GETDIRENTRIES64
74+
//sys getfsstat(buf unsafe.Pointer, size uintptr, flags int) (n int, err error) = SYS_GETFSSTAT64
7475
//sys Lstat(path string, stat *Stat_t) (err error) = SYS_LSTAT64
7576
//sys Stat(path string, stat *Stat_t) (err error) = SYS_STAT64
7677
//sys Statfs(path string, stat *Statfs_t) (err error) = SYS_STATFS64

unix/syscall_darwin_amd64.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ const SYS___SYSCTL = SYS_SYSCTL
7171
//sys Fstatat(fd int, path string, stat *Stat_t, flags int) (err error) = SYS_FSTATAT64
7272
//sys Fstatfs(fd int, stat *Statfs_t) (err error) = SYS_FSTATFS64
7373
//sys Getdirentries(fd int, buf []byte, basep *uintptr) (n int, err error) = SYS_GETDIRENTRIES64
74+
//sys getfsstat(buf unsafe.Pointer, size uintptr, flags int) (n int, err error) = SYS_GETFSSTAT64
7475
//sys Lstat(path string, stat *Stat_t) (err error) = SYS_LSTAT64
7576
//sys Stat(path string, stat *Stat_t) (err error) = SYS_STAT64
7677
//sys Statfs(path string, stat *Statfs_t) (err error) = SYS_STATFS64

unix/syscall_darwin_arm.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ const SYS___SYSCTL = SYS_SYSCTL
6868
//sys Fstat(fd int, stat *Stat_t) (err error)
6969
//sys Fstatat(fd int, path string, stat *Stat_t, flags int) (err error)
7070
//sys Fstatfs(fd int, stat *Statfs_t) (err error)
71+
//sys getfsstat(buf unsafe.Pointer, size uintptr, flags int) (n int, err error) = SYS_GETFSSTAT
7172
//sys Lstat(path string, stat *Stat_t) (err error)
7273
//sys Stat(path string, stat *Stat_t) (err error)
7374
//sys Statfs(path string, stat *Statfs_t) (err error)

unix/syscall_darwin_arm64.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ const SYS___SYSCTL = SYS_SYSCTL
7070
//sys Fstat(fd int, stat *Stat_t) (err error)
7171
//sys Fstatat(fd int, path string, stat *Stat_t, flags int) (err error)
7272
//sys Fstatfs(fd int, stat *Statfs_t) (err error)
73+
//sys getfsstat(buf unsafe.Pointer, size uintptr, flags int) (n int, err error) = SYS_GETFSSTAT
7374
//sys Lstat(path string, stat *Stat_t) (err error)
7475
//sys Stat(path string, stat *Stat_t) (err error)
7576
//sys Statfs(path string, stat *Statfs_t) (err error)

unix/zsyscall_darwin_386.1_12.go

Lines changed: 15 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

unix/zsyscall_darwin_386.go

Lines changed: 11 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

unix/zsyscall_darwin_386.s

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -268,6 +268,8 @@ TEXT ·libc_fstatfs64_trampoline(SB),NOSPLIT,$0-0
268268
JMP libc_fstatfs64(SB)
269269
TEXT ·libc___getdirentries64_trampoline(SB),NOSPLIT,$0-0
270270
JMP libc___getdirentries64(SB)
271+
TEXT ·libc_getfsstat64_trampoline(SB),NOSPLIT,$0-0
272+
JMP libc_getfsstat64(SB)
271273
TEXT ·libc_lstat64_trampoline(SB),NOSPLIT,$0-0
272274
JMP libc_lstat64(SB)
273275
TEXT ·libc_stat64_trampoline(SB),NOSPLIT,$0-0

unix/zsyscall_darwin_amd64.1_12.go

Lines changed: 15 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

unix/zsyscall_darwin_amd64.go

Lines changed: 11 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

unix/zsyscall_darwin_amd64.s

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -268,6 +268,8 @@ TEXT ·libc_fstatfs64_trampoline(SB),NOSPLIT,$0-0
268268
JMP libc_fstatfs64(SB)
269269
TEXT ·libc___getdirentries64_trampoline(SB),NOSPLIT,$0-0
270270
JMP libc___getdirentries64(SB)
271+
TEXT ·libc_getfsstat64_trampoline(SB),NOSPLIT,$0-0
272+
JMP libc_getfsstat64(SB)
271273
TEXT ·libc_lstat64_trampoline(SB),NOSPLIT,$0-0
272274
JMP libc_lstat64(SB)
273275
TEXT ·libc_stat64_trampoline(SB),NOSPLIT,$0-0

unix/zsyscall_darwin_arm.1_12.go

Lines changed: 15 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

unix/zsyscall_darwin_arm.go

Lines changed: 11 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

unix/zsyscall_darwin_arm.s

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -266,6 +266,8 @@ TEXT ·libc_fstatat_trampoline(SB),NOSPLIT,$0-0
266266
JMP libc_fstatat(SB)
267267
TEXT ·libc_fstatfs_trampoline(SB),NOSPLIT,$0-0
268268
JMP libc_fstatfs(SB)
269+
TEXT ·libc_getfsstat_trampoline(SB),NOSPLIT,$0-0
270+
JMP libc_getfsstat(SB)
269271
TEXT ·libc_lstat_trampoline(SB),NOSPLIT,$0-0
270272
JMP libc_lstat(SB)
271273
TEXT ·libc_stat_trampoline(SB),NOSPLIT,$0-0

unix/zsyscall_darwin_arm64.1_12.go

Lines changed: 15 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

unix/zsyscall_darwin_arm64.go

Lines changed: 11 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

unix/zsyscall_darwin_arm64.s

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -266,6 +266,8 @@ TEXT ·libc_fstatat_trampoline(SB),NOSPLIT,$0-0
266266
JMP libc_fstatat(SB)
267267
TEXT ·libc_fstatfs_trampoline(SB),NOSPLIT,$0-0
268268
JMP libc_fstatfs(SB)
269+
TEXT ·libc_getfsstat_trampoline(SB),NOSPLIT,$0-0
270+
JMP libc_getfsstat(SB)
269271
TEXT ·libc_lstat_trampoline(SB),NOSPLIT,$0-0
270272
JMP libc_lstat(SB)
271273
TEXT ·libc_stat_trampoline(SB),NOSPLIT,$0-0

0 commit comments

Comments
 (0)