aboutsummaryrefslogtreecommitdiff
path: root/contrib/llvm-project/libc/hdr/(developers-only)
diff options
context:
space:
mode:
authorMaxim Sobolev <sobomax@FreeBSD.org>2026-10-01 21:25:37 +0000
committerMaxim Sobolev <sobomax@FreeBSD.org>2026-10-01 21:25:37 +0000
commit43b0384bc7e87df5bd164ce833617e68824f4828 (patch)
tree1ed521121892050b53aa691dd4f74ed294893d86 /contrib/llvm-project/libc/hdr/(developers-only)
parent5f275e547814db5944ff1ca746c31447a0896e1e (diff)
mountpoint(1): new utility, implemented as a stat(1) hardlinkHEADmain
Add mountpoint(1), a simple utility to tell whether the file pointed to by the argument is a mount point. It prints whether it is, unless -q is given, and exits 0 if it is, 1 if it is not, and 2 on error. The answer comes from the kernel with a single stat(2): the root vnode of a mounted file system is reported with SFBSD_MNTPOINT in st_bsdflags. Unlike comparing realpath(3) of the argument with that of statfs(2)'s f_mntonname, this works for arbitrarily deep hierarchies, and after chroot(2) or inside a jail. A chroot or jail root is reported as a mount point only if it is one. The argument does not have to be a directory: file systems such as nullfs(5) can be mounted over regular files and sockets, and stat(2) reports those mount points as well. Since all that is needed is one stat(2) call, make mountpoint a hardlink to stat(1), the same way readlink(1) is, and document it in stat.1. Add ATF tests, including chroot(8) and jail(8) roots that are and are not mount points, nullfs roots, file systems mounted inside the root, both from the host and from within the jail, and a nullfs mount of a file over a file. Suggested by: kib Differential revision: https://reviews.freebsd.org/D59906 Sponsored by: Sippy Software, Inc. MFC after: 2 weeks
Diffstat (limited to 'contrib/llvm-project/libc/hdr/(developers-only)')
0 files changed, 0 insertions, 0 deletions