summaryrefslogtreecommitdiffhomepage
path: root/pkg/p9
diff options
context:
space:
mode:
Diffstat (limited to 'pkg/p9')
-rw-r--r--pkg/p9/client.go15
-rw-r--r--pkg/p9/client_file.go78
-rw-r--r--pkg/p9/file.go13
-rw-r--r--pkg/p9/handlers.go210
-rw-r--r--pkg/p9/server.go8
-rw-r--r--pkg/p9/transport.go6
-rw-r--r--pkg/p9/transport_flipcall.go4
7 files changed, 166 insertions, 168 deletions
diff --git a/pkg/p9/client.go b/pkg/p9/client.go
index 3f4324ac1..764f1f970 100644
--- a/pkg/p9/client.go
+++ b/pkg/p9/client.go
@@ -17,7 +17,6 @@ package p9
import (
"errors"
"fmt"
- "syscall"
"golang.org/x/sys/unix"
"gvisor.dev/gvisor/pkg/flipcall"
@@ -180,7 +179,7 @@ func NewClient(socket *unet.Socket, messageSize uint32, version string) (*Client
}, &rversion)
// The server told us to try again with a lower version.
- if err == syscall.EAGAIN {
+ if err == unix.EAGAIN {
if requested == lowestSupportedVersion {
return nil, ErrVersionsExhausted
}
@@ -250,7 +249,7 @@ func (c *Client) watch(socket *unet.Socket) {
// Wait for a shutdown event.
for {
n, err := unix.Ppoll(events, nil, nil)
- if err == syscall.EINTR || err == syscall.EAGAIN {
+ if err == unix.EINTR || err == unix.EAGAIN {
continue
}
if err != nil {
@@ -437,7 +436,7 @@ func (c *Client) sendRecvLegacySyscallErr(t message, r message) error {
received, err := c.sendRecvLegacy(t, r)
if !received {
log.Warningf("p9.Client.sendRecvChannel: %v", err)
- return syscall.EIO
+ return unix.EIO
}
return err
}
@@ -485,7 +484,7 @@ func (c *Client) sendRecvLegacy(t message, r message) (bool, error) {
// For convenience, we transform these directly
// into errors. Handlers need not handle this case.
if rlerr, ok := resp.r.(*Rlerror); ok {
- return true, syscall.Errno(rlerr.Error)
+ return true, unix.Errno(rlerr.Error)
}
// At this point, we know it matches.
@@ -524,7 +523,7 @@ func (c *Client) sendRecvChannel(t message, r message) error {
// Map all transport errors to EIO, but ensure that the real error
// is logged.
log.Warningf("p9.Client.sendRecvChannel: flipcall.Endpoint.Connect: %v", err)
- return syscall.EIO
+ return unix.EIO
}
}
@@ -537,14 +536,14 @@ func (c *Client) sendRecvChannel(t message, r message) error {
c.channelsMu.Unlock()
c.channelsWg.Done()
log.Warningf("p9.Client.sendRecvChannel: p9.channel.send: %v", err)
- return syscall.EIO
+ return unix.EIO
}
// Parse the server's response.
resp, retErr := ch.recv(r, rsz)
if resp == nil {
log.Warningf("p9.Client.sendRecvChannel: p9.channel.recv: %v", retErr)
- retErr = syscall.EIO
+ retErr = unix.EIO
}
// Release the channel.
diff --git a/pkg/p9/client_file.go b/pkg/p9/client_file.go
index 8b46a2987..7abc82e1b 100644
--- a/pkg/p9/client_file.go
+++ b/pkg/p9/client_file.go
@@ -18,8 +18,8 @@ import (
"fmt"
"io"
"sync/atomic"
- "syscall"
+ "golang.org/x/sys/unix"
"gvisor.dev/gvisor/pkg/fd"
"gvisor.dev/gvisor/pkg/log"
)
@@ -69,7 +69,7 @@ type clientFile struct {
// Walk implements File.Walk.
func (c *clientFile) Walk(names []string) ([]QID, File, error) {
if atomic.LoadUint32(&c.closed) != 0 {
- return nil, nil, syscall.EBADF
+ return nil, nil, unix.EBADF
}
fid, ok := c.client.fidPool.Get()
@@ -90,7 +90,7 @@ func (c *clientFile) Walk(names []string) ([]QID, File, error) {
// WalkGetAttr implements File.WalkGetAttr.
func (c *clientFile) WalkGetAttr(components []string) ([]QID, File, AttrMask, Attr, error) {
if atomic.LoadUint32(&c.closed) != 0 {
- return nil, nil, AttrMask{}, Attr{}, syscall.EBADF
+ return nil, nil, AttrMask{}, Attr{}, unix.EBADF
}
if !versionSupportsTwalkgetattr(c.client.version) {
@@ -124,7 +124,7 @@ func (c *clientFile) WalkGetAttr(components []string) ([]QID, File, AttrMask, At
// StatFS implements File.StatFS.
func (c *clientFile) StatFS() (FSStat, error) {
if atomic.LoadUint32(&c.closed) != 0 {
- return FSStat{}, syscall.EBADF
+ return FSStat{}, unix.EBADF
}
rstatfs := Rstatfs{}
@@ -138,7 +138,7 @@ func (c *clientFile) StatFS() (FSStat, error) {
// FSync implements File.FSync.
func (c *clientFile) FSync() error {
if atomic.LoadUint32(&c.closed) != 0 {
- return syscall.EBADF
+ return unix.EBADF
}
return c.client.sendRecv(&Tfsync{FID: c.fid}, &Rfsync{})
@@ -147,7 +147,7 @@ func (c *clientFile) FSync() error {
// GetAttr implements File.GetAttr.
func (c *clientFile) GetAttr(req AttrMask) (QID, AttrMask, Attr, error) {
if atomic.LoadUint32(&c.closed) != 0 {
- return QID{}, AttrMask{}, Attr{}, syscall.EBADF
+ return QID{}, AttrMask{}, Attr{}, unix.EBADF
}
rgetattr := Rgetattr{}
@@ -161,7 +161,7 @@ func (c *clientFile) GetAttr(req AttrMask) (QID, AttrMask, Attr, error) {
// SetAttr implements File.SetAttr.
func (c *clientFile) SetAttr(valid SetAttrMask, attr SetAttr) error {
if atomic.LoadUint32(&c.closed) != 0 {
- return syscall.EBADF
+ return unix.EBADF
}
return c.client.sendRecv(&Tsetattr{FID: c.fid, Valid: valid, SetAttr: attr}, &Rsetattr{})
@@ -170,10 +170,10 @@ func (c *clientFile) SetAttr(valid SetAttrMask, attr SetAttr) error {
// GetXattr implements File.GetXattr.
func (c *clientFile) GetXattr(name string, size uint64) (string, error) {
if atomic.LoadUint32(&c.closed) != 0 {
- return "", syscall.EBADF
+ return "", unix.EBADF
}
if !versionSupportsGetSetXattr(c.client.version) {
- return "", syscall.EOPNOTSUPP
+ return "", unix.EOPNOTSUPP
}
rgetxattr := Rgetxattr{}
@@ -187,10 +187,10 @@ func (c *clientFile) GetXattr(name string, size uint64) (string, error) {
// SetXattr implements File.SetXattr.
func (c *clientFile) SetXattr(name, value string, flags uint32) error {
if atomic.LoadUint32(&c.closed) != 0 {
- return syscall.EBADF
+ return unix.EBADF
}
if !versionSupportsGetSetXattr(c.client.version) {
- return syscall.EOPNOTSUPP
+ return unix.EOPNOTSUPP
}
return c.client.sendRecv(&Tsetxattr{FID: c.fid, Name: name, Value: value, Flags: flags}, &Rsetxattr{})
@@ -199,10 +199,10 @@ func (c *clientFile) SetXattr(name, value string, flags uint32) error {
// ListXattr implements File.ListXattr.
func (c *clientFile) ListXattr(size uint64) (map[string]struct{}, error) {
if atomic.LoadUint32(&c.closed) != 0 {
- return nil, syscall.EBADF
+ return nil, unix.EBADF
}
if !versionSupportsListRemoveXattr(c.client.version) {
- return nil, syscall.EOPNOTSUPP
+ return nil, unix.EOPNOTSUPP
}
rlistxattr := Rlistxattr{}
@@ -220,10 +220,10 @@ func (c *clientFile) ListXattr(size uint64) (map[string]struct{}, error) {
// RemoveXattr implements File.RemoveXattr.
func (c *clientFile) RemoveXattr(name string) error {
if atomic.LoadUint32(&c.closed) != 0 {
- return syscall.EBADF
+ return unix.EBADF
}
if !versionSupportsListRemoveXattr(c.client.version) {
- return syscall.EOPNOTSUPP
+ return unix.EOPNOTSUPP
}
return c.client.sendRecv(&Tremovexattr{FID: c.fid, Name: name}, &Rremovexattr{})
@@ -232,10 +232,10 @@ func (c *clientFile) RemoveXattr(name string) error {
// Allocate implements File.Allocate.
func (c *clientFile) Allocate(mode AllocateMode, offset, length uint64) error {
if atomic.LoadUint32(&c.closed) != 0 {
- return syscall.EBADF
+ return unix.EBADF
}
if !versionSupportsTallocate(c.client.version) {
- return syscall.EOPNOTSUPP
+ return unix.EOPNOTSUPP
}
return c.client.sendRecv(&Tallocate{FID: c.fid, Mode: mode, Offset: offset, Length: length}, &Rallocate{})
@@ -248,7 +248,7 @@ func (c *clientFile) Allocate(mode AllocateMode, offset, length uint64) error {
func (c *clientFile) Remove() error {
// Avoid double close.
if !atomic.CompareAndSwapUint32(&c.closed, 0, 1) {
- return syscall.EBADF
+ return unix.EBADF
}
// Send the remove message.
@@ -269,7 +269,7 @@ func (c *clientFile) Remove() error {
func (c *clientFile) Close() error {
// Avoid double close.
if !atomic.CompareAndSwapUint32(&c.closed, 0, 1) {
- return syscall.EBADF
+ return unix.EBADF
}
// Send the close message.
@@ -302,7 +302,7 @@ func (c *clientFile) SetAttrClose(valid SetAttrMask, attr SetAttr) error {
// Avoid double close.
if !atomic.CompareAndSwapUint32(&c.closed, 0, 1) {
- return syscall.EBADF
+ return unix.EBADF
}
// Send the message.
@@ -321,7 +321,7 @@ func (c *clientFile) SetAttrClose(valid SetAttrMask, attr SetAttr) error {
// Open implements File.Open.
func (c *clientFile) Open(flags OpenFlags) (*fd.FD, QID, uint32, error) {
if atomic.LoadUint32(&c.closed) != 0 {
- return nil, QID{}, 0, syscall.EBADF
+ return nil, QID{}, 0, unix.EBADF
}
rlopen := Rlopen{}
@@ -335,11 +335,11 @@ func (c *clientFile) Open(flags OpenFlags) (*fd.FD, QID, uint32, error) {
// Connect implements File.Connect.
func (c *clientFile) Connect(flags ConnectFlags) (*fd.FD, error) {
if atomic.LoadUint32(&c.closed) != 0 {
- return nil, syscall.EBADF
+ return nil, unix.EBADF
}
if !VersionSupportsConnect(c.client.version) {
- return nil, syscall.ECONNREFUSED
+ return nil, unix.ECONNREFUSED
}
rlconnect := Rlconnect{}
@@ -404,7 +404,7 @@ func (c *clientFile) ReadAt(p []byte, offset uint64) (int, error) {
func (c *clientFile) readAt(p []byte, offset uint64) (int, error) {
if atomic.LoadUint32(&c.closed) != 0 {
- return 0, syscall.EBADF
+ return 0, unix.EBADF
}
rread := Rread{Data: p}
@@ -435,7 +435,7 @@ func (c *clientFile) WriteAt(p []byte, offset uint64) (int, error) {
func (c *clientFile) writeAt(p []byte, offset uint64) (int, error) {
if atomic.LoadUint32(&c.closed) != 0 {
- return 0, syscall.EBADF
+ return 0, unix.EBADF
}
rwrite := Rwrite{}
@@ -500,12 +500,12 @@ func (r *ReadWriterFile) WriteAt(p []byte, offset int64) (int, error) {
// Rename implements File.Rename.
func (c *clientFile) Rename(dir File, name string) error {
if atomic.LoadUint32(&c.closed) != 0 {
- return syscall.EBADF
+ return unix.EBADF
}
clientDir, ok := dir.(*clientFile)
if !ok {
- return syscall.EBADF
+ return unix.EBADF
}
return c.client.sendRecv(&Trename{FID: c.fid, Directory: clientDir.fid, Name: name}, &Rrename{})
@@ -514,7 +514,7 @@ func (c *clientFile) Rename(dir File, name string) error {
// Create implements File.Create.
func (c *clientFile) Create(name string, openFlags OpenFlags, permissions FileMode, uid UID, gid GID) (*fd.FD, File, QID, uint32, error) {
if atomic.LoadUint32(&c.closed) != 0 {
- return nil, nil, QID{}, 0, syscall.EBADF
+ return nil, nil, QID{}, 0, unix.EBADF
}
msg := Tlcreate{
@@ -545,7 +545,7 @@ func (c *clientFile) Create(name string, openFlags OpenFlags, permissions FileMo
// Mkdir implements File.Mkdir.
func (c *clientFile) Mkdir(name string, permissions FileMode, uid UID, gid GID) (QID, error) {
if atomic.LoadUint32(&c.closed) != 0 {
- return QID{}, syscall.EBADF
+ return QID{}, unix.EBADF
}
msg := Tmkdir{
@@ -575,7 +575,7 @@ func (c *clientFile) Mkdir(name string, permissions FileMode, uid UID, gid GID)
// Symlink implements File.Symlink.
func (c *clientFile) Symlink(oldname string, newname string, uid UID, gid GID) (QID, error) {
if atomic.LoadUint32(&c.closed) != 0 {
- return QID{}, syscall.EBADF
+ return QID{}, unix.EBADF
}
msg := Tsymlink{
@@ -605,12 +605,12 @@ func (c *clientFile) Symlink(oldname string, newname string, uid UID, gid GID) (
// Link implements File.Link.
func (c *clientFile) Link(target File, newname string) error {
if atomic.LoadUint32(&c.closed) != 0 {
- return syscall.EBADF
+ return unix.EBADF
}
targetFile, ok := target.(*clientFile)
if !ok {
- return syscall.EBADF
+ return unix.EBADF
}
return c.client.sendRecv(&Tlink{Directory: c.fid, Name: newname, Target: targetFile.fid}, &Rlink{})
@@ -619,7 +619,7 @@ func (c *clientFile) Link(target File, newname string) error {
// Mknod implements File.Mknod.
func (c *clientFile) Mknod(name string, mode FileMode, major uint32, minor uint32, uid UID, gid GID) (QID, error) {
if atomic.LoadUint32(&c.closed) != 0 {
- return QID{}, syscall.EBADF
+ return QID{}, unix.EBADF
}
msg := Tmknod{
@@ -651,12 +651,12 @@ func (c *clientFile) Mknod(name string, mode FileMode, major uint32, minor uint3
// RenameAt implements File.RenameAt.
func (c *clientFile) RenameAt(oldname string, newdir File, newname string) error {
if atomic.LoadUint32(&c.closed) != 0 {
- return syscall.EBADF
+ return unix.EBADF
}
clientNewDir, ok := newdir.(*clientFile)
if !ok {
- return syscall.EBADF
+ return unix.EBADF
}
return c.client.sendRecv(&Trenameat{OldDirectory: c.fid, OldName: oldname, NewDirectory: clientNewDir.fid, NewName: newname}, &Rrenameat{})
@@ -665,7 +665,7 @@ func (c *clientFile) RenameAt(oldname string, newdir File, newname string) error
// UnlinkAt implements File.UnlinkAt.
func (c *clientFile) UnlinkAt(name string, flags uint32) error {
if atomic.LoadUint32(&c.closed) != 0 {
- return syscall.EBADF
+ return unix.EBADF
}
return c.client.sendRecv(&Tunlinkat{Directory: c.fid, Name: name, Flags: flags}, &Runlinkat{})
@@ -674,7 +674,7 @@ func (c *clientFile) UnlinkAt(name string, flags uint32) error {
// Readdir implements File.Readdir.
func (c *clientFile) Readdir(offset uint64, count uint32) ([]Dirent, error) {
if atomic.LoadUint32(&c.closed) != 0 {
- return nil, syscall.EBADF
+ return nil, unix.EBADF
}
rreaddir := Rreaddir{}
@@ -688,7 +688,7 @@ func (c *clientFile) Readdir(offset uint64, count uint32) ([]Dirent, error) {
// Readlink implements File.Readlink.
func (c *clientFile) Readlink() (string, error) {
if atomic.LoadUint32(&c.closed) != 0 {
- return "", syscall.EBADF
+ return "", unix.EBADF
}
rreadlink := Rreadlink{}
@@ -702,7 +702,7 @@ func (c *clientFile) Readlink() (string, error) {
// Flush implements File.Flush.
func (c *clientFile) Flush() error {
if atomic.LoadUint32(&c.closed) != 0 {
- return syscall.EBADF
+ return unix.EBADF
}
if !VersionSupportsTflushf(c.client.version) {
diff --git a/pkg/p9/file.go b/pkg/p9/file.go
index c2e3a3f98..c59c6a65b 100644
--- a/pkg/p9/file.go
+++ b/pkg/p9/file.go
@@ -15,8 +15,7 @@
package p9
import (
- "syscall"
-
+ "golang.org/x/sys/unix"
"gvisor.dev/gvisor/pkg/fd"
)
@@ -67,7 +66,7 @@ type File interface {
// WalkGetAttr walks to the next file and returns its maximal set of
// attributes.
//
- // Server-side p9.Files may return syscall.ENOSYS to indicate that Walk
+ // Server-side p9.Files may return unix.ENOSYS to indicate that Walk
// and GetAttr should be used separately to satisfy this request.
//
// On the server, WalkGetAttr has a read concurrency guarantee.
@@ -160,7 +159,7 @@ type File interface {
// Read reads from this file. Open must be called first.
//
- // This may return io.EOF in addition to syscall.Errno values.
+ // This may return io.EOF in addition to unix.Errno values.
//
// On the server, ReadAt has a read concurrency guarantee. See Open for
// additional requirements regarding lazy path resolution.
@@ -168,7 +167,7 @@ type File interface {
// Write writes to this file. Open must be called first.
//
- // This may return io.EOF in addition to syscall.Errno values.
+ // This may return io.EOF in addition to unix.Errno values.
//
// On the server, WriteAt has a read concurrency guarantee. See Open
// for additional requirements regarding lazy path resolution.
@@ -239,7 +238,7 @@ type File interface {
// Readdir reads directory entries.
//
- // This may return io.EOF in addition to syscall.Errno values.
+ // This may return io.EOF in addition to unix.Errno values.
//
// On the server, Readdir has a read concurrency guarantee.
Readdir(offset uint64, count uint32) ([]Dirent, error)
@@ -292,7 +291,7 @@ type DefaultWalkGetAttr struct{}
// WalkGetAttr implements File.WalkGetAttr.
func (DefaultWalkGetAttr) WalkGetAttr([]string) ([]QID, File, AttrMask, Attr, error) {
- return nil, nil, AttrMask{}, Attr{}, syscall.ENOSYS
+ return nil, nil, AttrMask{}, Attr{}, unix.ENOSYS
}
// DisallowClientCalls panics if a client-only function is called.
diff --git a/pkg/p9/handlers.go b/pkg/p9/handlers.go
index 81ceb37c5..58312d0cc 100644
--- a/pkg/p9/handlers.go
+++ b/pkg/p9/handlers.go
@@ -21,28 +21,28 @@ import (
"path"
"strings"
"sync/atomic"
- "syscall"
+ "golang.org/x/sys/unix"
"gvisor.dev/gvisor/pkg/fd"
"gvisor.dev/gvisor/pkg/log"
)
-// ExtractErrno extracts a syscall.Errno from a error, best effort.
-func ExtractErrno(err error) syscall.Errno {
+// ExtractErrno extracts a unix.Errno from a error, best effort.
+func ExtractErrno(err error) unix.Errno {
switch err {
case os.ErrNotExist:
- return syscall.ENOENT
+ return unix.ENOENT
case os.ErrExist:
- return syscall.EEXIST
+ return unix.EEXIST
case os.ErrPermission:
- return syscall.EACCES
+ return unix.EACCES
case os.ErrInvalid:
- return syscall.EINVAL
+ return unix.EINVAL
}
// Attempt to unwrap.
switch e := err.(type) {
- case syscall.Errno:
+ case unix.Errno:
return e
case *os.PathError:
return ExtractErrno(e.Err)
@@ -54,7 +54,7 @@ func ExtractErrno(err error) syscall.Errno {
// Default case.
log.Warningf("unknown error: %v", err)
- return syscall.EIO
+ return unix.EIO
}
// newErr returns a new error message from an error.
@@ -77,20 +77,20 @@ type handler interface {
// handle implements handler.handle.
func (t *Tversion) handle(cs *connState) message {
if t.MSize == 0 {
- return newErr(syscall.EINVAL)
+ return newErr(unix.EINVAL)
}
if t.MSize > maximumLength {
- return newErr(syscall.EINVAL)
+ return newErr(unix.EINVAL)
}
atomic.StoreUint32(&cs.messageSize, t.MSize)
requested, ok := parseVersion(t.Version)
if !ok {
- return newErr(syscall.EINVAL)
+ return newErr(unix.EINVAL)
}
// The server cannot support newer versions that it doesn't know about. In this
// case we return EAGAIN to tell the client to try again with a lower version.
if requested > highestSupportedVersion {
- return newErr(syscall.EAGAIN)
+ return newErr(unix.EAGAIN)
}
// From Tversion(9P): "The server may respond with the client’s version
// string, or a version string identifying an earlier defined protocol version".
@@ -112,13 +112,13 @@ func checkSafeName(name string) error {
if name != "" && !strings.Contains(name, "/") && name != "." && name != ".." {
return nil
}
- return syscall.EINVAL
+ return unix.EINVAL
}
// handle implements handler.handle.
func (t *Tclunk) handle(cs *connState) message {
if !cs.DeleteFID(t.FID) {
- return newErr(syscall.EBADF)
+ return newErr(unix.EBADF)
}
return &Rclunk{}
}
@@ -126,7 +126,7 @@ func (t *Tclunk) handle(cs *connState) message {
func (t *Tsetattrclunk) handle(cs *connState) message {
ref, ok := cs.LookupFID(t.FID)
if !ok {
- return newErr(syscall.EBADF)
+ return newErr(unix.EBADF)
}
defer ref.DecRef()
@@ -136,7 +136,7 @@ func (t *Tsetattrclunk) handle(cs *connState) message {
// there were multiple links and you can still change the
// corresponding inode information.
if ref.isDeleted() {
- return syscall.EINVAL
+ return unix.EINVAL
}
// Set the attributes.
@@ -146,7 +146,7 @@ func (t *Tsetattrclunk) handle(cs *connState) message {
// Try to delete FID even in case of failure above. Since the state of the
// file is unknown to the caller, it will not attempt to close the file again.
if !cs.DeleteFID(t.FID) {
- return newErr(syscall.EBADF)
+ return newErr(unix.EBADF)
}
if setAttrErr != nil {
return newErr(setAttrErr)
@@ -158,7 +158,7 @@ func (t *Tsetattrclunk) handle(cs *connState) message {
func (t *Tremove) handle(cs *connState) message {
ref, ok := cs.LookupFID(t.FID)
if !ok {
- return newErr(syscall.EBADF)
+ return newErr(unix.EBADF)
}
defer ref.DecRef()
@@ -172,7 +172,7 @@ func (t *Tremove) handle(cs *connState) message {
err := ref.safelyGlobal(func() error {
// Is this a root? Can't remove that.
if ref.isRoot() {
- return syscall.EINVAL
+ return unix.EINVAL
}
// N.B. this remove operation is permitted, even if the file is open.
@@ -180,7 +180,7 @@ func (t *Tremove) handle(cs *connState) message {
// Is this file already deleted?
if ref.isDeleted() {
- return syscall.EINVAL
+ return unix.EINVAL
}
// Retrieve the file's proper name.
@@ -204,7 +204,7 @@ func (t *Tremove) handle(cs *connState) message {
// of removing the file if permissions allow."
// https://swtch.com/plan9port/man/man9/remove.html
if !cs.DeleteFID(t.FID) {
- return newErr(syscall.EBADF)
+ return newErr(unix.EBADF)
}
if err != nil {
return newErr(err)
@@ -217,14 +217,14 @@ func (t *Tremove) handle(cs *connState) message {
//
// We don't support authentication, so this just returns ENOSYS.
func (t *Tauth) handle(cs *connState) message {
- return newErr(syscall.ENOSYS)
+ return newErr(unix.ENOSYS)
}
// handle implements handler.handle.
func (t *Tattach) handle(cs *connState) message {
// Ensure no authentication FID is provided.
if t.Auth.AuthenticationFID != NoFID {
- return newErr(syscall.EINVAL)
+ return newErr(unix.EINVAL)
}
// Must provide an absolute path.
@@ -247,7 +247,7 @@ func (t *Tattach) handle(cs *connState) message {
}
if !valid.Mode {
sf.Close() // Drop file.
- return newErr(syscall.EINVAL)
+ return newErr(unix.EINVAL)
}
// Build a transient reference.
@@ -292,7 +292,7 @@ func CanOpen(mode FileMode) bool {
func (t *Tlopen) handle(cs *connState) message {
ref, ok := cs.LookupFID(t.FID)
if !ok {
- return newErr(syscall.EBADF)
+ return newErr(unix.EBADF)
}
defer ref.DecRef()
@@ -304,22 +304,22 @@ func (t *Tlopen) handle(cs *connState) message {
if err := ref.safelyRead(func() (err error) {
// Has it been deleted already?
if ref.isDeleted() {
- return syscall.EINVAL
+ return unix.EINVAL
}
// Has it been opened already?
if ref.opened || !CanOpen(ref.mode) {
- return syscall.EINVAL
+ return unix.EINVAL
}
if ref.mode.IsDir() {
// Directory must be opened ReadOnly.
if t.Flags&OpenFlagsModeMask != ReadOnly {
- return syscall.EISDIR
+ return unix.EISDIR
}
// Directory not truncatable.
if t.Flags&OpenTruncate != 0 {
- return syscall.EISDIR
+ return unix.EISDIR
}
}
@@ -345,7 +345,7 @@ func (t *Tlcreate) do(cs *connState, uid UID) (*Rlcreate, error) {
ref, ok := cs.LookupFID(t.FID)
if !ok {
- return nil, syscall.EBADF
+ return nil, unix.EBADF
}
defer ref.DecRef()
@@ -359,12 +359,12 @@ func (t *Tlcreate) do(cs *connState, uid UID) (*Rlcreate, error) {
if err := ref.safelyWrite(func() (err error) {
// Don't allow creation from non-directories or deleted directories.
if ref.isDeleted() || !ref.mode.IsDir() {
- return syscall.EINVAL
+ return unix.EINVAL
}
// Not allowed on open directories.
if ref.opened {
- return syscall.EINVAL
+ return unix.EINVAL
}
// Do the create.
@@ -422,7 +422,7 @@ func (t *Tsymlink) do(cs *connState, uid UID) (*Rsymlink, error) {
ref, ok := cs.LookupFID(t.Directory)
if !ok {
- return nil, syscall.EBADF
+ return nil, unix.EBADF
}
defer ref.DecRef()
@@ -430,12 +430,12 @@ func (t *Tsymlink) do(cs *connState, uid UID) (*Rsymlink, error) {
if err := ref.safelyWrite(func() (err error) {
// Don't allow symlinks from non-directories or deleted directories.
if ref.isDeleted() || !ref.mode.IsDir() {
- return syscall.EINVAL
+ return unix.EINVAL
}
// Not allowed on open directories.
if ref.opened {
- return syscall.EINVAL
+ return unix.EINVAL
}
// Do the symlink.
@@ -456,25 +456,25 @@ func (t *Tlink) handle(cs *connState) message {
ref, ok := cs.LookupFID(t.Directory)
if !ok {
- return newErr(syscall.EBADF)
+ return newErr(unix.EBADF)
}
defer ref.DecRef()
refTarget, ok := cs.LookupFID(t.Target)
if !ok {
- return newErr(syscall.EBADF)
+ return newErr(unix.EBADF)
}
defer refTarget.DecRef()
if err := ref.safelyWrite(func() (err error) {
// Don't allow create links from non-directories or deleted directories.
if ref.isDeleted() || !ref.mode.IsDir() {
- return syscall.EINVAL
+ return unix.EINVAL
}
// Not allowed on open directories.
if ref.opened {
- return syscall.EINVAL
+ return unix.EINVAL
}
// Do the link.
@@ -497,13 +497,13 @@ func (t *Trenameat) handle(cs *connState) message {
ref, ok := cs.LookupFID(t.OldDirectory)
if !ok {
- return newErr(syscall.EBADF)
+ return newErr(unix.EBADF)
}
defer ref.DecRef()
refTarget, ok := cs.LookupFID(t.NewDirectory)
if !ok {
- return newErr(syscall.EBADF)
+ return newErr(unix.EBADF)
}
defer refTarget.DecRef()
@@ -511,12 +511,12 @@ func (t *Trenameat) handle(cs *connState) message {
if err := ref.safelyGlobal(func() (err error) {
// Don't allow renaming across deleted directories.
if ref.isDeleted() || !ref.mode.IsDir() || refTarget.isDeleted() || !refTarget.mode.IsDir() {
- return syscall.EINVAL
+ return unix.EINVAL
}
// Not allowed on open directories.
if ref.opened {
- return syscall.EINVAL
+ return unix.EINVAL
}
// Is this the same file? If yes, short-circuit and return success.
@@ -547,19 +547,19 @@ func (t *Tunlinkat) handle(cs *connState) message {
ref, ok := cs.LookupFID(t.Directory)
if !ok {
- return newErr(syscall.EBADF)
+ return newErr(unix.EBADF)
}
defer ref.DecRef()
if err := ref.safelyWrite(func() (err error) {
// Don't allow deletion from non-directories or deleted directories.
if ref.isDeleted() || !ref.mode.IsDir() {
- return syscall.EINVAL
+ return unix.EINVAL
}
// Not allowed on open directories.
if ref.opened {
- return syscall.EINVAL
+ return unix.EINVAL
}
// Before we do the unlink itself, we need to ensure that there
@@ -599,25 +599,25 @@ func (t *Trename) handle(cs *connState) message {
ref, ok := cs.LookupFID(t.FID)
if !ok {
- return newErr(syscall.EBADF)
+ return newErr(unix.EBADF)
}
defer ref.DecRef()
refTarget, ok := cs.LookupFID(t.Directory)
if !ok {
- return newErr(syscall.EBADF)
+ return newErr(unix.EBADF)
}
defer refTarget.DecRef()
if err := ref.safelyGlobal(func() (err error) {
// Don't allow a root rename.
if ref.isRoot() {
- return syscall.EINVAL
+ return unix.EINVAL
}
// Don't allow renaming deleting entries, or target non-directories.
if ref.isDeleted() || refTarget.isDeleted() || !refTarget.mode.IsDir() {
- return syscall.EINVAL
+ return unix.EINVAL
}
// If the parent is deleted, but we not, something is seriously wrong.
@@ -656,7 +656,7 @@ func (t *Trename) handle(cs *connState) message {
func (t *Treadlink) handle(cs *connState) message {
ref, ok := cs.LookupFID(t.FID)
if !ok {
- return newErr(syscall.EBADF)
+ return newErr(unix.EBADF)
}
defer ref.DecRef()
@@ -666,7 +666,7 @@ func (t *Treadlink) handle(cs *connState) message {
// check if this file is opened because symlinks cannot be
// opened.
if ref.isDeleted() || !ref.mode.IsSymlink() {
- return syscall.EINVAL
+ return unix.EINVAL
}
// Do the read.
@@ -683,13 +683,13 @@ func (t *Treadlink) handle(cs *connState) message {
func (t *Tread) handle(cs *connState) message {
ref, ok := cs.LookupFID(t.FID)
if !ok {
- return newErr(syscall.EBADF)
+ return newErr(unix.EBADF)
}
defer ref.DecRef()
// Constrain the size of the read buffer.
if int(t.Count) > int(maximumLength) {
- return newErr(syscall.ENOBUFS)
+ return newErr(unix.ENOBUFS)
}
var (
@@ -699,12 +699,12 @@ func (t *Tread) handle(cs *connState) message {
if err := ref.safelyRead(func() (err error) {
// Has it been opened already?
if !ref.opened {
- return syscall.EINVAL
+ return unix.EINVAL
}
// Can it be read? Check permissions.
if ref.openFlags&OpenFlagsModeMask == WriteOnly {
- return syscall.EPERM
+ return unix.EPERM
}
n, err = ref.file.ReadAt(data, t.Offset)
@@ -720,7 +720,7 @@ func (t *Tread) handle(cs *connState) message {
func (t *Twrite) handle(cs *connState) message {
ref, ok := cs.LookupFID(t.FID)
if !ok {
- return newErr(syscall.EBADF)
+ return newErr(unix.EBADF)
}
defer ref.DecRef()
@@ -728,12 +728,12 @@ func (t *Twrite) handle(cs *connState) message {
if err := ref.safelyRead(func() (err error) {
// Has it been opened already?
if !ref.opened {
- return syscall.EINVAL
+ return unix.EINVAL
}
// Can it be written? Check permissions.
if ref.openFlags&OpenFlagsModeMask == ReadOnly {
- return syscall.EPERM
+ return unix.EPERM
}
n, err = ref.file.WriteAt(t.Data, t.Offset)
@@ -761,7 +761,7 @@ func (t *Tmknod) do(cs *connState, uid UID) (*Rmknod, error) {
ref, ok := cs.LookupFID(t.Directory)
if !ok {
- return nil, syscall.EBADF
+ return nil, unix.EBADF
}
defer ref.DecRef()
@@ -769,12 +769,12 @@ func (t *Tmknod) do(cs *connState, uid UID) (*Rmknod, error) {
if err := ref.safelyWrite(func() (err error) {
// Don't allow mknod on deleted files.
if ref.isDeleted() || !ref.mode.IsDir() {
- return syscall.EINVAL
+ return unix.EINVAL
}
// Not allowed on open directories.
if ref.opened {
- return syscall.EINVAL
+ return unix.EINVAL
}
// Do the mknod.
@@ -803,7 +803,7 @@ func (t *Tmkdir) do(cs *connState, uid UID) (*Rmkdir, error) {
ref, ok := cs.LookupFID(t.Directory)
if !ok {
- return nil, syscall.EBADF
+ return nil, unix.EBADF
}
defer ref.DecRef()
@@ -811,12 +811,12 @@ func (t *Tmkdir) do(cs *connState, uid UID) (*Rmkdir, error) {
if err := ref.safelyWrite(func() (err error) {
// Don't allow mkdir on deleted files.
if ref.isDeleted() || !ref.mode.IsDir() {
- return syscall.EINVAL
+ return unix.EINVAL
}
// Not allowed on open directories.
if ref.opened {
- return syscall.EINVAL
+ return unix.EINVAL
}
// Do the mkdir.
@@ -833,7 +833,7 @@ func (t *Tmkdir) do(cs *connState, uid UID) (*Rmkdir, error) {
func (t *Tgetattr) handle(cs *connState) message {
ref, ok := cs.LookupFID(t.FID)
if !ok {
- return newErr(syscall.EBADF)
+ return newErr(unix.EBADF)
}
defer ref.DecRef()
@@ -861,7 +861,7 @@ func (t *Tgetattr) handle(cs *connState) message {
func (t *Tsetattr) handle(cs *connState) message {
ref, ok := cs.LookupFID(t.FID)
if !ok {
- return newErr(syscall.EBADF)
+ return newErr(unix.EBADF)
}
defer ref.DecRef()
@@ -871,7 +871,7 @@ func (t *Tsetattr) handle(cs *connState) message {
// there were multiple links and you can still change the
// corresponding inode information.
if ref.isDeleted() {
- return syscall.EINVAL
+ return unix.EINVAL
}
// Set the attributes.
@@ -887,24 +887,24 @@ func (t *Tsetattr) handle(cs *connState) message {
func (t *Tallocate) handle(cs *connState) message {
ref, ok := cs.LookupFID(t.FID)
if !ok {
- return newErr(syscall.EBADF)
+ return newErr(unix.EBADF)
}
defer ref.DecRef()
if err := ref.safelyWrite(func() error {
// Has it been opened already?
if !ref.opened {
- return syscall.EINVAL
+ return unix.EINVAL
}
// Can it be written? Check permissions.
if ref.openFlags&OpenFlagsModeMask == ReadOnly {
- return syscall.EBADF
+ return unix.EBADF
}
// We don't allow allocate on files that have been deleted.
if ref.isDeleted() {
- return syscall.EINVAL
+ return unix.EINVAL
}
return ref.file.Allocate(t.Mode, t.Offset, t.Length)
@@ -919,31 +919,31 @@ func (t *Tallocate) handle(cs *connState) message {
func (t *Txattrwalk) handle(cs *connState) message {
ref, ok := cs.LookupFID(t.FID)
if !ok {
- return newErr(syscall.EBADF)
+ return newErr(unix.EBADF)
}
defer ref.DecRef()
// We don't support extended attributes.
- return newErr(syscall.ENODATA)
+ return newErr(unix.ENODATA)
}
// handle implements handler.handle.
func (t *Txattrcreate) handle(cs *connState) message {
ref, ok := cs.LookupFID(t.FID)
if !ok {
- return newErr(syscall.EBADF)
+ return newErr(unix.EBADF)
}
defer ref.DecRef()
// We don't support extended attributes.
- return newErr(syscall.ENOSYS)
+ return newErr(unix.ENOSYS)
}
// handle implements handler.handle.
func (t *Tgetxattr) handle(cs *connState) message {
ref, ok := cs.LookupFID(t.FID)
if !ok {
- return newErr(syscall.EBADF)
+ return newErr(unix.EBADF)
}
defer ref.DecRef()
@@ -951,7 +951,7 @@ func (t *Tgetxattr) handle(cs *connState) message {
if err := ref.safelyRead(func() (err error) {
// Don't allow getxattr on files that have been deleted.
if ref.isDeleted() {
- return syscall.EINVAL
+ return unix.EINVAL
}
val, err = ref.file.GetXattr(t.Name, t.Size)
return err
@@ -965,14 +965,14 @@ func (t *Tgetxattr) handle(cs *connState) message {
func (t *Tsetxattr) handle(cs *connState) message {
ref, ok := cs.LookupFID(t.FID)
if !ok {
- return newErr(syscall.EBADF)
+ return newErr(unix.EBADF)
}
defer ref.DecRef()
if err := ref.safelyWrite(func() error {
// Don't allow setxattr on files that have been deleted.
if ref.isDeleted() {
- return syscall.EINVAL
+ return unix.EINVAL
}
return ref.file.SetXattr(t.Name, t.Value, t.Flags)
}); err != nil {
@@ -985,7 +985,7 @@ func (t *Tsetxattr) handle(cs *connState) message {
func (t *Tlistxattr) handle(cs *connState) message {
ref, ok := cs.LookupFID(t.FID)
if !ok {
- return newErr(syscall.EBADF)
+ return newErr(unix.EBADF)
}
defer ref.DecRef()
@@ -993,7 +993,7 @@ func (t *Tlistxattr) handle(cs *connState) message {
if err := ref.safelyRead(func() (err error) {
// Don't allow listxattr on files that have been deleted.
if ref.isDeleted() {
- return syscall.EINVAL
+ return unix.EINVAL
}
xattrs, err = ref.file.ListXattr(t.Size)
return err
@@ -1012,14 +1012,14 @@ func (t *Tlistxattr) handle(cs *connState) message {
func (t *Tremovexattr) handle(cs *connState) message {
ref, ok := cs.LookupFID(t.FID)
if !ok {
- return newErr(syscall.EBADF)
+ return newErr(unix.EBADF)
}
defer ref.DecRef()
if err := ref.safelyWrite(func() error {
// Don't allow removexattr on files that have been deleted.
if ref.isDeleted() {
- return syscall.EINVAL
+ return unix.EINVAL
}
return ref.file.RemoveXattr(t.Name)
}); err != nil {
@@ -1032,7 +1032,7 @@ func (t *Tremovexattr) handle(cs *connState) message {
func (t *Treaddir) handle(cs *connState) message {
ref, ok := cs.LookupFID(t.Directory)
if !ok {
- return newErr(syscall.EBADF)
+ return newErr(unix.EBADF)
}
defer ref.DecRef()
@@ -1040,12 +1040,12 @@ func (t *Treaddir) handle(cs *connState) message {
if err := ref.safelyRead(func() (err error) {
// Don't allow reading deleted directories.
if ref.isDeleted() || !ref.mode.IsDir() {
- return syscall.EINVAL
+ return unix.EINVAL
}
// Has it been opened yet?
if !ref.opened {
- return syscall.EINVAL
+ return unix.EINVAL
}
// Read the entries.
@@ -1065,14 +1065,14 @@ func (t *Treaddir) handle(cs *connState) message {
func (t *Tfsync) handle(cs *connState) message {
ref, ok := cs.LookupFID(t.FID)
if !ok {
- return newErr(syscall.EBADF)
+ return newErr(unix.EBADF)
}
defer ref.DecRef()
if err := ref.safelyRead(func() (err error) {
// Has it been opened yet?
if !ref.opened {
- return syscall.EINVAL
+ return unix.EINVAL
}
// Perform the sync.
@@ -1088,7 +1088,7 @@ func (t *Tfsync) handle(cs *connState) message {
func (t *Tstatfs) handle(cs *connState) message {
ref, ok := cs.LookupFID(t.FID)
if !ok {
- return newErr(syscall.EBADF)
+ return newErr(unix.EBADF)
}
defer ref.DecRef()
@@ -1104,7 +1104,7 @@ func (t *Tstatfs) handle(cs *connState) message {
func (t *Tflushf) handle(cs *connState) message {
ref, ok := cs.LookupFID(t.FID)
if !ok {
- return newErr(syscall.EBADF)
+ return newErr(unix.EBADF)
}
defer ref.DecRef()
@@ -1121,7 +1121,7 @@ func (t *Tflushf) handle(cs *connState) message {
func walkOne(qids []QID, from File, names []string, getattr bool) ([]QID, File, AttrMask, Attr, error) {
if len(names) > 1 {
// We require exactly zero or one elements.
- return nil, nil, AttrMask{}, Attr{}, syscall.EINVAL
+ return nil, nil, AttrMask{}, Attr{}, unix.EINVAL
}
var (
localQIDs []QID
@@ -1134,7 +1134,7 @@ func walkOne(qids []QID, from File, names []string, getattr bool) ([]QID, File,
case getattr:
localQIDs, sf, valid, attr, err = from.WalkGetAttr(names)
// Can't put fallthrough in the if because Go.
- if err != syscall.ENOSYS {
+ if err != unix.ENOSYS {
break
}
fallthrough
@@ -1159,7 +1159,7 @@ func walkOne(qids []QID, from File, names []string, getattr bool) ([]QID, File,
if len(localQIDs) != 1 {
// Expected a single QID.
sf.Close()
- return nil, nil, AttrMask{}, Attr{}, syscall.EINVAL
+ return nil, nil, AttrMask{}, Attr{}, unix.EINVAL
}
return append(qids, localQIDs...), sf, valid, attr, nil
}
@@ -1181,7 +1181,7 @@ func doWalk(cs *connState, ref *fidRef, names []string, getattr bool) (qids []QI
// Has it been opened already?
err = ref.safelyRead(func() (err error) {
if ref.opened {
- return syscall.EBUSY
+ return unix.EBUSY
}
return nil
})
@@ -1237,7 +1237,7 @@ func doWalk(cs *connState, ref *fidRef, names []string, getattr bool) (qids []QI
// a proper directory and we have additional paths to walk.
if !walkRef.mode.IsDir() {
walkRef.DecRef() // Drop walk reference; no lock required.
- return nil, nil, AttrMask{}, Attr{}, syscall.EINVAL
+ return nil, nil, AttrMask{}, Attr{}, unix.EINVAL
}
var sf File // Temporary.
@@ -1283,7 +1283,7 @@ func doWalk(cs *connState, ref *fidRef, names []string, getattr bool) (qids []QI
func (t *Twalk) handle(cs *connState) message {
ref, ok := cs.LookupFID(t.FID)
if !ok {
- return newErr(syscall.EBADF)
+ return newErr(unix.EBADF)
}
defer ref.DecRef()
@@ -1303,7 +1303,7 @@ func (t *Twalk) handle(cs *connState) message {
func (t *Twalkgetattr) handle(cs *connState) message {
ref, ok := cs.LookupFID(t.FID)
if !ok {
- return newErr(syscall.EBADF)
+ return newErr(unix.EBADF)
}
defer ref.DecRef()
@@ -1359,7 +1359,7 @@ func (t *Tumknod) handle(cs *connState) message {
func (t *Tlconnect) handle(cs *connState) message {
ref, ok := cs.LookupFID(t.FID)
if !ok {
- return newErr(syscall.EBADF)
+ return newErr(unix.EBADF)
}
defer ref.DecRef()
@@ -1367,7 +1367,7 @@ func (t *Tlconnect) handle(cs *connState) message {
if err := ref.safelyRead(func() (err error) {
// Don't allow connecting to deleted files.
if ref.isDeleted() || !ref.mode.IsSocket() {
- return syscall.EINVAL
+ return unix.EINVAL
}
// Do the connect.
@@ -1391,7 +1391,7 @@ func (t *Tchannel) handle(cs *connState) message {
ch := cs.lookupChannel(t.ID)
if ch == nil {
- return newErr(syscall.ENOSYS)
+ return newErr(unix.ENOSYS)
}
// Return the payload. Note that we need to duplicate the file
@@ -1405,19 +1405,19 @@ func (t *Tchannel) handle(cs *connState) message {
switch t.Control {
case 0:
// Open the main data channel.
- mfd, err := syscall.Dup(int(cs.channelAlloc.FD()))
+ mfd, err := unix.Dup(int(cs.channelAlloc.FD()))
if err != nil {
return newErr(err)
}
rchannel.SetFilePayload(fd.New(mfd))
case 1:
- cfd, err := syscall.Dup(ch.client.FD())
+ cfd, err := unix.Dup(ch.client.FD())
if err != nil {
return newErr(err)
}
rchannel.SetFilePayload(fd.New(cfd))
default:
- return newErr(syscall.EINVAL)
+ return newErr(unix.EINVAL)
}
return rchannel
}
diff --git a/pkg/p9/server.go b/pkg/p9/server.go
index 290d5b9ce..ff1172ed6 100644
--- a/pkg/p9/server.go
+++ b/pkg/p9/server.go
@@ -18,8 +18,8 @@ import (
"io"
"runtime/debug"
"sync/atomic"
- "syscall"
+ "golang.org/x/sys/unix"
"gvisor.dev/gvisor/pkg/fd"
"gvisor.dev/gvisor/pkg/fdchannel"
"gvisor.dev/gvisor/pkg/flipcall"
@@ -483,7 +483,7 @@ func (cs *connState) lookupChannel(id uint32) *channel {
func (cs *connState) handle(m message) (r message) {
if !cs.reqGate.Enter() {
// connState.stop() has been called; the connection is shutting down.
- r = newErr(syscall.ECONNRESET)
+ r = newErr(unix.ECONNRESET)
return
}
defer func() {
@@ -498,7 +498,7 @@ func (cs *connState) handle(m message) (r message) {
// Wrap in an EFAULT error; we don't really have a
// better way to describe this kind of error. It will
// usually manifest as a result of the test framework.
- r = newErr(syscall.EFAULT)
+ r = newErr(unix.EFAULT)
}
}()
if handler, ok := m.(handler); ok {
@@ -506,7 +506,7 @@ func (cs *connState) handle(m message) (r message) {
r = handler.handle(cs)
} else {
// Produce an ENOSYS error.
- r = newErr(syscall.ENOSYS)
+ r = newErr(unix.ENOSYS)
}
return
}
diff --git a/pkg/p9/transport.go b/pkg/p9/transport.go
index 02e665345..add607b9d 100644
--- a/pkg/p9/transport.go
+++ b/pkg/p9/transport.go
@@ -19,8 +19,8 @@ import (
"fmt"
"io"
"io/ioutil"
- "syscall"
+ "golang.org/x/sys/unix"
"gvisor.dev/gvisor/pkg/fd"
"gvisor.dev/gvisor/pkg/log"
"gvisor.dev/gvisor/pkg/sync"
@@ -187,7 +187,7 @@ func recv(s *unet.Socket, msize uint32, lookup lookupTagAndType) (Tag, message,
// fds are caught and used is handled below,
// and the fds variable will be set to nil.
for _, fd := range fds {
- syscall.Close(fd)
+ unix.Close(fd)
}
}()
r.EnableFDs(0)
@@ -323,7 +323,7 @@ func recv(s *unet.Socket, msize uint32, lookup lookupTagAndType) (Tag, message,
// Close the rest. We support only one.
for i := 1; i < len(fds); i++ {
- syscall.Close(fds[i])
+ unix.Close(fds[i])
}
// Don't close in the defer.
diff --git a/pkg/p9/transport_flipcall.go b/pkg/p9/transport_flipcall.go
index 38038abdf..802254a90 100644
--- a/pkg/p9/transport_flipcall.go
+++ b/pkg/p9/transport_flipcall.go
@@ -16,8 +16,8 @@ package p9
import (
"runtime"
- "syscall"
+ "golang.org/x/sys/unix"
"gvisor.dev/gvisor/pkg/fd"
"gvisor.dev/gvisor/pkg/fdchannel"
"gvisor.dev/gvisor/pkg/flipcall"
@@ -236,7 +236,7 @@ func (ch *channel) recv(r message, rsz uint32) (message, error) {
// Convert errors appropriately; see above.
if rlerr, ok := r.(*Rlerror); ok {
- return r, syscall.Errno(rlerr.Error)
+ return r, unix.Errno(rlerr.Error)
}
return r, nil