aboutsummaryrefslogtreecommitdiff
path: root/libgo/go/syscall
diff options
context:
space:
mode:
authorIan Lance Taylor <ian@gcc.gnu.org>2012-03-23 18:41:07 +0000
committerIan Lance Taylor <ian@gcc.gnu.org>2012-03-23 18:41:07 +0000
commit03934a56326d43c1c8bb185979a90830fd25f880 (patch)
tree2678a8c20eecaa458b104436ceab5777877c774a /libgo/go/syscall
parentdf32732b0270070f98a99a5fcf7c0ebd83a2059e (diff)
downloadgcc-03934a56326d43c1c8bb185979a90830fd25f880.zip
gcc-03934a56326d43c1c8bb185979a90830fd25f880.tar.gz
gcc-03934a56326d43c1c8bb185979a90830fd25f880.tar.bz2
syscall: Fix errno handling in syscall.Syscall and friends.
From-SVN: r185746
Diffstat (limited to 'libgo/go/syscall')
-rw-r--r--libgo/go/syscall/syscall_unix.go4
1 files changed, 4 insertions, 0 deletions
diff --git a/libgo/go/syscall/syscall_unix.go b/libgo/go/syscall/syscall_unix.go
index e3c6629..d4bff9e 100644
--- a/libgo/go/syscall/syscall_unix.go
+++ b/libgo/go/syscall/syscall_unix.go
@@ -31,6 +31,7 @@ const darwinAMD64 = runtime.GOOS == "darwin" && runtime.GOARCH == "amd64"
// expects a 32-bit one.
func Syscall(trap, a1, a2, a3 uintptr) (r1, r2 uintptr, err Errno) {
Entersyscall()
+ SetErrno(0)
var r uintptr
if unsafe.Sizeof(r) == 4 {
r1 := c_syscall32(int32(trap), int32(a1), int32(a2), int32(a3), 0, 0, 0)
@@ -46,6 +47,7 @@ func Syscall(trap, a1, a2, a3 uintptr) (r1, r2 uintptr, err Errno) {
func Syscall6(trap, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err Errno) {
Entersyscall()
+ SetErrno(0)
var r uintptr
if unsafe.Sizeof(r) == 4 {
r1 := c_syscall32(int32(trap), int32(a1), int32(a2), int32(a3),
@@ -63,6 +65,7 @@ func Syscall6(trap, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err Errno)
func RawSyscall(trap, a1, a2, a3 uintptr) (r1, r2 uintptr, err Errno) {
var r uintptr
+ SetErrno(0)
if unsafe.Sizeof(r) == 4 {
r1 := c_syscall32(int32(trap), int32(a1), int32(a2), int32(a3), 0, 0, 0)
r = uintptr(r1)
@@ -76,6 +79,7 @@ func RawSyscall(trap, a1, a2, a3 uintptr) (r1, r2 uintptr, err Errno) {
func RawSyscall6(trap, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err Errno) {
var r uintptr
+ SetErrno(0)
if unsafe.Sizeof(r) == 4 {
r1 := c_syscall32(int32(trap), int32(a1), int32(a2), int32(a3),
int32(a4), int32(a5), int32(a6))