POSIX-2024 and dirent.h
Corinna Vinschen
vinschen@redhat.com
Thu Aug 15 16:23:10 GMT 2024
On Aug 15 17:26, Corinna Vinschen wrote:
> On Aug 15 17:04, Corinna Vinschen wrote:
> > On Aug 14 21:45, Corinna Vinschen wrote:
> > > On Aug 14 13:53, Joel Sherrill wrote:
> > > > Hi
> > > >
> > > > POSIX Issue 8 (2024) adds the following to dirent.h:
> > > >
> > > > DT_BLK, DT_CHR, DT_DIR, DT_FIFO, DT_LNK, DT_REG, DT_SOCK, DT_UNKNOWN,
> > > > DT_MQ, DT_SEM, DT_SHM, and DT_TMO
> > > >
> > > > These were not mentioned in POSIX Issue 7 (2018).
> > > >
> > > > The default dirent.h and sys/dirent.h do not support anything. I only see
> > > > the DT_ constants in the sys/rtems version.
> > > >
> > > > The sys/rtems version has the constants inside a __BSD_VISIBLE guard.
> > > >
> > > > I think these should also be under a (_POSIX_C_SOURCE >= 202405L) guard.
> > > >
> > > > I am looking for concurrence and whether adding a check for 202405L has any
> > > > impact on sys/features.h. POSIX-2018 (Issue 7) still specifies
> > > > using 200809L for _POSIX_C_SOURCE.
> > >
> > > Yes, this should be added to sys/features.h with a matching __POSIX_VISIBLE
> > > which in turn should be used in the affected headers. _GNU_SOURCE and
> > > _DEFAULT_SOURCE should set _POSIX_C_SOURCE to 202405L. _XOPEN_SOURCE is
> > > unaffected.
> >
> > There's an interesting twist.
> >
> > Even the latest sources of GLibC define _POSIX_C_SOURCE to 200809L if
> > _GNU_SOURCE has been defined.
> >
> > It's a good question what to do with _POSIX_C_SOURCE in this case.
> >
> > - Compatibility with _GNU_SOURCE upstream means to keep _POSIX_C_SOURCE
> > at 200809L.
> >
> > - But GLibC just didn't have to change features.h because none of the
> > new interfaces is available in their headers yet.
>
> On second glance it appears that just nobody worked on it yet...
>
> > And _GNU_SOURCE
> > usually translates as "everything amd the kitchen sink". That would
> > speak for going forward and bump _POSIX_C_SOURCE to 202405L.
> >
> > Personally I'd go for the second option. Any strong reservations?
For the time being I pushed the changes to features.h without changing
_GNU_SOURCE. If no strong reservations is forthcoming, I'll push the
matching tweak to _GNU_SOURCE in a couple of days.
Thanks,
Corinna
More information about the Newlib
mailing list