fdopen and _fcntl

J. Johnston jjohnstn@cygnus.com
Wed Feb 21 15:45:00 GMT 2001

A problem has occurred recently trying to link newlib with the new libstdc++ library v3 due to the
use of fdopen().  The libc/stdio/fdopen.c code was calling _fcntl() to verify the flags passed, but
_fcntl() is not one of the base newlib OS functions and most newlib embedded targets don't have it
either in newlib, libgloss, or as part of a bsp.  

I have checked in a fix whereby the _fcntl() calls in fdopen() are now protected by a check for
HAVE_FCNTL.  I have defined this flag in configure.host for a number of platforms, but I may have
missed some.  If you notice any configuration where this flag should be set, but isn't, please
notify the mailing list.

-- Jeff J.

2001-02-21  Jeff Johnston  <jjohnstn@redhat.com>

        * libc/stdio/fdopen.c (fdopen): Protect calls to _fcntl() with
        HAVE_FCNTL flag check.
        * configure.host: Define HAVE_FCNTL for Cygwin, go32, RTEMS, sparc64,
        powerpcle, x86 netware, x86 sco, x86 Linux and Vxworks.

More information about the Newlib mailing list