From 7a88c6465b0369506dcc9129d783550fd13c678c Mon Sep 17 00:00:00 2001 From: Shenghou Ma Date: Tue, 24 Mar 2015 13:11:43 -0400 Subject: [PATCH] syscall: use Getpgid to emulate Getpgrp on linux MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Fixes newly introduced test on linux/arm64 because linux/arm64 doesn't have the getpgrp syscall. Getpgid(0) is documented to be equivalent to Getpgrp. Change-Id: I8f30f4f8de8c32fe04a29c9c4a9330d4e4e6b46d Signed-off-by: Shenghou Ma Reviewed-on: https://go-review.googlesource.com/8022 Reviewed-by: Aram Hăvărneanu Reviewed-by: Rob Pike --- src/syscall/syscall_linux.go | 7 ++++++- src/syscall/zsyscall_linux_386.go | 8 -------- src/syscall/zsyscall_linux_amd64.go | 8 -------- src/syscall/zsyscall_linux_arm.go | 8 -------- src/syscall/zsyscall_linux_arm64.go | 8 -------- src/syscall/zsyscall_linux_ppc64.go | 8 -------- src/syscall/zsyscall_linux_ppc64le.go | 8 -------- 7 files changed, 6 insertions(+), 49 deletions(-) diff --git a/src/syscall/syscall_linux.go b/src/syscall/syscall_linux.go index 813ef28e1b..0a80560645 100644 --- a/src/syscall/syscall_linux.go +++ b/src/syscall/syscall_linux.go @@ -839,7 +839,12 @@ func Mount(source string, target string, fstype string, flags uintptr, data stri //sys Fsync(fd int) (err error) //sys Getdents(fd int, buf []byte) (n int, err error) = SYS_GETDENTS64 //sysnb Getpgid(pid int) (pgid int, err error) -//sysnb Getpgrp() (pid int) + +func Getpgrp() (pid int) { + pid, _ = Getpgid(0) + return +} + //sysnb Getpid() (pid int) //sysnb Getppid() (ppid int) //sys Getpriority(which int, who int) (prio int, err error) diff --git a/src/syscall/zsyscall_linux_386.go b/src/syscall/zsyscall_linux_386.go index 87459026f0..587918f834 100644 --- a/src/syscall/zsyscall_linux_386.go +++ b/src/syscall/zsyscall_linux_386.go @@ -524,14 +524,6 @@ func Getpgid(pid int) (pgid int, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func Getpgrp() (pid int) { - r0, _, _ := RawSyscall(SYS_GETPGRP, 0, 0, 0) - pid = int(r0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Getpid() (pid int) { r0, _, _ := RawSyscall(SYS_GETPID, 0, 0, 0) pid = int(r0) diff --git a/src/syscall/zsyscall_linux_amd64.go b/src/syscall/zsyscall_linux_amd64.go index c163c964a1..17b7d929e0 100644 --- a/src/syscall/zsyscall_linux_amd64.go +++ b/src/syscall/zsyscall_linux_amd64.go @@ -524,14 +524,6 @@ func Getpgid(pid int) (pgid int, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func Getpgrp() (pid int) { - r0, _, _ := RawSyscall(SYS_GETPGRP, 0, 0, 0) - pid = int(r0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Getpid() (pid int) { r0, _, _ := RawSyscall(SYS_GETPID, 0, 0, 0) pid = int(r0) diff --git a/src/syscall/zsyscall_linux_arm.go b/src/syscall/zsyscall_linux_arm.go index 976a2936fd..74bf02db3e 100644 --- a/src/syscall/zsyscall_linux_arm.go +++ b/src/syscall/zsyscall_linux_arm.go @@ -524,14 +524,6 @@ func Getpgid(pid int) (pgid int, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func Getpgrp() (pid int) { - r0, _, _ := RawSyscall(SYS_GETPGRP, 0, 0, 0) - pid = int(r0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Getpid() (pid int) { r0, _, _ := RawSyscall(SYS_GETPID, 0, 0, 0) pid = int(r0) diff --git a/src/syscall/zsyscall_linux_arm64.go b/src/syscall/zsyscall_linux_arm64.go index c4e74340cb..a7dfc81fee 100644 --- a/src/syscall/zsyscall_linux_arm64.go +++ b/src/syscall/zsyscall_linux_arm64.go @@ -524,14 +524,6 @@ func Getpgid(pid int) (pgid int, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func Getpgrp() (pid int) { - r0, _, _ := RawSyscall(SYS_GETPGRP, 0, 0, 0) - pid = int(r0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Getpid() (pid int) { r0, _, _ := RawSyscall(SYS_GETPID, 0, 0, 0) pid = int(r0) diff --git a/src/syscall/zsyscall_linux_ppc64.go b/src/syscall/zsyscall_linux_ppc64.go index f8c3518366..2de0de80db 100644 --- a/src/syscall/zsyscall_linux_ppc64.go +++ b/src/syscall/zsyscall_linux_ppc64.go @@ -524,14 +524,6 @@ func Getpgid(pid int) (pgid int, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func Getpgrp() (pid int) { - r0, _, _ := RawSyscall(SYS_GETPGRP, 0, 0, 0) - pid = int(r0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Getpid() (pid int) { r0, _, _ := RawSyscall(SYS_GETPID, 0, 0, 0) pid = int(r0) diff --git a/src/syscall/zsyscall_linux_ppc64le.go b/src/syscall/zsyscall_linux_ppc64le.go index f8c3518366..2de0de80db 100644 --- a/src/syscall/zsyscall_linux_ppc64le.go +++ b/src/syscall/zsyscall_linux_ppc64le.go @@ -524,14 +524,6 @@ func Getpgid(pid int) (pgid int, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func Getpgrp() (pid int) { - r0, _, _ := RawSyscall(SYS_GETPGRP, 0, 0, 0) - pid = int(r0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Getpid() (pid int) { r0, _, _ := RawSyscall(SYS_GETPID, 0, 0, 0) pid = int(r0) -- 2.48.1