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

About popen()

On 03/02/2011 09:54 AM, Peter Dufault wrote:
> 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()):

Another possibility would be a 'gnu configure' test which would fail
to link and then e.g., undefine HAVE_POPEN in 'config.h'. E.g.,
with autoconf:

AC_CHECK_FUNC([popen], [AC_DEFINE([HAVE_POPEN],[1], [Define if popen 

- T.

> [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
> _______________________________________________ rtems-users mailing
> list rtems-users at rtems.org
> http://www.rtems.org/mailman/listinfo/rtems-users