diff options
Diffstat (limited to 'pkg/syserr')
-rw-r--r-- | pkg/syserr/host_linux.go | 9 | ||||
-rw-r--r-- | pkg/syserr/syserr.go | 262 |
2 files changed, 136 insertions, 135 deletions
diff --git a/pkg/syserr/host_linux.go b/pkg/syserr/host_linux.go index 77faa3670..c8c10f48b 100644 --- a/pkg/syserr/host_linux.go +++ b/pkg/syserr/host_linux.go @@ -18,7 +18,8 @@ package syserr import ( "fmt" - "syscall" + + "golang.org/x/sys/unix" ) const maxErrno = 134 @@ -30,15 +31,15 @@ type linuxHostTranslation struct { var linuxHostTranslations [maxErrno]linuxHostTranslation -// FromHost translates a syscall.Errno to a corresponding Error value. -func FromHost(err syscall.Errno) *Error { +// FromHost translates a unix.Errno to a corresponding Error value. +func FromHost(err unix.Errno) *Error { if int(err) >= len(linuxHostTranslations) || !linuxHostTranslations[err].ok { panic(fmt.Sprintf("unknown host errno %q (%d)", err.Error(), err)) } return linuxHostTranslations[err].err } -func addLinuxHostTranslation(host syscall.Errno, trans *Error) { +func addLinuxHostTranslation(host unix.Errno, trans *Error) { if linuxHostTranslations[host].ok { panic(fmt.Sprintf("duplicate translation for host errno %q (%d)", host.Error(), host)) } diff --git a/pkg/syserr/syserr.go b/pkg/syserr/syserr.go index ac4b799c3..b5881ea3c 100644 --- a/pkg/syserr/syserr.go +++ b/pkg/syserr/syserr.go @@ -19,8 +19,8 @@ package syserr import ( "fmt" - "syscall" + "golang.org/x/sys/unix" "gvisor.dev/gvisor/pkg/abi/linux" "gvisor.dev/gvisor/pkg/syserror" ) @@ -55,7 +55,7 @@ func New(message string, linuxTranslation *linux.Errno) *Error { panic(fmt.Sprint("invalid errno: ", errno)) } - e := error(syscall.Errno(errno)) + e := error(unix.Errno(errno)) // syserror.ErrWouldBlock gets translated to syserror.EWOULDBLOCK and // enables proper blocking semantics. This should temporary address the // class of blocking bugs that keep popping up with the current state of @@ -87,7 +87,7 @@ func NewWithoutTranslation(message string) *Error { return &Error{message: message, noTranslation: true} } -func newWithHost(message string, linuxTranslation *linux.Errno, hostErrno syscall.Errno) *Error { +func newWithHost(message string, linuxTranslation *linux.Errno, hostErrno unix.Errno) *Error { e := New(message, linuxTranslation) addLinuxHostTranslation(hostErrno, e) return e @@ -143,133 +143,133 @@ func (e *Error) ToLinux() *linux.Errno { // Some of the errors should be replaced with package specific errors and // others should be removed entirely. var ( - ErrNotPermitted = newWithHost("operation not permitted", linux.EPERM, syscall.EPERM) - ErrNoFileOrDir = newWithHost("no such file or directory", linux.ENOENT, syscall.ENOENT) - ErrNoProcess = newWithHost("no such process", linux.ESRCH, syscall.ESRCH) - ErrInterrupted = newWithHost("interrupted system call", linux.EINTR, syscall.EINTR) - ErrIO = newWithHost("I/O error", linux.EIO, syscall.EIO) - ErrDeviceOrAddress = newWithHost("no such device or address", linux.ENXIO, syscall.ENXIO) - ErrTooManyArgs = newWithHost("argument list too long", linux.E2BIG, syscall.E2BIG) - ErrEcec = newWithHost("exec format error", linux.ENOEXEC, syscall.ENOEXEC) - ErrBadFD = newWithHost("bad file number", linux.EBADF, syscall.EBADF) - ErrNoChild = newWithHost("no child processes", linux.ECHILD, syscall.ECHILD) - ErrTryAgain = newWithHost("try again", linux.EAGAIN, syscall.EAGAIN) - ErrNoMemory = newWithHost("out of memory", linux.ENOMEM, syscall.ENOMEM) - ErrPermissionDenied = newWithHost("permission denied", linux.EACCES, syscall.EACCES) - ErrBadAddress = newWithHost("bad address", linux.EFAULT, syscall.EFAULT) - ErrNotBlockDevice = newWithHost("block device required", linux.ENOTBLK, syscall.ENOTBLK) - ErrBusy = newWithHost("device or resource busy", linux.EBUSY, syscall.EBUSY) - ErrExists = newWithHost("file exists", linux.EEXIST, syscall.EEXIST) - ErrCrossDeviceLink = newWithHost("cross-device link", linux.EXDEV, syscall.EXDEV) - ErrNoDevice = newWithHost("no such device", linux.ENODEV, syscall.ENODEV) - ErrNotDir = newWithHost("not a directory", linux.ENOTDIR, syscall.ENOTDIR) - ErrIsDir = newWithHost("is a directory", linux.EISDIR, syscall.EISDIR) - ErrInvalidArgument = newWithHost("invalid argument", linux.EINVAL, syscall.EINVAL) - ErrFileTableOverflow = newWithHost("file table overflow", linux.ENFILE, syscall.ENFILE) - ErrTooManyOpenFiles = newWithHost("too many open files", linux.EMFILE, syscall.EMFILE) - ErrNotTTY = newWithHost("not a typewriter", linux.ENOTTY, syscall.ENOTTY) - ErrTestFileBusy = newWithHost("text file busy", linux.ETXTBSY, syscall.ETXTBSY) - ErrFileTooBig = newWithHost("file too large", linux.EFBIG, syscall.EFBIG) - ErrNoSpace = newWithHost("no space left on device", linux.ENOSPC, syscall.ENOSPC) - ErrIllegalSeek = newWithHost("illegal seek", linux.ESPIPE, syscall.ESPIPE) - ErrReadOnlyFS = newWithHost("read-only file system", linux.EROFS, syscall.EROFS) - ErrTooManyLinks = newWithHost("too many links", linux.EMLINK, syscall.EMLINK) - ErrBrokenPipe = newWithHost("broken pipe", linux.EPIPE, syscall.EPIPE) - ErrDomain = newWithHost("math argument out of domain of func", linux.EDOM, syscall.EDOM) - ErrRange = newWithHost("math result not representable", linux.ERANGE, syscall.ERANGE) - ErrDeadlock = newWithHost("resource deadlock would occur", linux.EDEADLOCK, syscall.EDEADLOCK) - ErrNameTooLong = newWithHost("file name too long", linux.ENAMETOOLONG, syscall.ENAMETOOLONG) - ErrNoLocksAvailable = newWithHost("no record locks available", linux.ENOLCK, syscall.ENOLCK) - ErrInvalidSyscall = newWithHost("invalid system call number", linux.ENOSYS, syscall.ENOSYS) - ErrDirNotEmpty = newWithHost("directory not empty", linux.ENOTEMPTY, syscall.ENOTEMPTY) - ErrLinkLoop = newWithHost("too many symbolic links encountered", linux.ELOOP, syscall.ELOOP) - ErrNoMessage = newWithHost("no message of desired type", linux.ENOMSG, syscall.ENOMSG) - ErrIdentifierRemoved = newWithHost("identifier removed", linux.EIDRM, syscall.EIDRM) - ErrChannelOutOfRange = newWithHost("channel number out of range", linux.ECHRNG, syscall.ECHRNG) - ErrLevelTwoNotSynced = newWithHost("level 2 not synchronized", linux.EL2NSYNC, syscall.EL2NSYNC) - ErrLevelThreeHalted = newWithHost("level 3 halted", linux.EL3HLT, syscall.EL3HLT) - ErrLevelThreeReset = newWithHost("level 3 reset", linux.EL3RST, syscall.EL3RST) - ErrLinkNumberOutOfRange = newWithHost("link number out of range", linux.ELNRNG, syscall.ELNRNG) - ErrProtocolDriverNotAttached = newWithHost("protocol driver not attached", linux.EUNATCH, syscall.EUNATCH) - ErrNoCSIAvailable = newWithHost("no CSI structure available", linux.ENOCSI, syscall.ENOCSI) - ErrLevelTwoHalted = newWithHost("level 2 halted", linux.EL2HLT, syscall.EL2HLT) - ErrInvalidExchange = newWithHost("invalid exchange", linux.EBADE, syscall.EBADE) - ErrInvalidRequestDescriptor = newWithHost("invalid request descriptor", linux.EBADR, syscall.EBADR) - ErrExchangeFull = newWithHost("exchange full", linux.EXFULL, syscall.EXFULL) - ErrNoAnode = newWithHost("no anode", linux.ENOANO, syscall.ENOANO) - ErrInvalidRequestCode = newWithHost("invalid request code", linux.EBADRQC, syscall.EBADRQC) - ErrInvalidSlot = newWithHost("invalid slot", linux.EBADSLT, syscall.EBADSLT) - ErrBadFontFile = newWithHost("bad font file format", linux.EBFONT, syscall.EBFONT) - ErrNotStream = newWithHost("device not a stream", linux.ENOSTR, syscall.ENOSTR) - ErrNoDataAvailable = newWithHost("no data available", linux.ENODATA, syscall.ENODATA) - ErrTimerExpired = newWithHost("timer expired", linux.ETIME, syscall.ETIME) - ErrStreamsResourceDepleted = newWithHost("out of streams resources", linux.ENOSR, syscall.ENOSR) - ErrMachineNotOnNetwork = newWithHost("machine is not on the network", linux.ENONET, syscall.ENONET) - ErrPackageNotInstalled = newWithHost("package not installed", linux.ENOPKG, syscall.ENOPKG) - ErrIsRemote = newWithHost("object is remote", linux.EREMOTE, syscall.EREMOTE) - ErrNoLink = newWithHost("link has been severed", linux.ENOLINK, syscall.ENOLINK) - ErrAdvertise = newWithHost("advertise error", linux.EADV, syscall.EADV) - ErrSRMount = newWithHost("srmount error", linux.ESRMNT, syscall.ESRMNT) - ErrSendCommunication = newWithHost("communication error on send", linux.ECOMM, syscall.ECOMM) - ErrProtocol = newWithHost("protocol error", linux.EPROTO, syscall.EPROTO) - ErrMultihopAttempted = newWithHost("multihop attempted", linux.EMULTIHOP, syscall.EMULTIHOP) - ErrRFS = newWithHost("RFS specific error", linux.EDOTDOT, syscall.EDOTDOT) - ErrInvalidDataMessage = newWithHost("not a data message", linux.EBADMSG, syscall.EBADMSG) - ErrOverflow = newWithHost("value too large for defined data type", linux.EOVERFLOW, syscall.EOVERFLOW) - ErrNetworkNameNotUnique = newWithHost("name not unique on network", linux.ENOTUNIQ, syscall.ENOTUNIQ) - ErrFDInBadState = newWithHost("file descriptor in bad state", linux.EBADFD, syscall.EBADFD) - ErrRemoteAddressChanged = newWithHost("remote address changed", linux.EREMCHG, syscall.EREMCHG) - ErrSharedLibraryInaccessible = newWithHost("can not access a needed shared library", linux.ELIBACC, syscall.ELIBACC) - ErrCorruptedSharedLibrary = newWithHost("accessing a corrupted shared library", linux.ELIBBAD, syscall.ELIBBAD) - ErrLibSectionCorrupted = newWithHost(".lib section in a.out corrupted", linux.ELIBSCN, syscall.ELIBSCN) - ErrTooManySharedLibraries = newWithHost("attempting to link in too many shared libraries", linux.ELIBMAX, syscall.ELIBMAX) - ErrSharedLibraryExeced = newWithHost("cannot exec a shared library directly", linux.ELIBEXEC, syscall.ELIBEXEC) - ErrIllegalByteSequence = newWithHost("illegal byte sequence", linux.EILSEQ, syscall.EILSEQ) - ErrShouldRestart = newWithHost("interrupted system call should be restarted", linux.ERESTART, syscall.ERESTART) - ErrStreamPipe = newWithHost("streams pipe error", linux.ESTRPIPE, syscall.ESTRPIPE) - ErrTooManyUsers = newWithHost("too many users", linux.EUSERS, syscall.EUSERS) - ErrNotASocket = newWithHost("socket operation on non-socket", linux.ENOTSOCK, syscall.ENOTSOCK) - ErrDestinationAddressRequired = newWithHost("destination address required", linux.EDESTADDRREQ, syscall.EDESTADDRREQ) - ErrMessageTooLong = newWithHost("message too long", linux.EMSGSIZE, syscall.EMSGSIZE) - ErrWrongProtocolForSocket = newWithHost("protocol wrong type for socket", linux.EPROTOTYPE, syscall.EPROTOTYPE) - ErrProtocolNotAvailable = newWithHost("protocol not available", linux.ENOPROTOOPT, syscall.ENOPROTOOPT) - ErrProtocolNotSupported = newWithHost("protocol not supported", linux.EPROTONOSUPPORT, syscall.EPROTONOSUPPORT) - ErrSocketNotSupported = newWithHost("socket type not supported", linux.ESOCKTNOSUPPORT, syscall.ESOCKTNOSUPPORT) - ErrEndpointOperation = newWithHost("operation not supported on transport endpoint", linux.EOPNOTSUPP, syscall.EOPNOTSUPP) - ErrProtocolFamilyNotSupported = newWithHost("protocol family not supported", linux.EPFNOSUPPORT, syscall.EPFNOSUPPORT) - ErrAddressFamilyNotSupported = newWithHost("address family not supported by protocol", linux.EAFNOSUPPORT, syscall.EAFNOSUPPORT) - ErrAddressInUse = newWithHost("address already in use", linux.EADDRINUSE, syscall.EADDRINUSE) - ErrAddressNotAvailable = newWithHost("cannot assign requested address", linux.EADDRNOTAVAIL, syscall.EADDRNOTAVAIL) - ErrNetworkDown = newWithHost("network is down", linux.ENETDOWN, syscall.ENETDOWN) - ErrNetworkUnreachable = newWithHost("network is unreachable", linux.ENETUNREACH, syscall.ENETUNREACH) - ErrNetworkReset = newWithHost("network dropped connection because of reset", linux.ENETRESET, syscall.ENETRESET) - ErrConnectionAborted = newWithHost("software caused connection abort", linux.ECONNABORTED, syscall.ECONNABORTED) - ErrConnectionReset = newWithHost("connection reset by peer", linux.ECONNRESET, syscall.ECONNRESET) - ErrNoBufferSpace = newWithHost("no buffer space available", linux.ENOBUFS, syscall.ENOBUFS) - ErrAlreadyConnected = newWithHost("transport endpoint is already connected", linux.EISCONN, syscall.EISCONN) - ErrNotConnected = newWithHost("transport endpoint is not connected", linux.ENOTCONN, syscall.ENOTCONN) - ErrShutdown = newWithHost("cannot send after transport endpoint shutdown", linux.ESHUTDOWN, syscall.ESHUTDOWN) - ErrTooManyRefs = newWithHost("too many references: cannot splice", linux.ETOOMANYREFS, syscall.ETOOMANYREFS) - ErrTimedOut = newWithHost("connection timed out", linux.ETIMEDOUT, syscall.ETIMEDOUT) - ErrConnectionRefused = newWithHost("connection refused", linux.ECONNREFUSED, syscall.ECONNREFUSED) - ErrHostDown = newWithHost("host is down", linux.EHOSTDOWN, syscall.EHOSTDOWN) - ErrNoRoute = newWithHost("no route to host", linux.EHOSTUNREACH, syscall.EHOSTUNREACH) - ErrAlreadyInProgress = newWithHost("operation already in progress", linux.EALREADY, syscall.EALREADY) - ErrInProgress = newWithHost("operation now in progress", linux.EINPROGRESS, syscall.EINPROGRESS) - ErrStaleFileHandle = newWithHost("stale file handle", linux.ESTALE, syscall.ESTALE) - ErrStructureNeedsCleaning = newWithHost("structure needs cleaning", linux.EUCLEAN, syscall.EUCLEAN) - ErrIsNamedFile = newWithHost("is a named type file", linux.ENOTNAM, syscall.ENOTNAM) - ErrRemoteIO = newWithHost("remote I/O error", linux.EREMOTEIO, syscall.EREMOTEIO) - ErrQuotaExceeded = newWithHost("quota exceeded", linux.EDQUOT, syscall.EDQUOT) - ErrNoMedium = newWithHost("no medium found", linux.ENOMEDIUM, syscall.ENOMEDIUM) - ErrWrongMediumType = newWithHost("wrong medium type", linux.EMEDIUMTYPE, syscall.EMEDIUMTYPE) - ErrCanceled = newWithHost("operation canceled", linux.ECANCELED, syscall.ECANCELED) - ErrNoKey = newWithHost("required key not available", linux.ENOKEY, syscall.ENOKEY) - ErrKeyExpired = newWithHost("key has expired", linux.EKEYEXPIRED, syscall.EKEYEXPIRED) - ErrKeyRevoked = newWithHost("key has been revoked", linux.EKEYREVOKED, syscall.EKEYREVOKED) - ErrKeyRejected = newWithHost("key was rejected by service", linux.EKEYREJECTED, syscall.EKEYREJECTED) - ErrOwnerDied = newWithHost("owner died", linux.EOWNERDEAD, syscall.EOWNERDEAD) - ErrNotRecoverable = newWithHost("state not recoverable", linux.ENOTRECOVERABLE, syscall.ENOTRECOVERABLE) + ErrNotPermitted = newWithHost("operation not permitted", linux.EPERM, unix.EPERM) + ErrNoFileOrDir = newWithHost("no such file or directory", linux.ENOENT, unix.ENOENT) + ErrNoProcess = newWithHost("no such process", linux.ESRCH, unix.ESRCH) + ErrInterrupted = newWithHost("interrupted system call", linux.EINTR, unix.EINTR) + ErrIO = newWithHost("I/O error", linux.EIO, unix.EIO) + ErrDeviceOrAddress = newWithHost("no such device or address", linux.ENXIO, unix.ENXIO) + ErrTooManyArgs = newWithHost("argument list too long", linux.E2BIG, unix.E2BIG) + ErrEcec = newWithHost("exec format error", linux.ENOEXEC, unix.ENOEXEC) + ErrBadFD = newWithHost("bad file number", linux.EBADF, unix.EBADF) + ErrNoChild = newWithHost("no child processes", linux.ECHILD, unix.ECHILD) + ErrTryAgain = newWithHost("try again", linux.EAGAIN, unix.EAGAIN) + ErrNoMemory = newWithHost("out of memory", linux.ENOMEM, unix.ENOMEM) + ErrPermissionDenied = newWithHost("permission denied", linux.EACCES, unix.EACCES) + ErrBadAddress = newWithHost("bad address", linux.EFAULT, unix.EFAULT) + ErrNotBlockDevice = newWithHost("block device required", linux.ENOTBLK, unix.ENOTBLK) + ErrBusy = newWithHost("device or resource busy", linux.EBUSY, unix.EBUSY) + ErrExists = newWithHost("file exists", linux.EEXIST, unix.EEXIST) + ErrCrossDeviceLink = newWithHost("cross-device link", linux.EXDEV, unix.EXDEV) + ErrNoDevice = newWithHost("no such device", linux.ENODEV, unix.ENODEV) + ErrNotDir = newWithHost("not a directory", linux.ENOTDIR, unix.ENOTDIR) + ErrIsDir = newWithHost("is a directory", linux.EISDIR, unix.EISDIR) + ErrInvalidArgument = newWithHost("invalid argument", linux.EINVAL, unix.EINVAL) + ErrFileTableOverflow = newWithHost("file table overflow", linux.ENFILE, unix.ENFILE) + ErrTooManyOpenFiles = newWithHost("too many open files", linux.EMFILE, unix.EMFILE) + ErrNotTTY = newWithHost("not a typewriter", linux.ENOTTY, unix.ENOTTY) + ErrTestFileBusy = newWithHost("text file busy", linux.ETXTBSY, unix.ETXTBSY) + ErrFileTooBig = newWithHost("file too large", linux.EFBIG, unix.EFBIG) + ErrNoSpace = newWithHost("no space left on device", linux.ENOSPC, unix.ENOSPC) + ErrIllegalSeek = newWithHost("illegal seek", linux.ESPIPE, unix.ESPIPE) + ErrReadOnlyFS = newWithHost("read-only file system", linux.EROFS, unix.EROFS) + ErrTooManyLinks = newWithHost("too many links", linux.EMLINK, unix.EMLINK) + ErrBrokenPipe = newWithHost("broken pipe", linux.EPIPE, unix.EPIPE) + ErrDomain = newWithHost("math argument out of domain of func", linux.EDOM, unix.EDOM) + ErrRange = newWithHost("math result not representable", linux.ERANGE, unix.ERANGE) + ErrDeadlock = newWithHost("resource deadlock would occur", linux.EDEADLOCK, unix.EDEADLOCK) + ErrNameTooLong = newWithHost("file name too long", linux.ENAMETOOLONG, unix.ENAMETOOLONG) + ErrNoLocksAvailable = newWithHost("no record locks available", linux.ENOLCK, unix.ENOLCK) + ErrInvalidSyscall = newWithHost("invalid system call number", linux.ENOSYS, unix.ENOSYS) + ErrDirNotEmpty = newWithHost("directory not empty", linux.ENOTEMPTY, unix.ENOTEMPTY) + ErrLinkLoop = newWithHost("too many symbolic links encountered", linux.ELOOP, unix.ELOOP) + ErrNoMessage = newWithHost("no message of desired type", linux.ENOMSG, unix.ENOMSG) + ErrIdentifierRemoved = newWithHost("identifier removed", linux.EIDRM, unix.EIDRM) + ErrChannelOutOfRange = newWithHost("channel number out of range", linux.ECHRNG, unix.ECHRNG) + ErrLevelTwoNotSynced = newWithHost("level 2 not synchronized", linux.EL2NSYNC, unix.EL2NSYNC) + ErrLevelThreeHalted = newWithHost("level 3 halted", linux.EL3HLT, unix.EL3HLT) + ErrLevelThreeReset = newWithHost("level 3 reset", linux.EL3RST, unix.EL3RST) + ErrLinkNumberOutOfRange = newWithHost("link number out of range", linux.ELNRNG, unix.ELNRNG) + ErrProtocolDriverNotAttached = newWithHost("protocol driver not attached", linux.EUNATCH, unix.EUNATCH) + ErrNoCSIAvailable = newWithHost("no CSI structure available", linux.ENOCSI, unix.ENOCSI) + ErrLevelTwoHalted = newWithHost("level 2 halted", linux.EL2HLT, unix.EL2HLT) + ErrInvalidExchange = newWithHost("invalid exchange", linux.EBADE, unix.EBADE) + ErrInvalidRequestDescriptor = newWithHost("invalid request descriptor", linux.EBADR, unix.EBADR) + ErrExchangeFull = newWithHost("exchange full", linux.EXFULL, unix.EXFULL) + ErrNoAnode = newWithHost("no anode", linux.ENOANO, unix.ENOANO) + ErrInvalidRequestCode = newWithHost("invalid request code", linux.EBADRQC, unix.EBADRQC) + ErrInvalidSlot = newWithHost("invalid slot", linux.EBADSLT, unix.EBADSLT) + ErrBadFontFile = newWithHost("bad font file format", linux.EBFONT, unix.EBFONT) + ErrNotStream = newWithHost("device not a stream", linux.ENOSTR, unix.ENOSTR) + ErrNoDataAvailable = newWithHost("no data available", linux.ENODATA, unix.ENODATA) + ErrTimerExpired = newWithHost("timer expired", linux.ETIME, unix.ETIME) + ErrStreamsResourceDepleted = newWithHost("out of streams resources", linux.ENOSR, unix.ENOSR) + ErrMachineNotOnNetwork = newWithHost("machine is not on the network", linux.ENONET, unix.ENONET) + ErrPackageNotInstalled = newWithHost("package not installed", linux.ENOPKG, unix.ENOPKG) + ErrIsRemote = newWithHost("object is remote", linux.EREMOTE, unix.EREMOTE) + ErrNoLink = newWithHost("link has been severed", linux.ENOLINK, unix.ENOLINK) + ErrAdvertise = newWithHost("advertise error", linux.EADV, unix.EADV) + ErrSRMount = newWithHost("srmount error", linux.ESRMNT, unix.ESRMNT) + ErrSendCommunication = newWithHost("communication error on send", linux.ECOMM, unix.ECOMM) + ErrProtocol = newWithHost("protocol error", linux.EPROTO, unix.EPROTO) + ErrMultihopAttempted = newWithHost("multihop attempted", linux.EMULTIHOP, unix.EMULTIHOP) + ErrRFS = newWithHost("RFS specific error", linux.EDOTDOT, unix.EDOTDOT) + ErrInvalidDataMessage = newWithHost("not a data message", linux.EBADMSG, unix.EBADMSG) + ErrOverflow = newWithHost("value too large for defined data type", linux.EOVERFLOW, unix.EOVERFLOW) + ErrNetworkNameNotUnique = newWithHost("name not unique on network", linux.ENOTUNIQ, unix.ENOTUNIQ) + ErrFDInBadState = newWithHost("file descriptor in bad state", linux.EBADFD, unix.EBADFD) + ErrRemoteAddressChanged = newWithHost("remote address changed", linux.EREMCHG, unix.EREMCHG) + ErrSharedLibraryInaccessible = newWithHost("can not access a needed shared library", linux.ELIBACC, unix.ELIBACC) + ErrCorruptedSharedLibrary = newWithHost("accessing a corrupted shared library", linux.ELIBBAD, unix.ELIBBAD) + ErrLibSectionCorrupted = newWithHost(".lib section in a.out corrupted", linux.ELIBSCN, unix.ELIBSCN) + ErrTooManySharedLibraries = newWithHost("attempting to link in too many shared libraries", linux.ELIBMAX, unix.ELIBMAX) + ErrSharedLibraryExeced = newWithHost("cannot exec a shared library directly", linux.ELIBEXEC, unix.ELIBEXEC) + ErrIllegalByteSequence = newWithHost("illegal byte sequence", linux.EILSEQ, unix.EILSEQ) + ErrShouldRestart = newWithHost("interrupted system call should be restarted", linux.ERESTART, unix.ERESTART) + ErrStreamPipe = newWithHost("streams pipe error", linux.ESTRPIPE, unix.ESTRPIPE) + ErrTooManyUsers = newWithHost("too many users", linux.EUSERS, unix.EUSERS) + ErrNotASocket = newWithHost("socket operation on non-socket", linux.ENOTSOCK, unix.ENOTSOCK) + ErrDestinationAddressRequired = newWithHost("destination address required", linux.EDESTADDRREQ, unix.EDESTADDRREQ) + ErrMessageTooLong = newWithHost("message too long", linux.EMSGSIZE, unix.EMSGSIZE) + ErrWrongProtocolForSocket = newWithHost("protocol wrong type for socket", linux.EPROTOTYPE, unix.EPROTOTYPE) + ErrProtocolNotAvailable = newWithHost("protocol not available", linux.ENOPROTOOPT, unix.ENOPROTOOPT) + ErrProtocolNotSupported = newWithHost("protocol not supported", linux.EPROTONOSUPPORT, unix.EPROTONOSUPPORT) + ErrSocketNotSupported = newWithHost("socket type not supported", linux.ESOCKTNOSUPPORT, unix.ESOCKTNOSUPPORT) + ErrEndpointOperation = newWithHost("operation not supported on transport endpoint", linux.EOPNOTSUPP, unix.EOPNOTSUPP) + ErrProtocolFamilyNotSupported = newWithHost("protocol family not supported", linux.EPFNOSUPPORT, unix.EPFNOSUPPORT) + ErrAddressFamilyNotSupported = newWithHost("address family not supported by protocol", linux.EAFNOSUPPORT, unix.EAFNOSUPPORT) + ErrAddressInUse = newWithHost("address already in use", linux.EADDRINUSE, unix.EADDRINUSE) + ErrAddressNotAvailable = newWithHost("cannot assign requested address", linux.EADDRNOTAVAIL, unix.EADDRNOTAVAIL) + ErrNetworkDown = newWithHost("network is down", linux.ENETDOWN, unix.ENETDOWN) + ErrNetworkUnreachable = newWithHost("network is unreachable", linux.ENETUNREACH, unix.ENETUNREACH) + ErrNetworkReset = newWithHost("network dropped connection because of reset", linux.ENETRESET, unix.ENETRESET) + ErrConnectionAborted = newWithHost("software caused connection abort", linux.ECONNABORTED, unix.ECONNABORTED) + ErrConnectionReset = newWithHost("connection reset by peer", linux.ECONNRESET, unix.ECONNRESET) + ErrNoBufferSpace = newWithHost("no buffer space available", linux.ENOBUFS, unix.ENOBUFS) + ErrAlreadyConnected = newWithHost("transport endpoint is already connected", linux.EISCONN, unix.EISCONN) + ErrNotConnected = newWithHost("transport endpoint is not connected", linux.ENOTCONN, unix.ENOTCONN) + ErrShutdown = newWithHost("cannot send after transport endpoint shutdown", linux.ESHUTDOWN, unix.ESHUTDOWN) + ErrTooManyRefs = newWithHost("too many references: cannot splice", linux.ETOOMANYREFS, unix.ETOOMANYREFS) + ErrTimedOut = newWithHost("connection timed out", linux.ETIMEDOUT, unix.ETIMEDOUT) + ErrConnectionRefused = newWithHost("connection refused", linux.ECONNREFUSED, unix.ECONNREFUSED) + ErrHostDown = newWithHost("host is down", linux.EHOSTDOWN, unix.EHOSTDOWN) + ErrNoRoute = newWithHost("no route to host", linux.EHOSTUNREACH, unix.EHOSTUNREACH) + ErrAlreadyInProgress = newWithHost("operation already in progress", linux.EALREADY, unix.EALREADY) + ErrInProgress = newWithHost("operation now in progress", linux.EINPROGRESS, unix.EINPROGRESS) + ErrStaleFileHandle = newWithHost("stale file handle", linux.ESTALE, unix.ESTALE) + ErrStructureNeedsCleaning = newWithHost("structure needs cleaning", linux.EUCLEAN, unix.EUCLEAN) + ErrIsNamedFile = newWithHost("is a named type file", linux.ENOTNAM, unix.ENOTNAM) + ErrRemoteIO = newWithHost("remote I/O error", linux.EREMOTEIO, unix.EREMOTEIO) + ErrQuotaExceeded = newWithHost("quota exceeded", linux.EDQUOT, unix.EDQUOT) + ErrNoMedium = newWithHost("no medium found", linux.ENOMEDIUM, unix.ENOMEDIUM) + ErrWrongMediumType = newWithHost("wrong medium type", linux.EMEDIUMTYPE, unix.EMEDIUMTYPE) + ErrCanceled = newWithHost("operation canceled", linux.ECANCELED, unix.ECANCELED) + ErrNoKey = newWithHost("required key not available", linux.ENOKEY, unix.ENOKEY) + ErrKeyExpired = newWithHost("key has expired", linux.EKEYEXPIRED, unix.EKEYEXPIRED) + ErrKeyRevoked = newWithHost("key has been revoked", linux.EKEYREVOKED, unix.EKEYREVOKED) + ErrKeyRejected = newWithHost("key was rejected by service", linux.EKEYREJECTED, unix.EKEYREJECTED) + ErrOwnerDied = newWithHost("owner died", linux.EOWNERDEAD, unix.EOWNERDEAD) + ErrNotRecoverable = newWithHost("state not recoverable", linux.ENOTRECOVERABLE, unix.ENOTRECOVERABLE) // ErrWouldBlock translates to EWOULDBLOCK which is the same as EAGAIN // on Linux. @@ -283,7 +283,7 @@ func FromError(err error) *Error { if err == nil { return nil } - if errno, ok := err.(syscall.Errno); ok { + if errno, ok := err.(unix.Errno); ok { return FromHost(errno) } if errno, ok := syserror.TranslateError(err); ok { |