Bastien ROUCARIES wrote: > Moreover _get_osfhandle (fd) should be render safe globally. May be we > should create a <io.h> module ?
I think a separate .h file is best for this one. This fixes a number of test suite failures. 2011-09-23 Bruno Haible <br...@clisp.org> New module 'msvc-nothrow'. Makes _get_osfhandle safe on MSVC 9. * lib/msvc-nothrow.h: New file. * lib/msvc-nothrow.c: New file. * m4/msvc-nothrow.m4: New file. * modules/msvc-nothrow: New file. * lib/dup2.c: Include msvc-nothrow.h. (rpl_dup2): No need to protect _get_osfhandle call here. * lib/accept4.c: Include msvc-nothrow.h. * lib/error.c: Likewise. * lib/fcntl.c: Likewise. * lib/lseek.c: Likewise. * lib/nonblocking.c: Likewise. * lib/poll.c: Likewise. * lib/read.c: Likewise. * lib/select.c: Likewise. * lib/sockets.h: Likewise. * lib/sockets.c: Likewise. * lib/stdio-read.c: Likewise. * lib/stdio-write.c: Likewise. * lib/write.c: Likewise. * lib/w32sock.h: Likewise. * lib/w32spawn.h: Likewise. * lib/flock.c: Include msvc-nothrow.h instead of <io.h>. * lib/fsync.c: Likewise. * lib/isapipe.c: Likewise. * modules/dup2 (Depends-on): Add msvc-nothrow. * modules/accept4 (Depends-on): Likewise. * modules/error (Depends-on): Likewise. * modules/fcntl (Depends-on): Likewise. * modules/lseek (Depends-on): Likewise. * modules/nonblocking (Depends-on): Likewise. * modules/poll (Depends-on): Likewise. * modules/read (Depends-on): Likewise. * modules/select (Depends-on): Likewise. * modules/sockets (Depends-on): Likewise. * modules/sigpipe (Depends-on): Likewise. * modules/write (Depends-on): Likewise. * modules/accept (Depends-on): Likewise. * modules/bind (Depends-on): Likewise. * modules/connect (Depends-on): Likewise. * modules/gethostname (Depends-on): Likewise. * modules/getpeername (Depends-on): Likewise. * modules/getsockname (Depends-on): Likewise. * modules/getsockopt (Depends-on): Likewise. * modules/ioctl (Depends-on): Likewise. * modules/listen (Depends-on): Likewise. * modules/recv (Depends-on): Likewise. * modules/recvfrom (Depends-on): Likewise. * modules/send (Depends-on): Likewise. * modules/sendto (Depends-on): Likewise. * modules/setsockopt (Depends-on): Likewise. * modules/shutdown (Depends-on): Likewise. * modules/socket (Depends-on): Likewise. * modules/execute (Depends-on): Likewise. * modules/spawn-pipe (Depends-on): Likewise. * modules/flock (Depends-on): Likewise. * modules/fsync (Depends-on): Likewise. * modules/isapipe (Depends-on): Likewise. * tests/test-cloexec.c: Include msvc-nothrow.h. * tests/test-dup-safer.c: Likewise. * tests/test-dup2.c: Likewise. * tests/test-dup3.c: Likewise. * tests/test-fcntl.c: Likewise. * tests/test-pipe.c: Likewise. * tests/test-pipe2.c: Likewise. * modules/cloexec-tests (Depends-on): Add msvc-nothrow. * modules/unistd-safer-tests (Depends-on): Likewise. * modules/dup2-tests (Depends-on): Likewise. * modules/dup3-tests (Depends-on): Likewise. * modules/fcntl-tests (Depends-on): Likewise. * modules/pipe-posix-tests (Depends-on): Likewise. * modules/pipe2-tests (Depends-on): Likewise. ============================= lib/msvc-nothrow.h ============================= /* Wrappers that don't throw invalid parameter notifications with MSVC runtime libraries. Copyright (C) 2011 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef _MSVC_NOTHROW_H #define _MSVC_NOTHROW_H /* With MSVC runtime libraries with the "invalid parameter handler" concept, functions like fprintf(), dup2(), or close() crash when the caller passes an invalid argument. But POSIX wants error codes (such as EINVAL or EBADF) instead. This file defines wrappers that turn such an invalid parameter notification into an error code. */ #if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ /* Get original declaration of _get_osfhandle. */ # include <io.h> # if HAVE_MSVC_INVALID_PARAMETER_HANDLER /* Override _get_osfhandle. */ extern intptr_t _gl_nothrow_get_osfhandle (int fd); # define _get_osfhandle _gl_nothrow_get_osfhandle # endif #endif #endif /* _MSVC_NOTHROW_H */ ============================= lib/msvc-nothrow.c ============================= /* Wrappers that don't throw invalid parameter notifications with MSVC runtime libraries. Copyright (C) 2011 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include <config.h> /* Specification. */ #include "msvc-nothrow.h" /* Get declarations of the Win32 API functions. */ #define WIN32_LEAN_AND_MEAN #include <windows.h> #include "msvc-inval.h" #undef _get_osfhandle #if HAVE_MSVC_INVALID_PARAMETER_HANDLER intptr_t _gl_nothrow_get_osfhandle (int fd) { intptr_t result; TRY_MSVC_INVAL { result = _get_osfhandle (fd); } CATCH_MSVC_INVAL { result = INVALID_HANDLE_VALUE; } DONE_MSVC_INVAL; return result; } #endif ============================= m4/msvc-nothrow.m4 ============================= # msvc-nothrow.m4 serial 1 dnl Copyright (C) 2011 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. AC_DEFUN([gl_MSVC_NOTHROW], [ AC_REQUIRE([gl_MSVC_INVAL]) ]) ============================ modules/msvc-nothrow ============================ Description: wrappers that don't throw invalid parameter notifications with MSVC runtime libraries Files: lib/msvc-nothrow.h lib/msvc-nothrow.c m4/msvc-nothrow.m4 Depends-on: msvc-inval configure.ac: gl_MSVC_NOTHROW if test $HAVE_MSVC_INVALID_PARAMETER_HANDLER = 1; then AC_LIBOBJ([msvc-nothrow]) fi Makefile.am: Include: "msvc-nothrow.h" License: LGPLv2+ Maintainer: Bruno Haible ============================================================================== --- lib/accept4.c.orig Fri Sep 23 21:07:01 2011 +++ lib/accept4.c Fri Sep 23 21:00:07 2011 @@ -23,6 +23,7 @@ #include <errno.h> #include <fcntl.h> #include "binary-io.h" +#include "msvc-nothrow.h" #ifndef SOCK_CLOEXEC # define SOCK_CLOEXEC 0 --- lib/dup2.c.orig Fri Sep 23 21:07:01 2011 +++ lib/dup2.c Fri Sep 23 21:00:07 2011 @@ -29,6 +29,8 @@ /* Get declarations of the Win32 API functions. */ # define WIN32_LEAN_AND_MEAN # include <windows.h> +/* Get _get_osfhandle. */ +# include "msvc-nothrow.h" #endif #include "msvc-inval.h" @@ -70,19 +72,7 @@ future dup2 calls will hang. */ if (fd == desired_fd) { - HANDLE handle; - - TRY_MSVC_INVAL - { - handle = (HANDLE) _get_osfhandle (fd); - } - CATCH_MSVC_INVAL - { - handle = INVALID_HANDLE_VALUE; - } - DONE_MSVC_INVAL; - - if (handle == INVALID_HANDLE_VALUE) + if ((HANDLE) _get_osfhandle (fd) == INVALID_HANDLE_VALUE) { errno = EBADF; return -1; --- lib/error.c.orig Fri Sep 23 21:07:02 2011 +++ lib/error.c Fri Sep 23 21:00:07 2011 @@ -92,6 +92,8 @@ /* Get declarations of the Win32 API functions. */ # define WIN32_LEAN_AND_MEAN # include <windows.h> +/* Get _get_osfhandle. */ +# include "msvc-nothrow.h" # endif /* The gnulib override of fcntl is not needed in this file. */ --- lib/fcntl.c.orig Fri Sep 23 21:07:02 2011 +++ lib/fcntl.c Fri Sep 23 21:00:07 2011 @@ -37,6 +37,9 @@ # define WIN32_LEAN_AND_MEAN # include <windows.h> +/* Get _get_osfhandle. */ +# include "msvc-nothrow.h" + /* Upper bound on getdtablesize(). See lib/getdtablesize.c. */ # define OPEN_MAX_MAX 0x10000 --- lib/flock.c.orig Fri Sep 23 21:07:02 2011 +++ lib/flock.c Fri Sep 23 21:00:07 2011 @@ -26,15 +26,15 @@ #if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ -/* _get_osfhandle */ -# include <io.h> - /* LockFileEx */ # define WIN32_LEAN_AND_MEAN # include <windows.h> # include <errno.h> +/* _get_osfhandle */ +# include "msvc-nothrow.h" + /* Determine the current size of a file. Because the other braindead * APIs we'll call need lower/upper 32 bit pairs, keep the file size * like that too. --- lib/fsync.c.orig Fri Sep 23 21:07:02 2011 +++ lib/fsync.c Fri Sep 23 21:00:07 2011 @@ -27,15 +27,15 @@ #if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ -/* _get_osfhandle */ -# include <io.h> - /* FlushFileBuffers */ # define WIN32_LEAN_AND_MEAN # include <windows.h> # include <errno.h> +/* Get _get_osfhandle. */ +# include "msvc-nothrow.h" + int fsync (int fd) { --- lib/isapipe.c.orig Fri Sep 23 21:07:02 2011 +++ lib/isapipe.c Fri Sep 23 21:00:07 2011 @@ -26,12 +26,12 @@ #if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ /* Windows platforms. */ -/* Get _get_osfhandle. */ -# include <io.h> - /* Get GetFileType. */ # include <windows.h> +/* Get _get_osfhandle. */ +# include "msvc-nothrow.h" + int isapipe (int fd) { --- lib/lseek.c.orig Fri Sep 23 21:07:02 2011 +++ lib/lseek.c Fri Sep 23 21:00:07 2011 @@ -24,6 +24,8 @@ /* Windows platforms. */ /* Get GetFileType. */ # include <windows.h> +/* Get _get_osfhandle. */ +# include "msvc-nothrow.h" #else # include <sys/stat.h> #endif --- lib/nonblocking.c.orig Fri Sep 23 21:07:02 2011 +++ lib/nonblocking.c Fri Sep 23 21:00:07 2011 @@ -32,6 +32,8 @@ # define WIN32_LEAN_AND_MEAN # include <windows.h> +# include "msvc-nothrow.h" + int get_nonblocking_flag (int desc) { --- lib/poll.c.orig Fri Sep 23 21:07:02 2011 +++ lib/poll.c Fri Sep 23 21:00:07 2011 @@ -43,6 +43,7 @@ # include <io.h> # include <stdio.h> # include <conio.h> +# include "msvc-nothrow.h" #else # include <sys/time.h> # include <sys/socket.h> --- lib/read.c.orig Fri Sep 23 21:07:02 2011 +++ lib/read.c Fri Sep 23 21:00:07 2011 @@ -31,6 +31,8 @@ # define WIN32_LEAN_AND_MEAN /* avoid including junk */ # include <windows.h> +# include "msvc-nothrow.h" + ssize_t rpl_read (int fd, void *buf, size_t count) #undef read --- lib/select.c.orig Fri Sep 23 21:07:02 2011 +++ lib/select.c Fri Sep 23 21:00:07 2011 @@ -37,6 +37,8 @@ #include <conio.h> #include <time.h> +#include "msvc-nothrow.h" + struct bitset { unsigned char in[FD_SETSIZE / CHAR_BIT]; unsigned char out[FD_SETSIZE / CHAR_BIT]; --- lib/sockets.c.orig Fri Sep 23 21:07:02 2011 +++ lib/sockets.c Fri Sep 23 21:00:07 2011 @@ -28,6 +28,7 @@ # include <sys/socket.h> # include "fd-hook.h" +# include "msvc-nothrow.h" /* Get set_winsock_errno, FD_TO_SOCKET etc. */ # include "w32sock.h" --- lib/sockets.h.orig Fri Sep 23 21:07:02 2011 +++ lib/sockets.h Fri Sep 23 21:00:07 2011 @@ -36,6 +36,8 @@ #include <sys/socket.h> +#include "msvc-nothrow.h" + static inline SOCKET gl_fd_to_handle (int fd) { --- lib/stdio-read.c.orig Fri Sep 23 21:07:02 2011 +++ lib/stdio-read.c Fri Sep 23 21:00:07 2011 @@ -37,6 +37,8 @@ # define WIN32_LEAN_AND_MEAN /* avoid including junk */ # include <windows.h> +# include "msvc-nothrow.h" + # define CALL_WITH_ERRNO_FIX(RETTYPE, EXPRESSION, FAILED) \ if (ferror (stream)) \ return (EXPRESSION); \ --- lib/stdio-write.c.orig Fri Sep 23 21:07:02 2011 +++ lib/stdio-write.c Fri Sep 23 21:00:07 2011 @@ -39,6 +39,8 @@ # define WIN32_LEAN_AND_MEAN /* avoid including junk */ # include <windows.h> +# include "msvc-nothrow.h" + # if GNULIB_NONBLOCKING # define CLEAR_ERRNO \ errno = 0; --- lib/w32sock.h.orig Fri Sep 23 21:07:02 2011 +++ lib/w32sock.h Fri Sep 23 21:00:07 2011 @@ -22,9 +22,12 @@ /* Get O_RDWR and O_BINARY. */ #include <fcntl.h> -/* Get _get_osfhandle() and _open_osfhandle(). */ +/* Get _open_osfhandle(). */ #include <io.h> +/* Get _get_osfhandle(). */ +#include "msvc-nothrow.h" + #define FD_TO_SOCKET(fd) ((SOCKET) _get_osfhandle ((fd))) #define SOCKET_TO_FD(fh) (_open_osfhandle ((long) (fh), O_RDWR | O_BINARY)) --- lib/w32spawn.h.orig Fri Sep 23 21:07:02 2011 +++ lib/w32spawn.h Fri Sep 23 21:00:07 2011 @@ -19,7 +19,7 @@ #define WIN32_LEAN_AND_MEAN #include <windows.h> -/* Get _get_osfhandle() and _open_osfhandle(). */ +/* Get _open_osfhandle(). */ #include <io.h> #include <stdbool.h> @@ -27,6 +27,9 @@ #include <unistd.h> #include <errno.h> +/* Get _get_osfhandle(). */ +#include "msvc-nothrow.h" + #include "cloexec.h" #include "xalloc.h" --- lib/write.c.orig Fri Sep 23 21:07:02 2011 +++ lib/write.c Fri Sep 23 21:00:07 2011 @@ -38,6 +38,8 @@ # define WIN32_LEAN_AND_MEAN /* avoid including junk */ # include <windows.h> +# include "msvc-nothrow.h" + ssize_t rpl_write (int fd, const void *buf, size_t count) #undef write --- modules/accept.orig Fri Sep 23 21:07:02 2011 +++ modules/accept Fri Sep 23 21:00:07 2011 @@ -9,6 +9,7 @@ sys_socket socketlib errno [test "$ac_cv_header_winsock2_h" = yes] +msvc-nothrow [test "$ac_cv_header_winsock2_h" = yes] configure.ac: AC_REQUIRE([gl_HEADER_SYS_SOCKET]) --- modules/accept4.orig Fri Sep 23 21:07:02 2011 +++ modules/accept4 Fri Sep 23 21:00:07 2011 @@ -12,6 +12,7 @@ fcntl-h binary-io extensions +msvc-nothrow configure.ac: gl_FUNC_ACCEPT4 --- modules/bind.orig Fri Sep 23 21:07:02 2011 +++ modules/bind Fri Sep 23 21:00:07 2011 @@ -9,6 +9,7 @@ sys_socket socketlib errno [test "$ac_cv_header_winsock2_h" = yes] +msvc-nothrow [test "$ac_cv_header_winsock2_h" = yes] configure.ac: AC_REQUIRE([gl_HEADER_SYS_SOCKET]) --- modules/cloexec-tests.orig Fri Sep 23 21:07:02 2011 +++ modules/cloexec-tests Fri Sep 23 21:00:07 2011 @@ -4,6 +4,7 @@ Depends-on: binary-io +msvc-nothrow configure.ac: --- modules/connect.orig Fri Sep 23 21:07:02 2011 +++ modules/connect Fri Sep 23 21:00:07 2011 @@ -9,6 +9,7 @@ sys_socket socketlib errno [test "$ac_cv_header_winsock2_h" = yes] +msvc-nothrow [test "$ac_cv_header_winsock2_h" = yes] configure.ac: AC_REQUIRE([gl_HEADER_SYS_SOCKET]) --- modules/dup2.orig Fri Sep 23 21:07:02 2011 +++ modules/dup2 Fri Sep 23 21:00:07 2011 @@ -9,6 +9,7 @@ unistd dup2-obsolete msvc-inval [test $HAVE_DUP2 = 0 || test $REPLACE_DUP2 = 1] +msvc-nothrow [test $HAVE_DUP2 = 0 || test $REPLACE_DUP2 = 1] configure.ac: gl_FUNC_DUP2 --- modules/dup2-tests.orig Fri Sep 23 21:07:02 2011 +++ modules/dup2-tests Fri Sep 23 21:00:07 2011 @@ -5,6 +5,7 @@ Depends-on: binary-io +msvc-nothrow open configure.ac: --- modules/dup3-tests.orig Fri Sep 23 21:07:02 2011 +++ modules/dup3-tests Fri Sep 23 21:00:07 2011 @@ -4,6 +4,7 @@ tests/macros.h Depends-on: +msvc-nothrow open configure.ac: --- modules/error.orig Fri Sep 23 21:07:02 2011 +++ modules/error Fri Sep 23 21:00:07 2011 @@ -14,6 +14,7 @@ Depends-on: strerror [test $ac_cv_lib_error_at_line = no] unistd [test $ac_cv_lib_error_at_line = no] +msvc-nothrow [test $ac_cv_lib_error_at_line = no] configure.ac: gl_ERROR --- modules/execute.orig Fri Sep 23 21:07:02 2011 +++ modules/execute Fri Sep 23 21:00:07 2011 @@ -14,6 +14,7 @@ fatal-signal wait-process gettext-h +msvc-nothrow spawn posix_spawnp posix_spawn_file_actions_init --- modules/fcntl.orig Fri Sep 23 21:07:02 2011 +++ modules/fcntl Fri Sep 23 21:00:07 2011 @@ -10,6 +10,7 @@ extensions dup2 [test $HAVE_FCNTL = 0 || test $REPLACE_FCNTL = 1] getdtablesize [test $HAVE_FCNTL = 0 || test $REPLACE_FCNTL = 1] +msvc-nothrow [test $HAVE_FCNTL = 0 || test $REPLACE_FCNTL = 1] configure.ac: gl_FUNC_FCNTL --- modules/fcntl-tests.orig Fri Sep 23 21:07:02 2011 +++ modules/fcntl-tests Fri Sep 23 21:00:07 2011 @@ -6,6 +6,7 @@ Depends-on: binary-io getdtablesize +msvc-nothrow stdbool configure.ac: --- modules/flock.orig Fri Sep 23 21:07:02 2011 +++ modules/flock Fri Sep 23 21:00:07 2011 @@ -7,6 +7,7 @@ Depends-on: sys_file +msvc-nothrow [test $HAVE_FLOCK = 0] configure.ac: gl_FUNC_FLOCK --- modules/fsync.orig Fri Sep 23 21:07:02 2011 +++ modules/fsync Fri Sep 23 21:00:07 2011 @@ -7,6 +7,7 @@ Depends-on: unistd +msvc-nothrow [test $HAVE_FSYNC = 0] configure.ac: gl_FUNC_FSYNC --- modules/gethostname.orig Fri Sep 23 21:07:02 2011 +++ modules/gethostname Fri Sep 23 21:00:07 2011 @@ -11,6 +11,7 @@ sys_socket [test $HAVE_GETHOSTNAME = 0] errno [test $HAVE_GETHOSTNAME = 0] sockets [test $HAVE_GETHOSTNAME = 0] +msvc-nothrow [test $HAVE_GETHOSTNAME = 0] configure.ac: gl_FUNC_GETHOSTNAME --- modules/getpeername.orig Fri Sep 23 21:07:02 2011 +++ modules/getpeername Fri Sep 23 21:00:07 2011 @@ -10,6 +10,7 @@ sys_socket socketlib errno [test "$ac_cv_header_winsock2_h" = yes] +msvc-nothrow [test "$ac_cv_header_winsock2_h" = yes] configure.ac: AC_REQUIRE([gl_HEADER_SYS_SOCKET]) --- modules/getsockname.orig Fri Sep 23 21:07:02 2011 +++ modules/getsockname Fri Sep 23 21:00:07 2011 @@ -10,6 +10,7 @@ sys_socket socketlib errno [test "$ac_cv_header_winsock2_h" = yes] +msvc-nothrow [test "$ac_cv_header_winsock2_h" = yes] configure.ac: AC_REQUIRE([gl_HEADER_SYS_SOCKET]) --- modules/getsockopt.orig Fri Sep 23 21:07:02 2011 +++ modules/getsockopt Fri Sep 23 21:00:07 2011 @@ -10,6 +10,7 @@ socketlib sys_time [test "$ac_cv_header_winsock2_h" = yes] errno [test "$ac_cv_header_winsock2_h" = yes] +msvc-nothrow [test "$ac_cv_header_winsock2_h" = yes] configure.ac: AC_REQUIRE([gl_HEADER_SYS_SOCKET]) --- modules/ioctl.orig Fri Sep 23 21:07:02 2011 +++ modules/ioctl Fri Sep 23 21:00:07 2011 @@ -11,6 +11,7 @@ sys_socket [test $HAVE_IOCTL = 0 || test $REPLACE_IOCTL = 1] errno [test $HAVE_IOCTL = 0 || test $REPLACE_IOCTL = 1] fd-hook [test $HAVE_IOCTL = 0 || test $REPLACE_IOCTL = 1] +msvc-nothrow [test $HAVE_IOCTL = 0 || test $REPLACE_IOCTL = 1] configure.ac: gl_FUNC_IOCTL --- modules/isapipe.orig Fri Sep 23 21:07:02 2011 +++ modules/isapipe Fri Sep 23 21:00:07 2011 @@ -10,6 +10,7 @@ stdbool [test $HAVE_ISAPIPE = 0] sys_stat [test $HAVE_ISAPIPE = 0] unistd [test $HAVE_ISAPIPE = 0] +msvc-nothrow [test $HAVE_ISAPIPE = 0] configure.ac: gl_ISAPIPE --- modules/listen.orig Fri Sep 23 21:07:02 2011 +++ modules/listen Fri Sep 23 21:00:07 2011 @@ -9,6 +9,7 @@ sys_socket socketlib errno [test "$ac_cv_header_winsock2_h" = yes] +msvc-nothrow [test "$ac_cv_header_winsock2_h" = yes] configure.ac: AC_REQUIRE([gl_HEADER_SYS_SOCKET]) --- modules/lseek.orig Fri Sep 23 21:07:02 2011 +++ modules/lseek Fri Sep 23 21:00:07 2011 @@ -8,6 +8,7 @@ Depends-on: unistd largefile +msvc-nothrow [test $REPLACE_LSEEK = 1] configure.ac: gl_FUNC_LSEEK --- modules/nonblocking.orig Fri Sep 23 21:07:02 2011 +++ modules/nonblocking Fri Sep 23 21:00:07 2011 @@ -12,6 +12,7 @@ Depends-on: fcntl-h ioctl +msvc-nothrow stdbool stdio sys_socket --- modules/pipe-posix-tests.orig Fri Sep 23 21:07:02 2011 +++ modules/pipe-posix-tests Fri Sep 23 21:00:07 2011 @@ -6,6 +6,7 @@ Depends-on: stdbool binary-io +msvc-nothrow configure.ac: --- modules/pipe2-tests.orig Fri Sep 23 21:07:02 2011 +++ modules/pipe2-tests Fri Sep 23 21:00:07 2011 @@ -5,6 +5,7 @@ Depends-on: stdbool +msvc-nothrow configure.ac: --- modules/poll.orig Fri Sep 23 21:07:02 2011 +++ modules/poll Fri Sep 23 21:00:07 2011 @@ -12,6 +12,7 @@ sys_select [test $HAVE_POLL = 0 || test $REPLACE_POLL = 1] sys_time [test $HAVE_POLL = 0 || test $REPLACE_POLL = 1] errno [test $HAVE_POLL = 0 || test $REPLACE_POLL = 1] +msvc-nothrow [test $HAVE_POLL = 0 || test $REPLACE_POLL = 1] configure.ac: gl_FUNC_POLL --- modules/read.orig Fri Sep 23 21:07:02 2011 +++ modules/read Fri Sep 23 21:00:07 2011 @@ -7,6 +7,7 @@ Depends-on: unistd +msvc-nothrow [test $REPLACE_READ = 1] configure.ac: gl_FUNC_READ --- modules/recv.orig Fri Sep 23 21:07:02 2011 +++ modules/recv Fri Sep 23 21:00:07 2011 @@ -9,6 +9,7 @@ sys_socket socketlib errno [test "$ac_cv_header_winsock2_h" = yes] +msvc-nothrow [test "$ac_cv_header_winsock2_h" = yes] configure.ac: AC_REQUIRE([gl_HEADER_SYS_SOCKET]) --- modules/recvfrom.orig Fri Sep 23 21:07:02 2011 +++ modules/recvfrom Fri Sep 23 21:00:07 2011 @@ -10,6 +10,7 @@ socketlib errno [test "$ac_cv_header_winsock2_h" = yes] getpeername [test "$ac_cv_header_winsock2_h" = yes] +msvc-nothrow [test "$ac_cv_header_winsock2_h" = yes] configure.ac: AC_REQUIRE([gl_HEADER_SYS_SOCKET]) --- modules/select.orig Fri Sep 23 21:07:02 2011 +++ modules/select Fri Sep 23 21:00:07 2011 @@ -9,6 +9,7 @@ sys_select alloca [test $REPLACE_SELECT = 1] sockets [test $REPLACE_SELECT = 1] +msvc-nothrow [test $REPLACE_SELECT = 1] configure.ac: gl_FUNC_SELECT --- modules/send.orig Fri Sep 23 21:07:02 2011 +++ modules/send Fri Sep 23 21:00:07 2011 @@ -9,6 +9,7 @@ sys_socket socketlib errno [test "$ac_cv_header_winsock2_h" = yes] +msvc-nothrow [test "$ac_cv_header_winsock2_h" = yes] configure.ac: AC_REQUIRE([gl_HEADER_SYS_SOCKET]) --- modules/sendto.orig Fri Sep 23 21:07:02 2011 +++ modules/sendto Fri Sep 23 21:00:07 2011 @@ -9,6 +9,7 @@ sys_socket socketlib errno [test "$ac_cv_header_winsock2_h" = yes] +msvc-nothrow [test "$ac_cv_header_winsock2_h" = yes] configure.ac: AC_REQUIRE([gl_HEADER_SYS_SOCKET]) --- modules/setsockopt.orig Fri Sep 23 21:07:02 2011 +++ modules/setsockopt Fri Sep 23 21:00:07 2011 @@ -10,6 +10,7 @@ socketlib sys_time [test "$ac_cv_header_winsock2_h" = yes] errno [test "$ac_cv_header_winsock2_h" = yes] +msvc-nothrow [test "$ac_cv_header_winsock2_h" = yes] configure.ac: AC_REQUIRE([gl_HEADER_SYS_SOCKET]) --- modules/shutdown.orig Fri Sep 23 21:07:02 2011 +++ modules/shutdown Fri Sep 23 21:00:07 2011 @@ -9,6 +9,7 @@ sys_socket socketlib errno [test "$ac_cv_header_winsock2_h" = yes] +msvc-nothrow [test "$ac_cv_header_winsock2_h" = yes] configure.ac: AC_REQUIRE([gl_HEADER_SYS_SOCKET]) --- modules/sigpipe.orig Fri Sep 23 21:07:02 2011 +++ modules/sigpipe Fri Sep 23 21:00:07 2011 @@ -12,6 +12,7 @@ m4/asm-underscore.m4 Depends-on: +msvc-nothrow raise signal sigprocmask --- modules/socket.orig Fri Sep 23 21:07:02 2011 +++ modules/socket Fri Sep 23 21:00:07 2011 @@ -10,6 +10,7 @@ socketlib errno [test "$ac_cv_header_winsock2_h" = yes] sockets [test "$ac_cv_header_winsock2_h" = yes] +msvc-nothrow [test "$ac_cv_header_winsock2_h" = yes] configure.ac: AC_REQUIRE([gl_HEADER_SYS_SOCKET]) --- modules/sockets.orig Fri Sep 23 21:07:02 2011 +++ modules/sockets Fri Sep 23 21:00:07 2011 @@ -11,6 +11,7 @@ socketlib sys_socket fd-hook +msvc-nothrow configure.ac: gl_SOCKETS --- modules/spawn-pipe.orig Fri Sep 23 21:07:02 2011 +++ modules/spawn-pipe Fri Sep 23 21:00:07 2011 @@ -14,6 +14,7 @@ error fatal-signal gettext-h +msvc-nothrow open pipe2 pipe2-safer --- modules/unistd-safer-tests.orig Fri Sep 23 21:07:02 2011 +++ modules/unistd-safer-tests Fri Sep 23 21:00:07 2011 @@ -6,6 +6,7 @@ binary-io cloexec fd-safer-flag +msvc-nothrow stdbool configure.ac: --- modules/write.orig Fri Sep 23 21:07:02 2011 +++ modules/write Fri Sep 23 21:00:07 2011 @@ -8,6 +8,7 @@ Depends-on: unistd raise [test $REPLACE_WRITE = 1] +msvc-nothrow [test $REPLACE_WRITE = 1] configure.ac: gl_FUNC_WRITE --- tests/test-cloexec.c.orig Fri Sep 23 21:07:03 2011 +++ tests/test-cloexec.c Fri Sep 23 21:00:07 2011 @@ -28,6 +28,8 @@ /* Get declarations of the Win32 API functions. */ # define WIN32_LEAN_AND_MEAN # include <windows.h> +/* Get _get_osfhandle. */ +# include "msvc-nothrow.h" #endif #include "binary-io.h" --- tests/test-dup-safer.c.orig Fri Sep 23 21:07:03 2011 +++ tests/test-dup-safer.c Fri Sep 23 21:00:07 2011 @@ -32,6 +32,8 @@ /* Get declarations of the Win32 API functions. */ # define WIN32_LEAN_AND_MEAN # include <windows.h> +/* Get _get_osfhandle. */ +# include "msvc-nothrow.h" #endif #if !O_BINARY --- tests/test-dup2.c.orig Fri Sep 23 21:07:03 2011 +++ tests/test-dup2.c Fri Sep 23 21:00:07 2011 @@ -36,6 +36,8 @@ /* Get declarations of the Win32 API functions. */ # define WIN32_LEAN_AND_MEAN # include <windows.h> +/* Get _get_osfhandle. */ +# include "msvc-nothrow.h" #endif #include "macros.h" --- tests/test-dup3.c.orig Fri Sep 23 21:07:03 2011 +++ tests/test-dup3.c Fri Sep 23 21:00:07 2011 @@ -32,6 +32,8 @@ /* Get declarations of the Win32 API functions. */ # define WIN32_LEAN_AND_MEAN # include <windows.h> +/* Get _get_osfhandle. */ +# include "msvc-nothrow.h" #endif #include "binary-io.h" --- tests/test-fcntl.c.orig Fri Sep 23 21:07:03 2011 +++ tests/test-fcntl.c Fri Sep 23 21:00:07 2011 @@ -34,6 +34,8 @@ /* Get declarations of the Win32 API functions. */ # define WIN32_LEAN_AND_MEAN # include <windows.h> +/* Get _get_osfhandle. */ +# include "msvc-nothrow.h" #endif #include "binary-io.h" --- tests/test-pipe.c.orig Fri Sep 23 21:07:03 2011 +++ tests/test-pipe.c Fri Sep 23 21:00:07 2011 @@ -29,6 +29,8 @@ /* Get declarations of the Win32 API functions. */ # define WIN32_LEAN_AND_MEAN # include <windows.h> +/* Get _get_osfhandle. */ +# include "msvc-nothrow.h" #endif #include "binary-io.h" --- tests/test-pipe2.c.orig Fri Sep 23 21:07:03 2011 +++ tests/test-pipe2.c Fri Sep 23 21:00:07 2011 @@ -29,6 +29,8 @@ /* Get declarations of the Win32 API functions. */ # define WIN32_LEAN_AND_MEAN # include <windows.h> +/* Get _get_osfhandle. */ +# include "msvc-nothrow.h" #endif #include "binary-io.h" -- In memoriam Ghazala Khan <http://en.wikipedia.org/wiki/Ghazala_Khan>