# statmount

## NAME



           statmount - get a mount status
    


## LIBRARY



           Standard C library (_libc_ , _-lc_)
    


## SYNOPSIS



           **#include <linux/mount.h>  **/* Definition of STATMOUNT_* constants */
           **#include <unistd.h>**
    
           **int syscall(SYS_statmount, struct mnt_id_req ***_req_**,**
                       **struct statmount ***_smbuf_**, size_t** _bufsize_**,**
                       **unsigned long** _flags_**);**
    
           **#include <linux/mount.h>**
    
           **struct mnt_id_req {**
               **__u32  size;** /* sizeof(struct mnt_id_req) */
               **__u64  mnt_id;** /* The mnt_id being queried */
               **__u64  param;** /* An ORed combination of the STATMOUNT_ constants */
           **};**
    
           **struct statmount {**
               **__u32  size;**
               **__u64  mask;**
               **__u32  sb_dev_major;**
               **__u32  sb_dev_minor;**
               **__u64  sb_magic;**
               **__u32  sb_flags;**
               **__u32  fs_type;**
               **__u64  mnt_id;**
               **__u64  mnt_parent_id;**
               **__u32  mnt_id_old;**
               **__u32  mnt_parent_id_old;**
               **__u64  mnt_attr;**
               **__u64  mnt_propagation;**
               **__u64  mnt_peer_group;**
               **__u64  mnt_master;**
               **__u64  propagate_from;**
               **__u32  mnt_root;**
               **__u32  mnt_point;**
               **char   str[];**
           **};**
    
           _Note_ : glibc provides no wrapper for **statmount**(), necessitating the
           use of syscall(2).
    


## DESCRIPTION



           To access a mount's status, the caller must have CAP_SYS_ADMIN in
           the user namespace.
    
           This function returns information about a mount, storing it in the
           buffer pointed to by _smbuf_.  The returned buffer is a _struct_
           _statmount_ which is of size _bufsize_ with the fields filled in as
           described below.
    
           (Note that reserved space and padding is omitted.)
    
       **The mnt_id_req structure**
           _req.size_ is used by the kernel to determine which
           _struct mnt_id_req_ is being passed in; it should always be set to
           _sizeof(struct mnt_id_req)_.
    
           _req.mnt_id_ can be obtained from either statx(2) using
           **STATX_MNT_ID_UNIQUE** or from listmount(2) and is used as the
           identifier to query the status of the desired mount point.
    
           _req.param_ is used to tell the kernel which fields the caller is
           interested in.  It is an ORed combination of the following
           constants
    
               **STATMOUNT_SB_BASIC** /* Want/got sb_* */
               **STATMOUNT_MNT_BASIC** /* Want/got mnt_* */
               **STATMOUNT_PROPAGATE_FROM** /* Want/got propagate_from */
               **STATMOUNT_MNT_ROOT** /* Want/got mnt_root  */
               **STATMOUNT_MNT_POINT** /* Want/got mnt_point */
               **STATMOUNT_FS_TYPE** /* Want/got fs_type */
    
           In general, the kernel does _not_ reject values in _req.param_ other
           than the above.  (For an exception, see **EINVAL** in errors.)
           Instead, it simply informs the caller which values are supported
           by this kernel and filesystem via the _statmount.mask_ field.
           Therefore, _do not_ simply set _req.param_ to **UINT_MAX**(all bits set),
           as one or more bits may, in the future, be used to specify an
           extension to the buffer.
    
       **The returned information**
           The status information for the target mount is returned in the
           _statmount_ structure pointed to by _smbuf_.
    
           The fields in the _statmount_ structure are:
    
           _smbuf.size_
                  The size of the returned _smbuf_ structure, including any of
                  the strings fields that were filled.
    
           _smbuf.mask_
                  The ORed combination of **STATMOUNT_**_*_ flags indicating which
                  fields were filled in and thus valid.  The kernel may
                  return fields that weren't requested, and may fail to
                  return fields that were requested, depending on what the
                  backing file system and kernel supports.  In either case,
                  _req.param_ will not be equal to _mask_.
    
           _smbuf.sb_dev_major_
           _smbuf.sb_dev_minor_
                  The device that is mounted at this mount point.
    
           _smbuf.sb_magic_
                  The file system specific super block magic.
    
           _smbuf.sb_flags_
                  The flags that are set on the super block, an ORed
                  combination of **SB_RDONLY** , **SB_SYNCHRONOUS** , **SB_DIRSYNC** ,
                  **SB_LAZYTIME**.
    
           _smbuf.fs_type_
                  The offset to the location in the _smbuf.str_ buffer that
                  contains the string representation of the mounted file
                  system.  It is a null-terminated string.
    
           _smbuf.mnt_id_
                  The unique mount ID of the mount.
    
           _smbuf.mnt_parent_id_
                  The unique mount ID of the parent mount point of this
                  mount.  If this is the root mount point then
                  _smbuf.mnt_id == smbuf.parent_mount_id_.
    
           _smbuf.mnt_id_old_
                  This corresponds to the mount ID that is exported by
                  _/proc/_ pid _/mountinfo_.
    
           _smbuf.mnt_parent_id_old_
                  This corresponds to the parent mount ID that is exported by
                  _/proc/_ pid _/mountinfo_.
    
           _smbuf.mnt_attr_
                  The **MOUNT_ATTR_**_*_ flags set on this mount point.
    
           _smbuf.mnt_propagation_
                  The mount propagation flags, which can be one of **MS_SHARED** ,
                  **MS_SLAVE** , **MS_PRIVATE** , **MS_UNBINDABLE**.
    
           _smbuf.mnt_peer_group_
                  The ID of the shared peer group.
    
           _smbuf.mnt_master_
                  The mount point receives its propagation from this mount
                  ID.
    
           _smbuf.propagate_from_
                  The ID from the namespace we propagated from.
    
           _smbuf.mnt_root_
                  The offset to the location in the _smbuf.str_ buffer that
                  contains the string representation of the mount relative to
                  the root of the file system.  It is a null-terminated
                  string.
    
           _smbuf.mnt_point_
                  The offset to the location in the _smbuf.str_ buffer that
                  contains the string representation of the mount relative to
                  the current root (ie if you are in a **chroot**).  It is a
                  null-terminated string.
    


## RETURN VALUE



           On success, zero is returned.  On error, -1 is returned, and _errno_
           is set to indicate the error.
    


## ERRORS



           **EPERM** Permission is denied for accessing this mount.
    
           **EFAULT** _req_ or _smbuf_ points to a location outside the process's
                  accessible address space.
    
           **EINVAL** Invalid flag specified in _flags_.
    
           **EINVAL** _req_ is of insufficient size to be utilized.
    
           **E2BIG** _req_ is too large.
    
           **EOVERFLOW**
                  The size of _smbuf_ is too small to contain either the
                  _smbuf.fs_type_ , _smbuf.mnt_root_ , or _smbuf.mnt_point_.
                  Allocate a larger buffer and retry the call.
    
           **ENOENT** The specified _req.mnt_id_ doesn't exist.
    
           **ENOMEM** Out of memory (i.e., kernel memory).
    


## STANDARDS



           Linux.
    


* * *