[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

About popen()

Is there a standard compile-time method to test for the presence of popen()?  From looking at the open group page:
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()):

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 Dufault
HD Associates, Inc.      Software and System Engineering