Question about the definition of _XOPEN_SOURCE

Joel Sherrill joel at rtems.org
Sun Jan 3 21:43:54 UTC 2021


The file says/features.h defines the defaults for RTEMS. Some methods are
not visible at the default standard level because they are extensions maybe
GNU or BSD specific. The defaults are modified by the selection of the
programming language standard and the feature macros your program defines.
I recall that I'd you say std=c99, you lose visibility to a number of the
POSIX methods.

This is the Linux man page on these.

https://man7.org/linux/man-pages/man7/feature_test_macros.7.html

Note that Linux and RTEMS do not agree on the default feature settings. My
recollection is that RTEMS is closer to pure POSIX while Linux enables a
number of non-POSIX extensions by default.

You need to be careful to define any features you need early in case
sys/features.h is implicitly included in your selection has no impact.

--joel

On Sun, Jan 3, 2021, 12:21 PM Sebastian Huber <
sebastian.huber at embedded-brains.de> wrote:

> On 03/01/2021 18:06, Heinz Junkes wrote:
>
> > _XOPEN_SOURCE is not set anywhere in the RTEMS header files etc..
>
> Yes, and this is how it should be. This define is supposed to be defined
> by your application if necessary:
>
> https://www.gnu.org/software/libc/manual/html_node/Feature-Test-Macros.html
>
> https://man7.org/linux/man-pages/man7/feature_test_macros.7.html
>
> --
> embedded brains GmbH
> Herr Sebastian HUBER
> Dornierstr. 4
> 82178 Puchheim
> Germany
> email: sebastian.huber at embedded-brains.de
> phone: +49-89-18 94 741 - 16
> fax:   +49-89-18 94 741 - 08
>
> Registergericht: Amtsgericht München
> Registernummer: HRB 157899
> Vertretungsberechtigte Geschäftsführer: Peter Rasmussen, Thomas Dörfler
> Unsere Datenschutzerklärung finden Sie hier:
> https://embedded-brains.de/datenschutzerklaerung/
>
> _______________________________________________
> devel mailing list
> devel at rtems.org
> http://lists.rtems.org/mailman/listinfo/devel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/devel/attachments/20210103/62d3d584/attachment.html>


More information about the devel mailing list