Download raw body.
[PATCH]: Add POSIX O_CLOFORK flag
On Thu, Dec 11, 2025 at 10:47:01AM -0800, Philip Guenther wrote:
> On Thu, 11 Dec 2025, Theo Buehler wrote:
> > On Thu, Dec 11, 2025 at 11:23:30AM -0700, Todd C. Miller wrote:
> > > On Thu, 11 Dec 2025 13:29:59 +0100, Theo Buehler wrote:
> > >
> > > > Found this piece of this submission in one of my trees. Do we want this
> > > > or was that omitted deliberately?
> > >
> > > I think we do want the fstat.c change, but it needs a man page
> > > addition as well.
> >
> > thanks. like this?
>
> almost ok guenther@
>
>
> > --- fstat.c 20 Jun 2022 01:39:44 -0000 1.103
> > +++ fstat.c 11 Dec 2025 18:36:17 -0000
> > @@ -482,6 +482,8 @@ 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);
>
> The size of the rwep array needs to be bumped by one too.
>
Oh, right. We also need an extra column, otherwise the MODE and R/W
columns touch in -n mode if all 5 flags are set.
Index: fstat.1
===================================================================
RCS file: /cvs/src/usr.bin/fstat/fstat.1,v
diff -u -p -r1.59 fstat.1
--- fstat.1 31 Mar 2019 06:40:26 -0000 1.59
+++ fstat.1 11 Dec 2025 18:37:06 -0000
@@ -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
Index: fstat.c
===================================================================
RCS file: /cvs/src/usr.bin/fstat/fstat.c,v
diff -u -p -r1.103 fstat.c
--- fstat.c 20 Jun 2022 01:39:44 -0000 1.103
+++ fstat.c 11 Dec 2025 18:53:43 -0000
@@ -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: {
[PATCH]: Add POSIX O_CLOFORK flag