Implementing confstr()

Joel Sherrill joel at rtems.org
Mon Aug 7 14:38:45 UTC 2017


Hi

Taking a private discussion public. Aditya is implementing the POSIX
method confstr() next. This email is my current set of thoughts on the
implementation of this method for RTEMS.

First, I think confstr() belongs in the RTEMS source tree. It
is very similar to sysconf() but has to take the following "names" as
those to be able to retrieve:

_CS_PATH
_CS_POSIX_V7_ILP32_OFF32_CFLAGS
_CS_POSIX_V7_ILP32_OFF32_LDFLAGS
_CS_POSIX_V7_ILP32_OFF32_LIBS
_CS_POSIX_V7_ILP32_OFFBIG_CFLAGS
_CS_POSIX_V7_ILP32_OFFBIG_LDFLAGS
_CS_POSIX_V7_ILP32_OFFBIG_LIBS
_CS_POSIX_V7_LP64_OFF64_CFLAGS
_CS_POSIX_V7_LP64_OFF64_LDFLAGS
_CS_POSIX_V7_LP64_OFF64_LIBS
_CS_POSIX_V7_LPBIG_OFFBIG_CFLAGS
_CS_POSIX_V7_LPBIG_OFFBIG_LDFLAGS
_CS_POSIX_V7_LPBIG_OFFBIG_LIBS
_CS_POSIX_V7_THREADS_CFLAGS
_CS_POSIX_V7_THREADS_LDFLAGS
_CS_POSIX_V7_WIDTH_RESTRICTED_ENVS
_CS_V7_ENV

This is per
http://pubs.opengroup.org/onlinepubs/9699919799/functions/confstr.html

The value for those #define's should likely match what is in the Linux
Software
Base: https://refspecs.linuxfoundation.org/LSB_1.2.0/gLSB.html That much
goes
in newlib.

The confstr() implementation will be a switch on those values and
I honestly don't even know what most of those should be in an
RTEMS environment.

But those are the names and we have to answer the question of what
is the appropriate value to return. A first implementation could return
something like getenv("PATH") for __CS_PATH, and take a swing at
the "obvious ones".

The ones with CFLAGS, LDFLAGS, and LIBS would first have
to evaluated to see if the name makes sense to provide a value
for. And then return the value. I am tending to lean to returning
empty string for all of those.

Looks like Linux doesn't support most of them:

http://man7.org/linux/man-pages/man3/confstr.3.html

I don't think this is a commonly used method so I would be perfectly
happy to support it in a minimal, but compliant manner.

Any other thoughts?


--joel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/devel/attachments/20170807/25f9d9dc/attachment.html>


More information about the devel mailing list