]> Cypherpunks repositories - gostls13.git/commit
syscall: fix a few Linux system calls
authorRuss Cox <rsc@golang.org>
Fri, 16 May 2014 16:15:32 +0000 (12:15 -0400)
committerRuss Cox <rsc@golang.org>
Fri, 16 May 2014 16:15:32 +0000 (12:15 -0400)
commitbf68f6623afd589ebaed1f868729f707701c6ddc
tree06ac8542c2cb9ac56be6eea0198848c0e9ef6eac
parentd1f627f2f3f6fc22ed64e1cc7b17eefca952224b
syscall: fix a few Linux system calls

These functions claimed to return error (an interface)
and be implemented entirely in assembly, but it's not
possible to create an interface from assembly
(at least not easily).

In reality the functions were written to return an errno uintptr
despite the Go prototype saying error.
When the errno was 0, they coincidentally filled out a nil error
by writing the 0 to the type word of the interface.
If the errno was ever non-zero, the functions would
create a non-nil error that would crash when trying to
call err.Error().

Luckily these functions (Seek, Time, Gettimeofday) pretty
much never fail, so it was all kind of working.

Found by go vet.

LGTM=bradfitz, r
R=golang-codereviews, bradfitz, r
CC=golang-codereviews
https://golang.org/cl/99320043
src/pkg/syscall/asm_linux_386.s
src/pkg/syscall/asm_linux_amd64.s
src/pkg/syscall/asm_linux_arm.s
src/pkg/syscall/syscall_linux_386.go
src/pkg/syscall/syscall_linux_amd64.go
src/pkg/syscall/syscall_linux_arm.go
src/pkg/syscall/syscall_unix_test.go