summaryrefslogtreecommitdiffhomepage
path: root/pkg/syserr
diff options
context:
space:
mode:
authorZach Koopmans <zkoopmans@google.com>2021-06-22 15:50:41 -0700
committergVisor bot <gvisor-bot@google.com>2021-06-22 15:53:32 -0700
commite1dc1c78e7a523fc64ca28bed60a9a40ea1de46a (patch)
treea8679f27d3a333ed79f5620ba8109985cbcdcf4e /pkg/syserr
parent01bcd55c3ad3b6c3bc0179a13e5f0045fa3707b7 (diff)
[syserror] Add conversions to linuxerr with temporary Equals method.
Add Equals method to compare syserror and unix.Errno errors to linuxerr errors. This will facilitate removal of syserror definitions in a followup, and finding needed conversions from unix.Errno to linuxerr. PiperOrigin-RevId: 380909667
Diffstat (limited to 'pkg/syserr')
-rw-r--r--pkg/syserr/BUILD1
-rw-r--r--pkg/syserr/syserr.go3
2 files changed, 3 insertions, 1 deletions
diff --git a/pkg/syserr/BUILD b/pkg/syserr/BUILD
index 7b3160309..5205fa7e4 100644
--- a/pkg/syserr/BUILD
+++ b/pkg/syserr/BUILD
@@ -12,6 +12,7 @@ go_library(
visibility = ["//visibility:public"],
deps = [
"//pkg/abi/linux/errno",
+ "//pkg/errors/linuxerr",
"//pkg/syserror",
"//pkg/tcpip",
"@org_golang_x_sys//unix:go_default_library",
diff --git a/pkg/syserr/syserr.go b/pkg/syserr/syserr.go
index fb77ac8bd..7d0a5125b 100644
--- a/pkg/syserr/syserr.go
+++ b/pkg/syserr/syserr.go
@@ -22,6 +22,7 @@ import (
"golang.org/x/sys/unix"
"gvisor.dev/gvisor/pkg/abi/linux/errno"
+ "gvisor.dev/gvisor/pkg/errors/linuxerr"
"gvisor.dev/gvisor/pkg/syserror"
)
@@ -54,7 +55,7 @@ func New(message string, linuxTranslation errno.Errno) *Error {
// enables proper blocking semantics. This should temporary address the
// class of blocking bugs that keep popping up with the current state of
// the error space.
- if e == syserror.EWOULDBLOCK {
+ if err.errno == linuxerr.EWOULDBLOCK.Errno() {
e = syserror.ErrWouldBlock
}
linuxBackwardsTranslations[err.errno] = linuxBackwardsTranslation{err: e, ok: true}