summaryrefslogtreecommitdiffhomepage
path: root/pkg/usermem/usermem.go
diff options
context:
space:
mode:
Diffstat (limited to 'pkg/usermem/usermem.go')
-rw-r--r--pkg/usermem/usermem.go17
1 files changed, 8 insertions, 9 deletions
diff --git a/pkg/usermem/usermem.go b/pkg/usermem/usermem.go
index 0d6d25e50..cde1038ed 100644
--- a/pkg/usermem/usermem.go
+++ b/pkg/usermem/usermem.go
@@ -22,11 +22,10 @@ import (
"strconv"
"gvisor.dev/gvisor/pkg/context"
+ "gvisor.dev/gvisor/pkg/errors/linuxerr"
"gvisor.dev/gvisor/pkg/gohacks"
- "gvisor.dev/gvisor/pkg/safemem"
- "gvisor.dev/gvisor/pkg/syserror"
-
"gvisor.dev/gvisor/pkg/hostarch"
+ "gvisor.dev/gvisor/pkg/safemem"
)
// IO provides access to the contents of a virtual memory space.
@@ -163,7 +162,7 @@ func (rw *IOReadWriter) Read(dst []byte) (int, error) {
// Disallow wraparound.
rw.Addr = ^hostarch.Addr(0)
if err != nil {
- err = syserror.EFAULT
+ err = linuxerr.EFAULT
}
}
return n, err
@@ -179,7 +178,7 @@ func (rw *IOReadWriter) Write(src []byte) (int, error) {
// Disallow wraparound.
rw.Addr = ^hostarch.Addr(0)
if err != nil {
- err = syserror.EFAULT
+ err = linuxerr.EFAULT
}
}
return n, err
@@ -214,7 +213,7 @@ func CopyStringIn(ctx context.Context, uio IO, addr hostarch.Addr, maxlen int, o
}
end, ok := addr.AddLength(uint64(readlen))
if !ok {
- return gohacks.StringFromImmutableBytes(buf[:done]), syserror.EFAULT
+ return gohacks.StringFromImmutableBytes(buf[:done]), linuxerr.EFAULT
}
// Shorten the read to avoid crossing page boundaries, since faulting
// in a page unnecessarily is expensive. This also ensures that partial
@@ -244,7 +243,7 @@ func CopyStringIn(ctx context.Context, uio IO, addr hostarch.Addr, maxlen int, o
}
addr = end
}
- return gohacks.StringFromImmutableBytes(buf), syserror.ENAMETOOLONG
+ return gohacks.StringFromImmutableBytes(buf), linuxerr.ENAMETOOLONG
}
// CopyOutVec copies bytes from src to the memory mapped at ars in uio. The
@@ -382,7 +381,7 @@ func CopyInt32StringsInVec(ctx context.Context, uio IO, ars hostarch.AddrRangeSe
// Parse a single value.
val, err := strconv.ParseInt(string(buf[i:nextI]), 10, 32)
if err != nil {
- return int64(i), syserror.EINVAL
+ return int64(i), linuxerr.EINVAL
}
dsts[j] = int32(val)
@@ -398,7 +397,7 @@ func CopyInt32StringsInVec(ctx context.Context, uio IO, ars hostarch.AddrRangeSe
return int64(i), cperr
}
if j == 0 {
- return int64(i), syserror.EINVAL
+ return int64(i), linuxerr.EINVAL
}
return int64(i), nil
}