The callers expect negative errno values, so negate them when necessary.
No test because there is no reasonable way to make pipe/pipe2 fail.
This was reported on a system on which pipe2 returned ENOSYS.
For #37997
Fixes #38005
Change-Id: I3ad6cbbc2521cf495f8df6ec991a3f781122b508
Reviewed-on: https://go-review.googlesource.com/c/go/+/224592
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
(cherry picked from commit
20b46c7c697ce9d833141abe9aa0ea6101f00ae2)
Reviewed-on: https://go-review.googlesource.com/c/go/+/225419
MOVV R0, R5
MOVV $SYS_pipe2, R2
SYSCALL
+ BEQ R7, 2(PC)
+ SUBVU R2, R0, R2 // caller expects negative errno
MOVW R2, errno+8(FP)
RET
MOVW flags+0(FP), R5
MOVV $SYS_pipe2, R2
SYSCALL
+ BEQ R7, 2(PC)
+ SUBVU R2, R0, R2 // caller expects negative errno
MOVW R2, errno+16(FP)
RET
MOVW $-1, R1
MOVW R1, r+0(FP)
MOVW R1, w+4(FP)
+ SUBU R2, R0, R2 // caller expects negative errno
MOVW R2, errno+8(FP)
RET
pipeok:
MOVW flags+0(FP), R5
MOVW $SYS_pipe2, R2
SYSCALL
+ BEQ R7, 2(PC)
+ SUBU R2, R0, R2 // caller expects negative errno
MOVW R2, errno+12(FP)
RET