mirror of
https://github.com/golang/go
synced 2024-11-17 06:54:48 -07:00
syscall: wrap fstatat only once on linux/{arm64,riscv64}
Currently the linux/arm64 and linux/riscv64 ports wrap the fstatat syscall twice, once in func fstatat and once in func Fstatat. Change the latter to be a simple wrapper around the former to deduplicate some code. Change-Id: I82ec9374e2bcfe116eabf01f021eed1ee810ec15 Reviewed-on: https://go-review.googlesource.com/c/go/+/412934 Reviewed-by: Ian Lance Taylor <iant@google.com> Auto-Submit: Tobias Klauser <tobias.klauser@gmail.com> TryBot-Result: Gopher Robot <gobot@golang.org> Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com> Reviewed-by: Than McIntosh <thanm@google.com>
This commit is contained in:
parent
0f8dffd0aa
commit
dcf354512a
@ -18,8 +18,12 @@ func EpollCreate(size int) (fd int, err error) {
|
||||
//sys EpollWait(epfd int, events []EpollEvent, msec int) (n int, err error) = SYS_EPOLL_PWAIT
|
||||
//sys Fchown(fd int, uid int, gid int) (err error)
|
||||
//sys Fstat(fd int, stat *Stat_t) (err error)
|
||||
//sys Fstatat(fd int, path string, stat *Stat_t, flags int) (err error)
|
||||
//sys fstatat(dirfd int, path string, stat *Stat_t, flags int) (err error)
|
||||
|
||||
func Fstatat(fd int, path string, stat *Stat_t, flags int) error {
|
||||
return fstatat(fd, path, stat, flags)
|
||||
}
|
||||
|
||||
//sys Fstatfs(fd int, buf *Statfs_t) (err error)
|
||||
//sys Ftruncate(fd int, length int64) (err error)
|
||||
//sysnb Getegid() (egid int)
|
||||
@ -40,7 +44,7 @@ func EpollCreate(size int) (fd int, err error) {
|
||||
//sys Splice(rfd int, roff *int64, wfd int, woff *int64, len int, flags int) (n int64, err error)
|
||||
|
||||
func Stat(path string, stat *Stat_t) (err error) {
|
||||
return Fstatat(_AT_FDCWD, path, stat, 0)
|
||||
return fstatat(_AT_FDCWD, path, stat, 0)
|
||||
}
|
||||
|
||||
func Lchown(path string, uid int, gid int) (err error) {
|
||||
@ -48,7 +52,7 @@ func Lchown(path string, uid int, gid int) (err error) {
|
||||
}
|
||||
|
||||
func Lstat(path string, stat *Stat_t) (err error) {
|
||||
return Fstatat(_AT_FDCWD, path, stat, _AT_SYMLINK_NOFOLLOW)
|
||||
return fstatat(_AT_FDCWD, path, stat, _AT_SYMLINK_NOFOLLOW)
|
||||
}
|
||||
|
||||
//sys Statfs(path string, buf *Statfs_t) (err error)
|
||||
|
@ -18,8 +18,12 @@ func EpollCreate(size int) (fd int, err error) {
|
||||
//sys EpollWait(epfd int, events []EpollEvent, msec int) (n int, err error) = SYS_EPOLL_PWAIT
|
||||
//sys Fchown(fd int, uid int, gid int) (err error)
|
||||
//sys Fstat(fd int, stat *Stat_t) (err error)
|
||||
//sys Fstatat(fd int, path string, stat *Stat_t, flags int) (err error)
|
||||
//sys fstatat(dirfd int, path string, stat *Stat_t, flags int) (err error)
|
||||
|
||||
func Fstatat(fd int, path string, stat *Stat_t, flags int) error {
|
||||
return fstatat(fd, path, stat, flags)
|
||||
}
|
||||
|
||||
//sys Fstatfs(fd int, buf *Statfs_t) (err error)
|
||||
//sys Ftruncate(fd int, length int64) (err error)
|
||||
//sysnb Getegid() (egid int)
|
||||
@ -44,7 +48,7 @@ func Renameat(olddirfd int, oldpath string, newdirfd int, newpath string) (err e
|
||||
}
|
||||
|
||||
func Stat(path string, stat *Stat_t) (err error) {
|
||||
return Fstatat(_AT_FDCWD, path, stat, 0)
|
||||
return fstatat(_AT_FDCWD, path, stat, 0)
|
||||
}
|
||||
|
||||
func Lchown(path string, uid int, gid int) (err error) {
|
||||
@ -52,7 +56,7 @@ func Lchown(path string, uid int, gid int) (err error) {
|
||||
}
|
||||
|
||||
func Lstat(path string, stat *Stat_t) (err error) {
|
||||
return Fstatat(_AT_FDCWD, path, stat, _AT_SYMLINK_NOFOLLOW)
|
||||
return fstatat(_AT_FDCWD, path, stat, _AT_SYMLINK_NOFOLLOW)
|
||||
}
|
||||
|
||||
//sys Statfs(path string, buf *Statfs_t) (err error)
|
||||
|
@ -1094,21 +1094,6 @@ func Fstat(fd int, stat *Stat_t) (err error) {
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func Fstatat(fd int, path string, stat *Stat_t, flags int) (err error) {
|
||||
var _p0 *byte
|
||||
_p0, err = BytePtrFromString(path)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
_, _, e1 := Syscall6(SYS_FSTATAT, uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), uintptr(flags), 0, 0)
|
||||
if e1 != 0 {
|
||||
err = errnoErr(e1)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func fstatat(dirfd int, path string, stat *Stat_t, flags int) (err error) {
|
||||
var _p0 *byte
|
||||
_p0, err = BytePtrFromString(path)
|
||||
|
@ -1094,21 +1094,6 @@ func Fstat(fd int, stat *Stat_t) (err error) {
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func Fstatat(fd int, path string, stat *Stat_t, flags int) (err error) {
|
||||
var _p0 *byte
|
||||
_p0, err = BytePtrFromString(path)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
_, _, e1 := Syscall6(SYS_FSTATAT, uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), uintptr(flags), 0, 0)
|
||||
if e1 != 0 {
|
||||
err = errnoErr(e1)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func fstatat(dirfd int, path string, stat *Stat_t, flags int) (err error) {
|
||||
var _p0 *byte
|
||||
_p0, err = BytePtrFromString(path)
|
||||
|
Loading…
Reference in New Issue
Block a user