{"@context":"https://w3id.org/codemeta/3.0","@type":"SoftwareSourceCode","identifier":"pkg:golang/github.com/moby/sys/mountinfo","name":"github.com/moby/sys/mountinfo","description":"Package mountinfo provides a set of functions to retrieve information about OS mounts.\n\nCurrently it supports Linux. For historical reasons, there is also some support for FreeBSD and OpenBSD,\nand a shallow implementation for Windows, but in general this is Linux-only package, so\nthe rest of the document only applies to Linux, unless explicitly specified otherwise.\n\nIn Linux, information about mounts seen by the current process is available from\n/proc/self/mountinfo. Note that due to mount namespaces, different processes can\nsee different mounts. A per-process mountinfo table is available from /proc/\u003cPID\u003e/mountinfo,\nwhere \u003cPID\u003e is a numerical process identifier.\n\nIn general, /proc is not a very efficient interface, and mountinfo is not an exception.\nFor example, there is no way to get information about a specific mount point (i.e. it\nis all-or-nothing). This package tries to hide the /proc ineffectiveness by using\nparse filters while reading mountinfo. A filter can skip some entries, or stop\nprocessing the rest of the file once the needed information is found.\n\nFor mountinfo filters that accept path as an argument, the path must be absolute,\nhaving all symlinks resolved, and being cleaned (i.e. no extra slashes or dots).\nOne way to achieve all of the above is to employ filepath.Abs followed by\nfilepath.EvalSymlinks (the latter calls filepath.Clean on the result so\nthere is no need to explicitly call filepath.Clean).\n\nNOTE that in many cases there is no need to consult mountinfo at all. Here are some\nof the cases where mountinfo should not be parsed:\n\n1. Before performing a mount. Usually, this is not needed, but if required (say to\nprevent over-mounts), to check whether a directory is mounted, call os.Lstat\non it and its parent directory, and compare their st.Sys().(*syscall.Stat_t).Dev\nfields -- if they differ, then the directory is the mount point. NOTE this does\nnot work for bind mounts. Optionally, the filesystem type can also be checked\nby calling unix.Statfs and checking the Type field (i.e. filesystem type).\n\n2. After performing a mount. If there is no error returned, the mount succeeded;\nchecking the mount table for a new mount is redundant and expensive.\n\n3. Before performing an unmount. It is more efficient to do an unmount and ignore\na specific error (EINVAL) which tells the directory is not mounted.\n\n4. After performing an unmount. If there is no error returned, the unmount succeeded.\n\n5. To find the mount point root of a specific directory. You can perform os.Stat()\non the directory and traverse up until the Dev field of a parent directory differs.","version":"v0.7.2","softwareVersion":"v0.7.2","license":"https://spdx.org/licenses/Apache-2.0","codeRepository":"https://github.com/moby/sys","issueTracker":"https://github.com/moby/sys/issues","url":"https://github.com/moby/sys","programmingLanguage":{"@type":"ComputerLanguage","name":"Go"},"dateCreated":"2020-03-15","dateModified":"2024-07-16","datePublished":"2024-07-16","copyrightYear":2020,"downloadUrl":"https://proxy.golang.org/github.com/moby/sys/mountinfo/@v/v0.7.2.zip","softwareHelp":{"@type":"WebSite","url":"https://pkg.go.dev/github.com/moby/sys/mountinfo#section-documentation"},"applicationCategory":"go","runtimePlatform":"go","developmentStatus":"active","sameAs":["https://pkg.go.dev/github.com/moby/sys/mountinfo"],"https://www.w3.org/ns/activitystreams#likes":85,"https://forgefed.org/ns#forks":49}