Re: POSIX-2024 and dirent.h

Corinna Vinschen <[email protected]>
Newsgroups gmane.comp.lib.newlib
Message-ID <[email protected]>
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.  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?


Thanks,
Corinna
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.