aboutsummaryrefslogtreecommitdiffhomepage
path: root/sandbox/vfs/mountinfo.go
diff options
context:
space:
mode:
Diffstat (limited to 'sandbox/vfs/mountinfo.go')
-rw-r--r--sandbox/vfs/mountinfo.go26
1 files changed, 26 insertions, 0 deletions
diff --git a/sandbox/vfs/mountinfo.go b/sandbox/vfs/mountinfo.go
index 2f609b1e..df2940a4 100644
--- a/sandbox/vfs/mountinfo.go
+++ b/sandbox/vfs/mountinfo.go
@@ -7,6 +7,7 @@ import (
"io"
"strconv"
"strings"
+ "syscall"
)
var (
@@ -51,6 +52,31 @@ type (
DevT [2]int
)
+func (e *MountInfoEntry) Flags() (flags uintptr, unmatched []string) {
+ for _, s := range strings.Split(e.VfsOptstr, ",") {
+ switch s {
+ case "rw":
+ case "ro":
+ flags |= syscall.MS_RDONLY
+ case "nosuid":
+ flags |= syscall.MS_NOSUID
+ case "nodev":
+ flags |= syscall.MS_NODEV
+ case "noexec":
+ flags |= syscall.MS_NOEXEC
+ case "noatime":
+ flags |= syscall.MS_NOATIME
+ case "nodiratime":
+ flags |= syscall.MS_NODIRATIME
+ case "relatime":
+ flags |= syscall.MS_RELATIME
+ default:
+ unmatched = append(unmatched, s)
+ }
+ }
+ return
+}
+
// ParseMountInfo parses a mountinfo file according to proc_pid_mountinfo(5).
func ParseMountInfo(r io.Reader) (*MountInfo, int, error) {
var m, cur *MountInfo