Why is _POSIX_SOURCE used instead of __BSD_VISIBLE in <termios.h>?

Sebastian Huber sebastian.huber at embedded-brains.de
Wed May 24 05:56:04 UTC 2017


On 23/05/17 09:33, Sebastian Huber wrote:

> Hello,
>
> the Termios header <termios.h>, <sys/_termios.h>, etc. use sometimes 
> _POSIX_SOURCE directly to determine if a thing should be exposed to 
> the user, e.g.
>
> #ifndef _POSIX_SOURCE
> #define    ONLCR        0x00000002    /* map NL to CR-NL (ala CRMOD) */
> #define    TABDLY        0x00000004    /* tab delay mask */
> #define        TAB0        0x00000000        /* no tab delay and 
> expansion */
> #define        TAB3        0x00000004        /* expand tabs to spaces */
> #define    ONOEOT        0x00000008    /* discard EOT's (^D) on 
> output) */
> #define    OCRNL        0x00000010    /* map CR to NL on output */
> #define    ONOCR        0x00000020    /* no CR output at column 0 */
> #define    ONLRET        0x00000040    /* NL performs CR function */
> #endif  /*_POSIX_SOURCE */
>
> This circumvents the feature mechanisms of <sys/cdefs.h>. Why is 
> __BSD_VISIBLE not used for this?
>

This was already changed in one spot:

https://github.com/freebsd/freebsd/commit/e63fa4cfabc535a5f9ec7ea2b383692931c13465

There are not many places left using _POSIX_SOURCE directly. To me this 
looks like someone forgot to update the Termios headers to use the 
visibility defines.

-- 
Sebastian Huber, embedded brains GmbH

Address : Dornierstr. 4, D-82178 Puchheim, Germany
Phone   : +49 89 189 47 41-16
Fax     : +49 89 189 47 41-09
E-Mail  : sebastian.huber at embedded-brains.de
PGP     : Public key available on request.

Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.



More information about the freebsd-hackers mailing list