OLD | NEW |
1 // Copyright 2009 The Go Authors. All rights reserved. | 1 // Copyright 2009 The Go Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style | 2 // Use of this source code is governed by a BSD-style |
3 // license that can be found in the LICENSE file. | 3 // license that can be found in the LICENSE file. |
4 | 4 |
| 5 // +build darwin freebsd linux openbsd windows |
| 6 |
5 package os | 7 package os |
6 | 8 |
7 import syscall "syscall" | 9 import syscall "syscall" |
8 | 10 |
9 // Errno is the Unix error number. Names such as EINVAL are simple | 11 // Errno is the Unix error number. Names such as EINVAL are simple |
10 // wrappers to convert the error number into an Error. | 12 // wrappers to convert the error number into an Error. |
11 type Errno int64 | 13 type Errno int64 |
12 | 14 |
13 func (e Errno) String() string { return syscall.Errstr(int(e)) } | 15 func (e Errno) String() string { return syscall.Errstr(int(e)) } |
14 | 16 |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 func NewSyscallError(syscall string, errno int) Error { | 83 func NewSyscallError(syscall string, errno int) Error { |
82 if errno == 0 { | 84 if errno == 0 { |
83 return nil | 85 return nil |
84 } | 86 } |
85 return &SyscallError{syscall, Errno(errno)} | 87 return &SyscallError{syscall, Errno(errno)} |
86 } | 88 } |
87 | 89 |
88 func iserror(errno int) bool { | 90 func iserror(errno int) bool { |
89 return errno != 0 | 91 return errno != 0 |
90 } | 92 } |
OLD | NEW |