go.sys/plan9: use syscall.ErrorString for errors

If we use a local type, it won't compare properly with errors from
the rest of the standard library. Errors are the one type from syscall
that propagates through the system, so it's important to have only
one type for them.
Will apply the corresponding change to the other packages once
this is approved.

Also delete some deprecated code. This is a new package; no need
to carry the past.

LGTM=rsc
R=rsc
CC=golang-codereviews
https://golang.org/cl/126250043
This commit is contained in:
Rob Pike
2014-08-14 09:29:35 -07:00
parent 0c07981137
commit b87d025ac4
3 changed files with 9 additions and 56 deletions
+7 -22
View File
@@ -11,25 +11,10 @@
package plan9
import "unsafe"
const ImplementsGetwd = true
// ErrorString implements Error's String method by returning itself.
type ErrorString string
func (e ErrorString) Error() string { return string(e) }
// NewError converts s to an ErrorString, which satisfies the Error interface.
func NewError(s string) error { return ErrorString(s) }
func (e ErrorString) Temporary() bool {
return e == EINTR || e == EMFILE || e.Timeout()
}
func (e ErrorString) Timeout() bool {
return e == EBUSY || e == ETIMEDOUT
}
import (
"syscall"
"unsafe"
)
// A Note is a string describing a process note.
// It implements the os.Signal interface.
@@ -51,8 +36,8 @@ var (
// creation of IPv6 sockets to return EAFNOSUPPORT.
var SocketDisableIPv6 bool
func Syscall(trap, a1, a2, a3 uintptr) (r1, r2 uintptr, err ErrorString)
func Syscall6(trap, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err ErrorString)
func Syscall(trap, a1, a2, a3 uintptr) (r1, r2 uintptr, err syscall.ErrorString)
func Syscall6(trap, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err syscall.ErrorString)
func RawSyscall(trap, a1, a2, a3 uintptr) (r1, r2, err uintptr)
func RawSyscall6(trap, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2, err uintptr)
@@ -249,7 +234,7 @@ func Unmount(name, old string) (err error) {
oldptr := uintptr(unsafe.Pointer(oldp))
var r0 uintptr
var e ErrorString
var e syscall.ErrorString
// bind(2) man page: If name is zero, everything bound or mounted upon old is unbound or unmounted.
if name == "" {