Commit 3dbebcf8 authored by Tobias Klauser's avatar Tobias Klauser Committed by Tobias Klauser

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 <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: 's avatarBrad Fitzpatrick <bradfitz@golang.org>
parent ff2a66f3
...@@ -210,13 +210,13 @@ while(<>) { ...@@ -210,13 +210,13 @@ while(<>) {
# Determine which form to use; pad args with zeros. # Determine which form to use; pad args with zeros.
my $asm = "Syscall"; my $asm = "Syscall";
if ($nonblock) { if ($nonblock) {
if ($errvar ne "") { if ($errvar eq "" && $ENV{'GOOS'} eq "linux") {
$asm = "RawSyscall";
} else {
$asm = "RawSyscallNoError"; $asm = "RawSyscallNoError";
} else {
$asm = "RawSyscall";
} }
} else { } else {
if ($errvar eq "") { if ($errvar eq "" && $ENV{'GOOS'} eq "linux") {
$asm = "SyscallNoError"; $asm = "SyscallNoError";
} }
} }
...@@ -292,10 +292,11 @@ while(<>) { ...@@ -292,10 +292,11 @@ while(<>) {
if ($ret[0] eq "_" && $ret[1] eq "_" && $ret[2] eq "_") { if ($ret[0] eq "_" && $ret[1] eq "_" && $ret[2] eq "_") {
$text .= "\t$call\n"; $text .= "\t$call\n";
} else { } else {
if ($errvar ne "") { if ($errvar eq "" && $ENV{'GOOS'} eq "linux") {
$text .= "\t$ret[0], $ret[1], $ret[2] := $call\n"; # raw syscall without error on Linux, see golang.org/issue/22924
} else {
$text .= "\t$ret[0], $ret[1] := $call\n"; $text .= "\t$ret[0], $ret[1] := $call\n";
} else {
$text .= "\t$ret[0], $ret[1], $ret[2] := $call\n";
} }
} }
$text .= $body; $text .= $body;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment