summaryrefslogtreecommitdiff
path: root/src/pkg/os/error_plan9.go
diff options
context:
space:
mode:
Diffstat (limited to 'src/pkg/os/error_plan9.go')
-rw-r--r--src/pkg/os/error_plan9.go51
1 files changed, 22 insertions, 29 deletions
diff --git a/src/pkg/os/error_plan9.go b/src/pkg/os/error_plan9.go
index 91ace6d97..3c727b2ab 100644
--- a/src/pkg/os/error_plan9.go
+++ b/src/pkg/os/error_plan9.go
@@ -4,7 +4,10 @@
package os
-import syscall "syscall"
+import (
+ "errors"
+ "syscall"
+)
// SyscallError records an error from a specific system call.
type SyscallError struct {
@@ -12,32 +15,28 @@ type SyscallError struct {
Err string
}
-func (e *SyscallError) String() string { return e.Syscall + ": " + e.Err }
-
-// Note: If the name of the function NewSyscallError changes,
-// pkg/go/doc/doc.go should be adjusted since it hardwires
-// this name in a heuristic.
+func (e *SyscallError) Error() string { return e.Syscall + ": " + e.Err }
-// NewSyscallError returns, as an Error, a new SyscallError
+// NewSyscallError returns, as an error, a new SyscallError
// with the given system call name and error details.
// As a convenience, if err is nil, NewSyscallError returns nil.
-func NewSyscallError(syscall string, err syscall.Error) Error {
+func NewSyscallError(syscall string, err error) error {
if err == nil {
return nil
}
- return &SyscallError{syscall, err.String()}
+ return &SyscallError{syscall, err.Error()}
}
var (
- Eshortstat = NewError("stat buffer too small")
- Ebadstat = NewError("malformed stat buffer")
- Ebadfd = NewError("fd out of range or not open")
- Ebadarg = NewError("bad arg in system call")
- Enotdir = NewError("not a directory")
- Enonexist = NewError("file does not exist")
- Eexist = NewError("file already exists")
- Eio = NewError("i/o error")
- Eperm = NewError("permission denied")
+ Eshortstat = errors.New("stat buffer too small")
+ Ebadstat = errors.New("malformed stat buffer")
+ Ebadfd = errors.New("fd out of range or not open")
+ Ebadarg = errors.New("bad arg in system call")
+ Enotdir = errors.New("not a directory")
+ Enonexist = errors.New("file does not exist")
+ Eexist = errors.New("file already exists")
+ Eio = errors.New("i/o error")
+ Eperm = errors.New("permission denied")
EINVAL = Ebadarg
ENOTDIR = Enotdir
@@ -48,15 +47,9 @@ var (
EPERM = Eperm
EISDIR = syscall.EISDIR
- EBADF = NewError("bad file descriptor")
- ENAMETOOLONG = NewError("file name too long")
- ERANGE = NewError("math result not representable")
- EPIPE = NewError("Broken Pipe")
- EPLAN9 = NewError("not supported by plan 9")
+ EBADF = errors.New("bad file descriptor")
+ ENAMETOOLONG = errors.New("file name too long")
+ ERANGE = errors.New("math result not representable")
+ EPIPE = errors.New("Broken Pipe")
+ EPLAN9 = errors.New("not supported by plan 9")
)
-
-func iserror(err syscall.Error) bool {
- return err != nil
-}
-
-func Errno(e syscall.Error) syscall.Error { return e }