1
0
mirror of https://github.com/openbsd/src.git synced 2026-04-25 06:35:46 +00:00

fstat: display close-on-fork flag as 'f' in R/W column

Initial diff from Ricardo Branco with fixes from guenther and me.

ok guenther jca millert
This commit is contained in:
tb
2025-12-12 06:33:18 +00:00
parent ba79eea579
commit 6231edff17
2 changed files with 11 additions and 7 deletions

View File

@@ -1,4 +1,4 @@
.\" $OpenBSD: fstat.1,v 1.59 2019/03/31 06:40:26 jmc Exp $
.\" $OpenBSD: fstat.1,v 1.60 2025/12/12 06:33:18 tb Exp $
.\"
.\" Copyright (c) 1987, 1991, 1993
.\" The Regents of the University of California. All rights reserved.
@@ -29,7 +29,7 @@
.\"
.\" from: @(#)fstat.1 8.3 (Berkeley) 2/25/94
.\"
.Dd $Mdocdate: March 31 2019 $
.Dd $Mdocdate: December 12 2025 $
.Dt FSTAT 1
.Os
.Sh NAME
@@ -175,6 +175,8 @@ Open for reading
Open for writing
.It e
close-on-exec flag is set
.It f
close-on-fork flag is set
.It p
Opened after
.Xr pledge 2

View File

@@ -1,4 +1,4 @@
/* $OpenBSD: fstat.c,v 1.103 2022/06/20 01:39:44 visa Exp $ */
/* $OpenBSD: fstat.c,v 1.104 2025/12/12 06:33:18 tb Exp $ */
/*
* Copyright (c) 2009 Todd C. Miller <millert@openbsd.org>
@@ -337,10 +337,10 @@ fstat_header(void)
{
if (nflg)
printf("%s",
"USER CMD PID FD DEV INUM MODE R/W SZ|DV");
"USER CMD PID FD DEV INUM MODE R/W SZ|DV");
else
printf("%s",
"USER CMD PID FD MOUNT INUM MODE R/W SZ|DV");
"USER CMD PID FD MOUNT INUM MODE R/W SZ|DV");
if (oflg)
printf("%s", ":OFFSET ");
if (checkfile && fsflg == 0)
@@ -427,7 +427,7 @@ void
vtrans(struct kinfo_file *kf)
{
const char *badtype = NULL;
char rwep[5], mode[12];
char rwep[6], mode[12];
char *filename = NULL;
if (kf->v_type == VNON)
@@ -482,9 +482,11 @@ vtrans(struct kinfo_file *kf)
strlcat(rwep, "w", sizeof rwep);
if (kf->fd_ofileflags & UF_EXCLOSE)
strlcat(rwep, "e", sizeof rwep);
if (kf->fd_ofileflags & UF_FORKCLOSE)
strlcat(rwep, "f", sizeof rwep);
if (kf->fd_ofileflags & UF_PLEDGED)
strlcat(rwep, "p", sizeof rwep);
printf(" %4s", rwep);
printf(" %5s", rwep);
switch (kf->v_type) {
case VBLK:
case VCHR: {