Commit 02c66d5d authored by David du Colombier's avatar David du Colombier

go.sys/plan9: use syscall.ErrorString instead of NewError

LGTM=bradfitz, r
R=r, bradfitz
CC=golang-codereviews
https://golang.org/cl/126090044
parent fcfc1156
...@@ -139,7 +139,7 @@ func Fd2path(fd int) (path string, err error) { ...@@ -139,7 +139,7 @@ func Fd2path(fd int) (path string, err error) {
//sys pipe(p *[2]_C_int) (err error) //sys pipe(p *[2]_C_int) (err error)
func Pipe(p []int) (err error) { func Pipe(p []int) (err error) {
if len(p) != 2 { if len(p) != 2 {
return NewError("bad arg in system call") return syscall.ErrorString("bad arg in system call")
} }
var pp [2]_C_int var pp [2]_C_int
err = pipe(&pp) err = pipe(&pp)
...@@ -156,7 +156,7 @@ func Seek(fd int, offset int64, whence int) (newoffset int64, err error) { ...@@ -156,7 +156,7 @@ func Seek(fd int, offset int64, whence int) (newoffset int64, err error) {
newoffset, e := seek(0, fd, offset, whence) newoffset, e := seek(0, fd, offset, whence)
if newoffset == -1 { if newoffset == -1 {
err = NewError(e) err = syscall.ErrorString(e)
} }
return return
} }
...@@ -212,7 +212,7 @@ func Await(w *Waitmsg) (err error) { ...@@ -212,7 +212,7 @@ func Await(w *Waitmsg) (err error) {
nf++ nf++
if nf != len(f) { if nf != len(f) {
return NewError("invalid wait message") return syscall.ErrorString("invalid wait message")
} }
w.Pid = int(atoi(f[0])) w.Pid = int(atoi(f[0]))
w.Time[0] = uint32(atoi(f[1])) w.Time[0] = uint32(atoi(f[1]))
......
...@@ -4,6 +4,8 @@ ...@@ -4,6 +4,8 @@
package plan9 package plan9
import "syscall"
// Constants // Constants
const ( const (
// Invented values to support what package os expects. // Invented values to support what package os expects.
...@@ -26,23 +28,23 @@ const ( ...@@ -26,23 +28,23 @@ const (
// Errors // Errors
var ( var (
EINVAL = NewError("bad arg in system call") EINVAL = syscall.ErrorString("bad arg in system call")
ENOTDIR = NewError("not a directory") ENOTDIR = syscall.ErrorString("not a directory")
EISDIR = NewError("file is a directory") EISDIR = syscall.ErrorString("file is a directory")
ENOENT = NewError("file does not exist") ENOENT = syscall.ErrorString("file does not exist")
EEXIST = NewError("file already exists") EEXIST = syscall.ErrorString("file already exists")
EMFILE = NewError("no free file descriptors") EMFILE = syscall.ErrorString("no free file descriptors")
EIO = NewError("i/o error") EIO = syscall.ErrorString("i/o error")
ENAMETOOLONG = NewError("file name too long") ENAMETOOLONG = syscall.ErrorString("file name too long")
EINTR = NewError("interrupted") EINTR = syscall.ErrorString("interrupted")
EPERM = NewError("permission denied") EPERM = syscall.ErrorString("permission denied")
EBUSY = NewError("no free devices") EBUSY = syscall.ErrorString("no free devices")
ETIMEDOUT = NewError("connection timed out") ETIMEDOUT = syscall.ErrorString("connection timed out")
EPLAN9 = NewError("not supported by plan 9") EPLAN9 = syscall.ErrorString("not supported by plan 9")
// The following errors do not correspond to any // The following errors do not correspond to any
// Plan 9 system messages. Invented to support // Plan 9 system messages. Invented to support
// what package os and others expect. // what package os and others expect.
EACCES = NewError("access permission denied") EACCES = syscall.ErrorString("access permission denied")
EAFNOSUPPORT = NewError("address family not supported by protocol") EAFNOSUPPORT = syscall.ErrorString("address family not supported by protocol")
) )
...@@ -4,6 +4,8 @@ ...@@ -4,6 +4,8 @@
package plan9 package plan9
import "syscall"
// Constants // Constants
const ( const (
// Invented values to support what package os expects. // Invented values to support what package os expects.
...@@ -26,23 +28,23 @@ const ( ...@@ -26,23 +28,23 @@ const (
// Errors // Errors
var ( var (
EINVAL = NewError("bad arg in system call") EINVAL = syscall.ErrorString("bad arg in system call")
ENOTDIR = NewError("not a directory") ENOTDIR = syscall.ErrorString("not a directory")
EISDIR = NewError("file is a directory") EISDIR = syscall.ErrorString("file is a directory")
ENOENT = NewError("file does not exist") ENOENT = syscall.ErrorString("file does not exist")
EEXIST = NewError("file already exists") EEXIST = syscall.ErrorString("file already exists")
EMFILE = NewError("no free file descriptors") EMFILE = syscall.ErrorString("no free file descriptors")
EIO = NewError("i/o error") EIO = syscall.ErrorString("i/o error")
ENAMETOOLONG = NewError("file name too long") ENAMETOOLONG = syscall.ErrorString("file name too long")
EINTR = NewError("interrupted") EINTR = syscall.ErrorString("interrupted")
EPERM = NewError("permission denied") EPERM = syscall.ErrorString("permission denied")
EBUSY = NewError("no free devices") EBUSY = syscall.ErrorString("no free devices")
ETIMEDOUT = NewError("connection timed out") ETIMEDOUT = syscall.ErrorString("connection timed out")
EPLAN9 = NewError("not supported by plan 9") EPLAN9 = syscall.ErrorString("not supported by plan 9")
// The following errors do not correspond to any // The following errors do not correspond to any
// Plan 9 system messages. Invented to support // Plan 9 system messages. Invented to support
// what package os and others expect. // what package os and others expect.
EACCES = NewError("access permission denied") EACCES = syscall.ErrorString("access permission denied")
EAFNOSUPPORT = NewError("address family not supported by protocol") EAFNOSUPPORT = syscall.ErrorString("address family not supported by protocol")
) )
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment