About popen()

Peter Dufault dufault at hda.com
Wed Mar 2 08:54:41 UTC 2011


Is there a standard compile-time method to test for the presence of popen()?  From looking at the open group page:
http://pubs.opengroup.org/onlinepubs/009695399/functions/popen.html
it appears that there isn't a compile-time one, you'd need to use sysconf(_SC_2_VERSION).

That would imply RTEMS should provide some kind of popen() stub that sets an appropriate errno and returns an error.  popen appears in the RTEMS stdio.h but is undefined at link time.  From the above link a popen() stub should probably return (after following the link to fork()):

[EAGAIN]
The system lacked the necessary resources to create another process, or the system-imposed limit on the total number of processes under execution system-wide or by a single user {CHILD_MAX} would be exceeded.

This is a can of worms the RTEMS project maybe doesn't want to open: The sysconf() test, an appropriate setting for CHILD_MAX, etc.  Maybe a link-time failure is preferable.

I'm just adding a -DNO_POPEN=1 conditional compilation.

Peter
-----------------
Peter Dufault
HD Associates, Inc.      Software and System Engineering





More information about the users mailing list