From cd187e9102bd6c55bb611a0b0f35fc4a7e0fbc51 Mon Sep 17 00:00:00 2001 From: Michael Munday Date: Fri, 18 Mar 2016 18:55:26 -0400 Subject: [PATCH] syscall: change clone argument order on s390x The Linux ABI takes arguments in a different order on s390x. Change-Id: Ic9cfcc22a5ea3d8ef77d4dd0b915fc266ff3e5f7 Reviewed-on: https://go-review.googlesource.com/20960 Reviewed-by: Ian Lance Taylor Reviewed-by: Brad Fitzpatrick Run-TryBot: Brad Fitzpatrick --- src/syscall/exec_linux.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/syscall/exec_linux.go b/src/syscall/exec_linux.go index 0ea9283bf68..c1fd53cc6ec 100644 --- a/src/syscall/exec_linux.go +++ b/src/syscall/exec_linux.go @@ -7,6 +7,7 @@ package syscall import ( + "runtime" "unsafe" ) @@ -93,7 +94,11 @@ func forkAndExecInChild(argv0 *byte, argv, envv []*byte, chroot, dir *byte, attr // About to call fork. // No more allocation or calls of non-assembly functions. runtime_BeforeFork() - r1, _, err1 = RawSyscall6(SYS_CLONE, uintptr(SIGCHLD)|sys.Cloneflags, 0, 0, 0, 0, 0) + if runtime.GOARCH == "s390x" { + r1, _, err1 = RawSyscall6(SYS_CLONE, 0, uintptr(SIGCHLD)|sys.Cloneflags, 0, 0, 0, 0) + } else { + r1, _, err1 = RawSyscall6(SYS_CLONE, uintptr(SIGCHLD)|sys.Cloneflags, 0, 0, 0, 0, 0) + } if err1 != 0 { runtime_AfterFork() return 0, err1