diff --git a/plan9/exec_plan9.go b/plan9/exec_plan9.go index 6d89f666..73a97a30 100644 --- a/plan9/exec_plan9.go +++ b/plan9/exec_plan9.go @@ -61,18 +61,6 @@ import ( var ForkLock sync.RWMutex -// StringSlicePtr is deprecated. Use SlicePtrFromStrings instead. -// If any string contains a NUL byte this function panics instead -// of returning an error. -func StringSlicePtr(ss []string) []*byte { - bb := make([]*byte, len(ss)+1) - for i := 0; i < len(ss); i++ { - bb[i] = StringBytePtr(ss[i]) - } - bb[len(ss)] = nil - return bb -} - // SlicePtrFromStrings converts a slice of strings to a slice of // pointers to NUL-terminated byte slices. If any string contains // a NUL byte, it returns (nil, EINVAL). @@ -323,11 +311,6 @@ childerror: for { RawSyscall(SYS_EXITS, 0, 0, 0) } - - // Calling panic is not actually safe, - // but the for loop above won't break - // and this shuts up the compiler. - panic("unreached") } func cexecPipe(p []int) error { diff --git a/plan9/syscall.go b/plan9/syscall.go index 18a63077..03230010 100644 --- a/plan9/syscall.go +++ b/plan9/syscall.go @@ -17,20 +17,10 @@ // For details of the functions and data types in this package consult // the manuals for the appropriate operating system. // These calls return err == nil to indicate success; otherwise -// err represents an operating system error describing the failure. +// err represents an operating system error describing the failure and +// holds a value of type syscall.ErrorString. package plan9 -// StringByteSlice is deprecated. Use ByteSliceFromString instead. -// If s contains a NUL byte this function panics instead of -// returning an error. -func StringByteSlice(s string) []byte { - a, err := ByteSliceFromString(s) - if err != nil { - panic("syscall: string with NUL passed to StringByteSlice") - } - return a -} - // ByteSliceFromString returns a NUL-terminated slice of bytes // containing the text of s. If s contains a NUL byte at any // location, it returns (nil, EINVAL). @@ -45,11 +35,6 @@ func ByteSliceFromString(s string) ([]byte, error) { return a, nil } -// StringBytePtr is deprecated. Use BytePtrFromString instead. -// If s contains a NUL byte this function panics instead of -// returning an error. -func StringBytePtr(s string) *byte { return &StringByteSlice(s)[0] } - // BytePtrFromString returns a pointer to a NUL-terminated array of // bytes containing the text of s. If s contains a NUL byte at any // location, it returns (nil, EINVAL). diff --git a/plan9/syscall_plan9.go b/plan9/syscall_plan9.go index e813e3cb..0c6814cf 100644 --- a/plan9/syscall_plan9.go +++ b/plan9/syscall_plan9.go @@ -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 == "" {