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.
This commit is contained in:
Jeff Johnston 2001-02-21 23:11:06 +00:00
parent fc168ded9e
commit 3a8fc0e4f1
3 changed files with 19 additions and 12 deletions

View File

@ -1,3 +1,10 @@
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.
Thu Feb 15 01:39:51 2001 Christopher Faylor <cgf@cygnus.com> Thu Feb 15 01:39:51 2001 Christopher Faylor <cgf@cygnus.com>
* libc/include/sys/signal.h: Always include sys/types.h under Cygwin. * libc/include/sys/signal.h: Always include sys/types.h under Cygwin.

View File

@ -252,7 +252,7 @@ case "${host}" in
#newlib_cflags="${newlib_cflags} -Werror" # DEBUGGING ONLY;BREAKS BUILD #newlib_cflags="${newlib_cflags} -Werror" # DEBUGGING ONLY;BREAKS BUILD
newlib_cflags="${newlib_cflags} -Wall" newlib_cflags="${newlib_cflags} -Wall"
newlib_cflags="${newlib_cflags} -D_I386MACH_ALLOW_HW_INTERRUPTS" newlib_cflags="${newlib_cflags} -D_I386MACH_ALLOW_HW_INTERRUPTS"
newlib_cflags="${newlib_cflags} -D_LOOSE_KERNEL_NAMES" newlib_cflags="${newlib_cflags} -D_LOOSE_KERNEL_NAMES -DHAVE_FCNTL"
# --- Required when building a shared library ------------------------ # --- Required when building a shared library ------------------------
newlib_cflags="${newlib_cflags} -fPIC -D_I386MACH_NEED_SOTYPE_FUNCTION" newlib_cflags="${newlib_cflags} -fPIC -D_I386MACH_NEED_SOTYPE_FUNCTION"
# --- The three lines below are optional ------------------------------ # --- The three lines below are optional ------------------------------
@ -326,7 +326,7 @@ esac
case "${host}" in case "${host}" in
*-*-cygwin*) *-*-cygwin*)
newlib_cflags="${newlib_cflags} -DHAVE_OPENDIR -DHAVE_RENAME -DSIGNAL_PROVIDED -DWANT_IO_LONG_DBL -DWANT_PRINTF_LONG_LONG -D_COMPILING_NEWLIB" newlib_cflags="${newlib_cflags} -DHAVE_OPENDIR -DHAVE_RENAME -DSIGNAL_PROVIDED -DWANT_IO_LONG_DBL -DWANT_PRINTF_LONG_LONG -D_COMPILING_NEWLIB -DHAVE_FCNTL"
syscall_dir=syscalls syscall_dir=syscalls
;; ;;
# RTEMS supplies its own versions of some routines: # RTEMS supplies its own versions of some routines:
@ -337,12 +337,12 @@ case "${host}" in
# #
# NOTE: When newlib malloc uses a semaphore, RTEMS will switch to that. # NOTE: When newlib malloc uses a semaphore, RTEMS will switch to that.
*-*-rtems*) *-*-rtems*)
newlib_cflags="${newlib_cflags} -DHAVE_GETTIMEOFDAY -DMALLOC_PROVIDED -DEXIT_PROVIDED -DMISSING_SYSCALL_NAMES -DSIGNAL_PROVIDED -DREENTRANT_SYSCALLS_PROVIDED -DHAVE_OPENDIR -DNO_EXEC -DWANT_PRINTF_LONG_LONG" newlib_cflags="${newlib_cflags} -DHAVE_GETTIMEOFDAY -DMALLOC_PROVIDED -DEXIT_PROVIDED -DMISSING_SYSCALL_NAMES -DSIGNAL_PROVIDED -DREENTRANT_SYSCALLS_PROVIDED -DHAVE_OPENDIR -DNO_EXEC -DWANT_PRINTF_LONG_LONG -DHAVE_FCNTL"
;; ;;
# VxWorks supplies its own version of malloc, and the newlib one # VxWorks supplies its own version of malloc, and the newlib one
# doesn't work because VxWorks does not have sbrk. # doesn't work because VxWorks does not have sbrk.
*-wrs-vxworks*) *-wrs-vxworks*)
newlib_cflags="${newlib_cflags} -DMALLOC_PROVIDED -DMISSING_SYSCALL_NAMES" newlib_cflags="${newlib_cflags} -DMALLOC_PROVIDED -DMISSING_SYSCALL_NAMES -DHAVE_FCNTL"
;; ;;
# UDI doesn't have exec, so system() should fail the right way # UDI doesn't have exec, so system() should fail the right way
a29k-amd-udi) a29k-amd-udi)
@ -393,13 +393,13 @@ case "${host}" in
newlib_cflags="${newlib_cflags} -DSMALL_DTOA -DSMALL_MEMORY" newlib_cflags="${newlib_cflags} -DSMALL_DTOA -DSMALL_MEMORY"
;; ;;
i[3456]86-*-sco*) i[3456]86-*-sco*)
newlib_cflags="${newlib_cflags} -DSIGNAL_PROVIDED" newlib_cflags="${newlib_cflags} -DSIGNAL_PROVIDED -DHAVE_FCNTL"
;; ;;
i[3456]86-*-netware*) i[3456]86-*-netware*)
newlib_cflags="${newlib_cflags} -DMISSING_SYSCALL_NAMES -DNO_EXEC -DABORT_PROVIDED -DCLOCK_PROVIDED -DMALLOC_PROVIDED" newlib_cflags="${newlib_cflags} -DMISSING_SYSCALL_NAMES -DNO_EXEC -DABORT_PROVIDED -DCLOCK_PROVIDED -DMALLOC_PROVIDED -DHAVE_FCNTL"
;; ;;
i[3456]86-*-go32) i[3456]86-*-go32)
newlib_cflags="${newlib_cflags} -DMISSING_SYSCALL_NAMES -DNO_EXEC" newlib_cflags="${newlib_cflags} -DMISSING_SYSCALL_NAMES -DNO_EXEC -DHAVE_FCNTL"
;; ;;
m32r-*-*) m32r-*-*)
# Pass -msdata=sdata so _impure_ptr goes in .sdata. # Pass -msdata=sdata so _impure_ptr goes in .sdata.
@ -425,7 +425,7 @@ case "${host}" in
newlib_cflags="${newlib_cflags} -mrelocatable-lib -mno-eabi -mstrict-align -DMISSING_SYSCALL_NAMES" newlib_cflags="${newlib_cflags} -mrelocatable-lib -mno-eabi -mstrict-align -DMISSING_SYSCALL_NAMES"
;; ;;
powerpcle-*-pe) powerpcle-*-pe)
newlib_cflags="${newlib_cflags} -DHAVE_OPENDIR -DHAVE_RENAME" newlib_cflags="${newlib_cflags} -DHAVE_OPENDIR -DHAVE_RENAME -DHAVE_FCNTL"
syscall_dir=syscalls syscall_dir=syscalls
;; ;;
sh*-*-*) sh*-*-*)
@ -436,7 +436,7 @@ case "${host}" in
newlib_cflags="${newlib_cflags} -DSIGNAL_PROVIDED" newlib_cflags="${newlib_cflags} -DSIGNAL_PROVIDED"
;; ;;
sparc64-*-*) sparc64-*-*)
newlib_cflags="${newlib_cflags} -DREENTRANT_SYSCALLS_PROVIDED -DHAVE_BLKSIZE -DHAVE_GETTIMEOFDAY" newlib_cflags="${newlib_cflags} -DREENTRANT_SYSCALLS_PROVIDED -DHAVE_BLKSIZE -DHAVE_GETTIMEOFDAY -DHAVE_FCNTL"
# This either belongs elsewhere or nowhere. But I need *something*, # This either belongs elsewhere or nowhere. But I need *something*,
# so for now it's here ... # so for now it's here ...
case "${host_os}" in case "${host_os}" in

View File

@ -55,7 +55,7 @@ _DEFUN (_fdopen_r, (ptr, fd, mode),
{ {
register FILE *fp; register FILE *fp;
int flags, oflags; int flags, oflags;
#ifdef F_GETFL #ifdef HAVE_FCNTL
int fdflags, fdmode; int fdflags, fdmode;
#endif #endif
@ -63,7 +63,7 @@ _DEFUN (_fdopen_r, (ptr, fd, mode),
return 0; return 0;
/* make sure the mode the user wants is a subset of the actual mode */ /* make sure the mode the user wants is a subset of the actual mode */
#ifdef F_GETFL #ifdef HAVE_FCNTL
if ((fdflags = _fcntl (fd, F_GETFL, 0)) < 0) if ((fdflags = _fcntl (fd, F_GETFL, 0)) < 0)
return 0; return 0;
fdmode = fdflags & O_ACCMODE; fdmode = fdflags & O_ACCMODE;
@ -83,7 +83,7 @@ _DEFUN (_fdopen_r, (ptr, fd, mode),
* __swrite() will lseek to end before each write. * __swrite() will lseek to end before each write.
*/ */
if ((oflags & O_APPEND) if ((oflags & O_APPEND)
#ifdef F_GETFL #ifdef HAVE_FCNTL
&& !(fdflags & O_APPEND) && !(fdflags & O_APPEND)
#endif #endif
) )