diff options
author | Andrei Vagin <avagin@gmail.com> | 2018-07-31 11:18:02 -0700 |
---|---|---|
committer | Shentubot <shentubot@google.com> | 2018-07-31 11:19:15 -0700 |
commit | a7a0167716d71895919021692b15bd000f63b24f (patch) | |
tree | 5e41d11fe25b533a59387649e4f90c0801e1eb1e /pkg/sentry/syscalls/linux/flags.go | |
parent | 543c997978525ac7de3a24ff73203ddbb2cef6dc (diff) |
proc: show file flags in fdinfo
Currently, there is an attempt to print FD flags, but
they are not decoded into a number, so we see something like this:
/criu # cat /proc/self/fdinfo/0
flags: {%!o(bool=000false)}
Actually, fdinfo has to contain file flags.
Change-Id: Idcbb7db908067447eb9ae6f2c3cfb861f2be1a97
PiperOrigin-RevId: 206794498
Diffstat (limited to 'pkg/sentry/syscalls/linux/flags.go')
-rw-r--r-- | pkg/sentry/syscalls/linux/flags.go | 43 |
1 files changed, 0 insertions, 43 deletions
diff --git a/pkg/sentry/syscalls/linux/flags.go b/pkg/sentry/syscalls/linux/flags.go index b2e173f3e..e8db3e0de 100644 --- a/pkg/sentry/syscalls/linux/flags.go +++ b/pkg/sentry/syscalls/linux/flags.go @@ -17,7 +17,6 @@ package linux import ( "gvisor.googlesource.com/gvisor/pkg/abi/linux" "gvisor.googlesource.com/gvisor/pkg/sentry/fs" - "gvisor.googlesource.com/gvisor/pkg/sentry/kernel" ) // flagsToPermissions returns a Permissions object from Linux flags. @@ -35,48 +34,6 @@ func flagsToPermissions(mask uint) (p fs.PermMask) { return } -// fdFlagsToLinux converts a kernel.FDFlags object to a Linux representation. -func fdFlagsToLinux(flags kernel.FDFlags) (mask uint) { - if flags.CloseOnExec { - mask |= linux.FD_CLOEXEC - } - return -} - -// flagsToLinux converts a FileFlags object to a Linux representation. -func flagsToLinux(flags fs.FileFlags) (mask uint) { - if flags.Direct { - mask |= linux.O_DIRECT - } - if flags.NonBlocking { - mask |= linux.O_NONBLOCK - } - if flags.Sync { - mask |= linux.O_SYNC - } - if flags.Append { - mask |= linux.O_APPEND - } - if flags.Directory { - mask |= linux.O_DIRECTORY - } - if flags.Async { - mask |= linux.O_ASYNC - } - if flags.LargeFile { - mask |= linux.O_LARGEFILE - } - switch { - case flags.Read && flags.Write: - mask |= linux.O_RDWR - case flags.Write: - mask |= linux.O_WRONLY - case flags.Read: - mask |= linux.O_RDONLY - } - return -} - // linuxToFlags converts linux file flags to a FileFlags object. func linuxToFlags(mask uint) (flags fs.FileFlags) { return fs.FileFlags{ |