Commit 591c159d authored by Tobias Klauser's avatar Tobias Klauser Committed by Tobias Klauser

unix: add Fstatat on Solaris

Updates golang/go#24381

Change-Id: I9bd15bb7961f02af12a45b12ac62e07d059c744e
Reviewed-on: https://go-review.googlesource.com/100555
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: 's avatarIan Lance Taylor <iant@golang.org>
parent 8c0ece68
...@@ -595,9 +595,10 @@ func Poll(fds []PollFd, timeout int) (n int, err error) { ...@@ -595,9 +595,10 @@ func Poll(fds []PollFd, timeout int) (n int, err error) {
//sys Fchown(fd int, uid int, gid int) (err error) //sys Fchown(fd int, uid int, gid int) (err error)
//sys Fchownat(dirfd int, path string, uid int, gid int, flags int) (err error) //sys Fchownat(dirfd int, path string, uid int, gid int, flags int) (err error)
//sys Fdatasync(fd int) (err error) //sys Fdatasync(fd int) (err error)
//sys Flock(fd int, how int) (err error) //sys Flock(fd int, how int) (err error)
//sys Fpathconf(fd int, name int) (val int, err error) //sys Fpathconf(fd int, name int) (val int, err error)
//sys Fstat(fd int, stat *Stat_t) (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 Fstatvfs(fd int, vfsstat *Statvfs_t) (err error) //sys Fstatvfs(fd int, vfsstat *Statvfs_t) (err error)
//sys Getdents(fd int, buf []byte, basep *uintptr) (n int, err error) //sys Getdents(fd int, buf []byte, basep *uintptr) (n int, err error)
//sysnb Getgid() (gid int) //sysnb Getgid() (gid int)
......
...@@ -50,6 +50,7 @@ import ( ...@@ -50,6 +50,7 @@ import (
//go:cgo_import_dynamic libc_flock flock "libc.so" //go:cgo_import_dynamic libc_flock flock "libc.so"
//go:cgo_import_dynamic libc_fpathconf fpathconf "libc.so" //go:cgo_import_dynamic libc_fpathconf fpathconf "libc.so"
//go:cgo_import_dynamic libc_fstat fstat "libc.so" //go:cgo_import_dynamic libc_fstat fstat "libc.so"
//go:cgo_import_dynamic libc_fstatat fstatat "libc.so"
//go:cgo_import_dynamic libc_fstatvfs fstatvfs "libc.so" //go:cgo_import_dynamic libc_fstatvfs fstatvfs "libc.so"
//go:cgo_import_dynamic libc_getdents getdents "libc.so" //go:cgo_import_dynamic libc_getdents getdents "libc.so"
//go:cgo_import_dynamic libc_getgid getgid "libc.so" //go:cgo_import_dynamic libc_getgid getgid "libc.so"
...@@ -176,6 +177,7 @@ import ( ...@@ -176,6 +177,7 @@ import (
//go:linkname procFlock libc_flock //go:linkname procFlock libc_flock
//go:linkname procFpathconf libc_fpathconf //go:linkname procFpathconf libc_fpathconf
//go:linkname procFstat libc_fstat //go:linkname procFstat libc_fstat
//go:linkname procFstatat libc_fstatat
//go:linkname procFstatvfs libc_fstatvfs //go:linkname procFstatvfs libc_fstatvfs
//go:linkname procGetdents libc_getdents //go:linkname procGetdents libc_getdents
//go:linkname procGetgid libc_getgid //go:linkname procGetgid libc_getgid
...@@ -303,6 +305,7 @@ var ( ...@@ -303,6 +305,7 @@ var (
procFlock, procFlock,
procFpathconf, procFpathconf,
procFstat, procFstat,
procFstatat,
procFstatvfs, procFstatvfs,
procGetdents, procGetdents,
procGetgid, procGetgid,
...@@ -772,6 +775,19 @@ func Fstat(fd int, stat *Stat_t) (err error) { ...@@ -772,6 +775,19 @@ func Fstat(fd int, stat *Stat_t) (err error) {
return return
} }
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 := sysvicall6(uintptr(unsafe.Pointer(&procFstatat)), 4, uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), uintptr(flags), 0, 0)
if e1 != 0 {
err = e1
}
return
}
func Fstatvfs(fd int, vfsstat *Statvfs_t) (err error) { func Fstatvfs(fd int, vfsstat *Statvfs_t) (err error) {
_, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procFstatvfs)), 2, uintptr(fd), uintptr(unsafe.Pointer(vfsstat)), 0, 0, 0, 0) _, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procFstatvfs)), 2, uintptr(fd), uintptr(unsafe.Pointer(vfsstat)), 0, 0, 0, 0)
if e1 != 0 { if e1 != 0 {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment