git: face51fd9c82 - main - fstat(1), fuser(1): teach about altroot

From: Konstantin Belousov <kib_at_FreeBSD.org>
Date: Fri, 20 Nov 2026 15:11:03 UTC
The branch main has been updated by kib:

URL: https://cgit.FreeBSD.org/src/commit/?id=face51fd9c8213f6f4133b0e137fcf22e4d1ab76

commit face51fd9c8213f6f4133b0e137fcf22e4d1ab76
Author:     Konstantin Belousov <kib@FreeBSD.org>
AuthorDate: 2026-09-28 22:09:03 +0000
Commit:     Konstantin Belousov <kib@FreeBSD.org>
CommitDate: 2026-11-20 15:10:27 +0000

    fstat(1), fuser(1): teach about altroot
    
    Reviewed by:    markj
    Sponsored by:   The FreeBSD Foundation
    MFC after:      1 week
    Differential revision:  https://reviews.freebsd.org/D60035
---
 usr.bin/fstat/fstat.1 | 5 ++++-
 usr.bin/fstat/fstat.c | 2 ++
 usr.bin/fstat/fuser.1 | 5 ++++-
 usr.bin/fstat/fuser.c | 1 +
 4 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/usr.bin/fstat/fstat.1 b/usr.bin/fstat/fstat.1
index 4d6e32438a04..7a34a00ac18f 100644
--- a/usr.bin/fstat/fstat.1
+++ b/usr.bin/fstat/fstat.1
@@ -44,7 +44,8 @@ The
 .Nm
 utility identifies open files.
 A file is considered open by a process if it was explicitly opened,
-is the working directory, root directory, jail root directory,
+is the working directory, root directory, alternative root directory,
+jail root directory,
 active executable text, or kernel trace file for that process.
 If no options are specified,
 .Nm
@@ -122,6 +123,8 @@ jail root directory
 memory-mapped file
 .It Sy root
 root inode
+.It Sy altr
+alternative root inode
 .It Sy text
 executable text inode
 .It Sy tr
diff --git a/usr.bin/fstat/fstat.c b/usr.bin/fstat/fstat.c
index e93385a5b0f6..2eb41ab5d32e 100644
--- a/usr.bin/fstat/fstat.c
+++ b/usr.bin/fstat/fstat.c
@@ -271,6 +271,8 @@ print_file_info(struct procstat *procstat, struct filestat *fst,
 		printf("   wd");
 	else if (fst->fs_uflags & PS_FST_UFLAG_RDIR)
 		printf(" root");
+	else if (fst->fs_uflags & PS_FST_UFLAG_ADIR)
+		printf(" altr");
 	else if (fst->fs_uflags & PS_FST_UFLAG_TRACE)
 		printf("   tr");
 	else if (fst->fs_uflags & PS_FST_UFLAG_MMAP)
diff --git a/usr.bin/fstat/fuser.1 b/usr.bin/fstat/fuser.1
index 5def7b36d606..ff92fc930550 100644
--- a/usr.bin/fstat/fuser.1
+++ b/usr.bin/fstat/fuser.1
@@ -43,7 +43,8 @@ more named files open.
 For block and character special devices, all processes using files
 on that device are listed.
 A file is considered open by a process if it was explicitly opened,
-is the working directory, root directory, jail root directory,
+is the working directory, root directory, alternative root directory,
+jail root directory,
 active executable text, kernel trace file or the controlling terminal
 of the process.
 If
@@ -83,6 +84,8 @@ The following symbols, written to stderr will indicate how files are used:
 .It Sy a
 The file is open as append only
 .Pq Dv O_APPEND No was specified .
+.It Sy b
+The file is the alternative root directory of the process.
 .It Sy c
 The file is the current workdir directory of the process.
 .It Sy d
diff --git a/usr.bin/fstat/fuser.c b/usr.bin/fstat/fuser.c
index c38a520d4ce3..bd316d736c20 100644
--- a/usr.bin/fstat/fuser.c
+++ b/usr.bin/fstat/fuser.c
@@ -73,6 +73,7 @@ static const struct {
 	{PS_FST_UFLAG_RDIR,	'r'},
 	{PS_FST_UFLAG_CDIR,	'c'},
 	{PS_FST_UFLAG_JAIL,	'j'},
+	{PS_FST_UFLAG_ADIR,	'b'},
 	{PS_FST_UFLAG_TRACE,	't'},
 	{PS_FST_UFLAG_TEXT,	'x'},
 	{PS_FST_UFLAG_MMAP,	'm'},