aboutsummaryrefslogtreecommitdiff
path: root/src/syscall
diff options
context:
space:
mode:
authorClément Chigot <clement.chigot@atos.net>2018-10-25 11:32:35 +0200
committerBrad Fitzpatrick <bradfitz@golang.org>2018-10-25 16:03:56 +0000
commitf98ac8519257f8e4d2e886b84ccab628eeb61244 (patch)
treea8e77829814eec0681431f7f1003a483d387c1d7 /src/syscall
parentc8b2ac68906a154c470a845172f133aceae7c5c7 (diff)
downloadgo-f98ac8519257f8e4d2e886b84ccab628eeb61244.tar.xz
syscall: fix TestForeground for AIX
On AIX, sys.Pgid must be a int32 and not a int64 as on Solaris for ioctl syscall. Pid_t type can be used to provide the same code in both OS. But pid_t must be added to ztypes_solaris_amd64.go. Change-Id: I1dbe57f099f9e5ac9491aaf246a521137eea5014 Reviewed-on: https://go-review.googlesource.com/c/144539 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
Diffstat (limited to 'src/syscall')
-rw-r--r--src/syscall/exec_libc.go4
-rw-r--r--src/syscall/syscall_aix.go6
-rw-r--r--src/syscall/types_aix.go2
-rw-r--r--src/syscall/types_solaris.go2
-rw-r--r--src/syscall/zsyscall_aix_ppc64.go4
-rw-r--r--src/syscall/ztypes_aix_ppc64.go2
-rw-r--r--src/syscall/ztypes_solaris_amd64.go2
7 files changed, 13 insertions, 9 deletions
diff --git a/src/syscall/exec_libc.go b/src/syscall/exec_libc.go
index d6d34c04c3..0133139000 100644
--- a/src/syscall/exec_libc.go
+++ b/src/syscall/exec_libc.go
@@ -124,14 +124,14 @@ func forkAndExecInChild(argv0 *byte, argv, envv []*byte, chroot, dir *byte, attr
}
if sys.Foreground {
- pgrp := sys.Pgid
+ pgrp := _Pid_t(sys.Pgid)
if pgrp == 0 {
r1, err1 = getpid()
if err1 != 0 {
goto childerror
}
- pgrp = int(r1)
+ pgrp = _Pid_t(r1)
}
// Place process group in foreground.
diff --git a/src/syscall/syscall_aix.go b/src/syscall/syscall_aix.go
index bddc590c34..6512761c33 100644
--- a/src/syscall/syscall_aix.go
+++ b/src/syscall/syscall_aix.go
@@ -184,15 +184,15 @@ func ReadDirent(fd int, buf []byte) (n int, err error) {
return getdirent(fd, buf)
}
-//sys wait4(pid Pid_t, status *_C_int, options int, rusage *Rusage) (wpid Pid_t, err error)
+//sys wait4(pid _Pid_t, status *_C_int, options int, rusage *Rusage) (wpid _Pid_t, err error)
func Wait4(pid int, wstatus *WaitStatus, options int, rusage *Rusage) (wpid int, err error) {
var status _C_int
- var r Pid_t
+ var r _Pid_t
err = ERESTART
// AIX wait4 may return with ERESTART errno, while the processus is still
// active.
for err == ERESTART {
- r, err = wait4(Pid_t(pid), &status, options, rusage)
+ r, err = wait4(_Pid_t(pid), &status, options, rusage)
}
wpid = int(r)
if wstatus != nil {
diff --git a/src/syscall/types_aix.go b/src/syscall/types_aix.go
index f9f05af667..b961bdb197 100644
--- a/src/syscall/types_aix.go
+++ b/src/syscall/types_aix.go
@@ -86,7 +86,7 @@ type Rusage C.struct_rusage
type Rlimit C.struct_rlimit
-type Pid_t C.pid_t
+type _Pid_t C.pid_t
type _Gid_t C.gid_t
diff --git a/src/syscall/types_solaris.go b/src/syscall/types_solaris.go
index a9e6d6bdd6..76a74508d2 100644
--- a/src/syscall/types_solaris.go
+++ b/src/syscall/types_solaris.go
@@ -101,6 +101,8 @@ type Rusage C.struct_rusage
type Rlimit C.struct_rlimit
+type _Pid_t C.pid_t
+
type _Gid_t C.gid_t
// Files
diff --git a/src/syscall/zsyscall_aix_ppc64.go b/src/syscall/zsyscall_aix_ppc64.go
index 3ea11f8af3..fe27dcadf2 100644
--- a/src/syscall/zsyscall_aix_ppc64.go
+++ b/src/syscall/zsyscall_aix_ppc64.go
@@ -420,9 +420,9 @@ func getdirent(fd int, buf []byte) (n int, err error) {
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
-func wait4(pid Pid_t, status *_C_int, options int, rusage *Rusage) (wpid Pid_t, err error) {
+func wait4(pid _Pid_t, status *_C_int, options int, rusage *Rusage) (wpid _Pid_t, err error) {
r0, _, e1 := syscall6(uintptr(unsafe.Pointer(&libc_wait4)), 4, uintptr(pid), uintptr(unsafe.Pointer(status)), uintptr(options), uintptr(unsafe.Pointer(rusage)), 0, 0)
- wpid = Pid_t(r0)
+ wpid = _Pid_t(r0)
if e1 != 0 {
err = errnoErr(e1)
}
diff --git a/src/syscall/ztypes_aix_ppc64.go b/src/syscall/ztypes_aix_ppc64.go
index 4fbbe23134..314266ea79 100644
--- a/src/syscall/ztypes_aix_ppc64.go
+++ b/src/syscall/ztypes_aix_ppc64.go
@@ -64,7 +64,7 @@ type Rlimit struct {
Max uint64
}
-type Pid_t int32
+type _Pid_t int32
type _Gid_t uint32
diff --git a/src/syscall/ztypes_solaris_amd64.go b/src/syscall/ztypes_solaris_amd64.go
index b892cd6612..f846666fff 100644
--- a/src/syscall/ztypes_solaris_amd64.go
+++ b/src/syscall/ztypes_solaris_amd64.go
@@ -60,6 +60,8 @@ type Rlimit struct {
Max uint64
}
+type _Pid_t int32
+
type _Gid_t uint32
const (