From 3dbebcf8efb6a5011a60c2b4591c1022a759af8a Mon Sep 17 00:00:00 2001 From: Tobias Klauser Date: Mon, 29 Jan 2018 11:11:38 +0100 Subject: [PATCH] unix: use SyscallNoError and RawSyscallNoError on Linux only The SyscallNoError and RawSyscallNoError functions are only needed on Linux. Make sure they are not used within the generated zsyscall_*.go files if $GOOS != "linux". Updates golang/go#22924 Change-Id: I3b2aa8624895b0527dcc832b2945a8d591f0ba1a Reviewed-on: https://go-review.googlesource.com/90475 Run-TryBot: Tobias Klauser TryBot-Result: Gobot Gobot Reviewed-by: Brad Fitzpatrick --- unix/mksyscall.pl | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/unix/mksyscall.pl b/unix/mksyscall.pl index 73e26caf..1f6b926f 100755 --- a/unix/mksyscall.pl +++ b/unix/mksyscall.pl @@ -210,13 +210,13 @@ while(<>) { # Determine which form to use; pad args with zeros. my $asm = "Syscall"; if ($nonblock) { - if ($errvar ne "") { - $asm = "RawSyscall"; - } else { + if ($errvar eq "" && $ENV{'GOOS'} eq "linux") { $asm = "RawSyscallNoError"; + } else { + $asm = "RawSyscall"; } } else { - if ($errvar eq "") { + if ($errvar eq "" && $ENV{'GOOS'} eq "linux") { $asm = "SyscallNoError"; } } @@ -292,10 +292,11 @@ while(<>) { if ($ret[0] eq "_" && $ret[1] eq "_" && $ret[2] eq "_") { $text .= "\t$call\n"; } else { - if ($errvar ne "") { - $text .= "\t$ret[0], $ret[1], $ret[2] := $call\n"; - } else { + if ($errvar eq "" && $ENV{'GOOS'} eq "linux") { + # raw syscall without error on Linux, see golang.org/issue/22924 $text .= "\t$ret[0], $ret[1] := $call\n"; + } else { + $text .= "\t$ret[0], $ret[1], $ret[2] := $call\n"; } } $text .= $body;