aboutsummaryrefslogtreecommitdiff
path: root/src/syscall
diff options
context:
space:
mode:
authorClément Chigot <clement.chigot@atos.net>2019-03-13 14:14:12 +0100
committerTobias Klauser <tobias.klauser@gmail.com>2019-03-13 16:52:32 +0000
commit82bd93991a84042f4d960f0338cbff4792867857 (patch)
tree961b6c8d62aa1646826055eabd5333f3c0c53b07 /src/syscall
parent04f1b65cc6ffbaa3693bbcb57ae26fb59466531b (diff)
downloadgo-82bd93991a84042f4d960f0338cbff4792867857.tar.xz
syscall: add Chroot and Dup2 for aix/ppc64
Change-Id: Ib98c7ad91d83ce68811f5c671200462c5fee0fca Reviewed-on: https://go-review.googlesource.com/c/go/+/167398 Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
Diffstat (limited to 'src/syscall')
-rw-r--r--src/syscall/syscall_aix.go3
-rw-r--r--src/syscall/zsyscall_aix_ppc64.go28
2 files changed, 25 insertions, 6 deletions
diff --git a/src/syscall/syscall_aix.go b/src/syscall/syscall_aix.go
index 4947248e38..8039da735b 100644
--- a/src/syscall/syscall_aix.go
+++ b/src/syscall/syscall_aix.go
@@ -46,7 +46,7 @@ func (ts *StTimespec_t) Nano() int64 {
// But, as fcntl is currently not exported and isn't called with F_DUP2FD,
// it doesn't matter.
//sys fcntl(fd int, cmd int, arg int) (val int, err error)
-//sys dup2(old int, new int) (val int, err error)
+//sys Dup2(old int, new int) (val int, err error)
//sysnb pipe(p *[2]_C_int) (err error)
func Pipe(p []int) (err error) {
@@ -567,6 +567,7 @@ func PtraceDetach(pid int) (err error) { return ptrace64(PT_DETACH, int64(pid),
//sys Chdir(path string) (err error)
//sys Chmod(path string, mode uint32) (err error)
//sys Chown(path string, uid int, gid int) (err error)
+//sys Chroot(path string) (err error)
//sys Close(fd int) (err error)
//sys Dup(fd int) (nfd int, err error)
//sys Faccessat(dirfd int, path string, mode uint32, flags int) (err error)
diff --git a/src/syscall/zsyscall_aix_ppc64.go b/src/syscall/zsyscall_aix_ppc64.go
index 7d01dc013c..52398e60f1 100644
--- a/src/syscall/zsyscall_aix_ppc64.go
+++ b/src/syscall/zsyscall_aix_ppc64.go
@@ -8,7 +8,7 @@ package syscall
import "unsafe"
//go:cgo_import_dynamic libc_fcntl fcntl "libc.a/shr_64.o"
-//go:cgo_import_dynamic libc_dup2 dup2 "libc.a/shr_64.o"
+//go:cgo_import_dynamic libc_Dup2 dup2 "libc.a/shr_64.o"
//go:cgo_import_dynamic libc_pipe pipe "libc.a/shr_64.o"
//go:cgo_import_dynamic libc_readlink readlink "libc.a/shr_64.o"
//go:cgo_import_dynamic libc_utimes utimes "libc.a/shr_64.o"
@@ -41,6 +41,7 @@ import "unsafe"
//go:cgo_import_dynamic libc_Chdir chdir "libc.a/shr_64.o"
//go:cgo_import_dynamic libc_Chmod chmod "libc.a/shr_64.o"
//go:cgo_import_dynamic libc_Chown chown "libc.a/shr_64.o"
+//go:cgo_import_dynamic libc_Chroot chroot "libc.a/shr_64.o"
//go:cgo_import_dynamic libc_Close close "libc.a/shr_64.o"
//go:cgo_import_dynamic libc_Dup dup "libc.a/shr_64.o"
//go:cgo_import_dynamic libc_Faccessat faccessat "libc.a/shr_64.o"
@@ -97,7 +98,7 @@ import "unsafe"
//go:cgo_import_dynamic libc_munmap munmap "libc.a/shr_64.o"
//go:linkname libc_fcntl libc_fcntl
-//go:linkname libc_dup2 libc_dup2
+//go:linkname libc_Dup2 libc_Dup2
//go:linkname libc_pipe libc_pipe
//go:linkname libc_readlink libc_readlink
//go:linkname libc_utimes libc_utimes
@@ -130,6 +131,7 @@ import "unsafe"
//go:linkname libc_Chdir libc_Chdir
//go:linkname libc_Chmod libc_Chmod
//go:linkname libc_Chown libc_Chown
+//go:linkname libc_Chroot libc_Chroot
//go:linkname libc_Close libc_Close
//go:linkname libc_Dup libc_Dup
//go:linkname libc_Faccessat libc_Faccessat
@@ -189,7 +191,7 @@ type libcFunc uintptr
var (
libc_fcntl,
- libc_dup2,
+ libc_Dup2,
libc_pipe,
libc_readlink,
libc_utimes,
@@ -222,6 +224,7 @@ var (
libc_Chdir,
libc_Chmod,
libc_Chown,
+ libc_Chroot,
libc_Close,
libc_Dup,
libc_Faccessat,
@@ -291,8 +294,8 @@ func fcntl(fd int, cmd int, arg int) (val int, err error) {
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
-func dup2(old int, new int) (val int, err error) {
- r0, _, e1 := syscall6(uintptr(unsafe.Pointer(&libc_dup2)), 2, uintptr(old), uintptr(new), 0, 0, 0, 0)
+func Dup2(old int, new int) (val int, err error) {
+ r0, _, e1 := syscall6(uintptr(unsafe.Pointer(&libc_Dup2)), 2, uintptr(old), uintptr(new), 0, 0, 0, 0)
val = int(r0)
if e1 != 0 {
err = errnoErr(e1)
@@ -694,6 +697,21 @@ func Chown(path string, uid int, gid int) (err error) {
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
+func Chroot(path string) (err error) {
+ var _p0 *byte
+ _p0, err = BytePtrFromString(path)
+ if err != nil {
+ return
+ }
+ _, _, e1 := syscall6(uintptr(unsafe.Pointer(&libc_Chroot)), 1, uintptr(unsafe.Pointer(_p0)), 0, 0, 0, 0, 0)
+ if e1 != 0 {
+ err = errnoErr(e1)
+ }
+ return
+}
+
+// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
+
func Close(fd int) (err error) {
_, _, e1 := syscall6(uintptr(unsafe.Pointer(&libc_Close)), 1, uintptr(fd), 0, 0, 0, 0, 0)
if e1 != 0 {