Movatterモバイル変換


[0]ホーム

URL:


man7.org > Linux >man-pages

Linux/UNIX system programming training


listmount(2) — Linux manual page

NAME |LIBRARY |SYNOPSIS |DESCRIPTION |RETURN VALUE |ERRORS |STANDARDS |SEE ALSO |COLOPHON

listmount(2)               System Calls Manuallistmount(2)

NAME        top

       listmount - get a list of mount ID's

LIBRARY        top

       Standard C library (libc,-lc)

SYNOPSIS        top

#include <linux/mount.h>/* Definition of struct mnt_id_req constants */#include <unistd.h>int syscall(size_t n;SYS_listmount, struct mnt_id_req *req,uint64_tmnt_ids[n], size_tn,unsigned longflags);#include <linux/mount.h>struct mnt_id_req {__u32  size;/* sizeof(struct mnt_id_req) */__u64  mnt_id;/* The parent mnt_id being searched */__u64  param;/* The next mnt_id we want to find */};Note: glibc provides no wrapper forlistmount(), necessitating the       use ofsyscall(2).

DESCRIPTION        top

       To access the mounts in your namespace, you must have       CAP_SYS_ADMIN in the user namespace.       This function returns a list of mount IDs under thereq.mnt_id.       This is meant to be used in conjuction withstatmount(2) in order       to provide a way to iterate and discover mounted file systems.The mnt_id_req structurereq.size is used by the kernel to determine which structmnt_id_req is being passed in, it should always be set tosizeof(struct mnt_id_req).req.mnt_id is the parent mnt_id that we will list from, which can       either beLSMT_ROOTwhich means the root mount of the current       mount namespace, or a mount ID obtained from eitherstatx(2) usingSTATX_MNT_ID_UNIQUEor fromlistmount(2).req.param is used to tell the kernel what mount ID to start the       list from.  This is useful if multiple calls tolistmount(2) are       required.  This can be set to the last mount ID returned in order       to resume from a previous spot in the list.

RETURN VALUE        top

       On success, the number of entries filled intomnt_ids is returned;       0 if there are no more mounts left.  On error, -1 is returned, anderrno is set to indicate the error.

ERRORS        top

EPERMPermission is denied for accessing this mount.EFAULTreq ormnt_ids points to a location outside the process's              accessible address space.EINVALInvalid flag specified inflags.EINVALreq is of insufficient size to be utilized.E2BIGreq is too large, the limit is the architectures page size.ENOENTThe specifiedreq.mnt_id doesn't exist.ENOMEMOut of memory (i.e., kernel memory).

STANDARDS        top

       Linux.

SEE ALSO        top

statmount(2),statx(2)

COLOPHON        top

       This page is part of theman-pages (Linux kernel and C library       user-space interface documentation) project.  Information about       the project can be found at        ⟨https://www.kernel.org/doc/man-pages/⟩.  If you have a bug report       for this manual page, see       ⟨https://git.kernel.org/pub/scm/docs/man-pages/man-pages.git/tree/CONTRIBUTING⟩.       This page was obtained from the tarball man-pages-6.15.tar.gz       fetched from       ⟨https://mirrors.edge.kernel.org/pub/linux/docs/man-pages/⟩ on       2025-08-11.  If you discover any rendering problems in this HTML       version of the page, or you believe there is a better or more up-       to-date source for the page, or you have corrections or       improvements to the information in this COLOPHON (which isnot       part of the original manual page), send a mail to       man-pages@man7.orgLinux man-pages 6.15            2025-06-28listmount(2)

Pages that refer to this page:listmount(2)statmount(2)statx(2)



HTML rendering created 2025-09-06 byMichael Kerrisk, author ofThe Linux Programming Interface.

For details of in-depthLinux/UNIX system programming training courses that I teach, lookhere.

Hosting byjambit GmbH.

Cover of TLPI


[8]ページ先頭

©2009-2025 Movatter.jp