summaryrefslogtreecommitdiffhomepage
path: root/pkg/errors/linuxerr
diff options
context:
space:
mode:
authorgVisor bot <gvisor-bot@google.com>2021-08-12 22:24:49 +0000
committergVisor bot <gvisor-bot@google.com>2021-08-12 22:24:49 +0000
commit1e598212a50aa7bee03a47cf6c5f3b23254d64ab (patch)
treea607ab35c75071350bf9b948e53c1fdac18fe1cf /pkg/errors/linuxerr
parent05406ffb7547dbe3734450bfbdfb1c271d7867f2 (diff)
parent02370bbd315d7e7c2783d7001d014870cf1ef534 (diff)
Merge release-20210806.0-21-g02370bbd3 (automated)
Diffstat (limited to 'pkg/errors/linuxerr')
-rw-r--r--pkg/errors/linuxerr/linuxerr.go8
1 files changed, 7 insertions, 1 deletions
diff --git a/pkg/errors/linuxerr/linuxerr.go b/pkg/errors/linuxerr/linuxerr.go
index f9f8412e0..5905ef593 100644
--- a/pkg/errors/linuxerr/linuxerr.go
+++ b/pkg/errors/linuxerr/linuxerr.go
@@ -27,6 +27,12 @@ import (
const maxErrno uint32 = errno.EHWPOISON + 1
+// The following errors are semantically identical to Errno of type unix.Errno
+// or sycall.Errno. However, since the type are distinct ( these are
+// *errors.Error), they are not directly comperable. However, the Errno method
+// returns an Errno number such that the error can be compared to unix/syscall.Errno
+// (e.g. unix.Errno(EPERM.Errno()) == unix.EPERM is true). Converting unix/syscall.Errno
+// to the errors should be done via the lookup methods provided.
var (
NOERROR = errors.New(errno.NOERRNO, "not an error")
EPERM = errors.New(errno.EPERM, "operation not permitted")
@@ -177,7 +183,7 @@ var (
var errNotValidError = errors.New(errno.Errno(maxErrno), "not a valid error")
// The following errorSlice holds errors by errno for fast translation between
-// errnos (especially uint32(sycall.Errno)) and *Error.
+// errnos (especially uint32(sycall.Errno)) and *errors.Error.
var errorSlice = []*errors.Error{
// Errno values from include/uapi/asm-generic/errno-base.h.
errno.NOERRNO: NOERROR,