]> Cypherpunks repositories - gostls13.git/commitdiff
syscall: add Chroot and Dup2 for aix/ppc64
authorClément Chigot <clement.chigot@atos.net>
Wed, 13 Mar 2019 13:14:12 +0000 (14:14 +0100)
committerTobias Klauser <tobias.klauser@gmail.com>
Wed, 13 Mar 2019 16:52:32 +0000 (16:52 +0000)
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>
src/syscall/syscall_aix.go
src/syscall/zsyscall_aix_ppc64.go

index 4947248e38dc2570b33929d5f10cd0225bdf1b5f..8039da735be6286a031f11b25de68c8efb4de3d5 100644 (file)
@@ -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)
index 7d01dc013c6c544c5436ed06a1bc642e63bdb91a..52398e60f11425b630ade9a41161c71ffc386443 100644 (file)
@@ -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 {