mirror of
https://github.com/golang/go
synced 2024-11-07 12:26:16 -07:00
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>
This commit is contained in:
parent
c8b2ac6890
commit
f98ac85192
@ -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.
|
||||
|
@ -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 {
|
||||
|
@ -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
|
||||
|
||||
|
@ -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
|
||||
|
@ -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)
|
||||
}
|
||||
|
@ -64,7 +64,7 @@ type Rlimit struct {
|
||||
Max uint64
|
||||
}
|
||||
|
||||
type Pid_t int32
|
||||
type _Pid_t int32
|
||||
|
||||
type _Gid_t uint32
|
||||
|
||||
|
@ -60,6 +60,8 @@ type Rlimit struct {
|
||||
Max uint64
|
||||
}
|
||||
|
||||
type _Pid_t int32
|
||||
|
||||
type _Gid_t uint32
|
||||
|
||||
const (
|
||||
|
Loading…
Reference in New Issue
Block a user