This defines a module for the 'ioctl' function, and moves its declaration from <sys/socket.h> to <sys/ioctl.h>.
Hopefully this is the last patch in this series of winsock-related restructuring. 2008-10-09 Bruno Haible <[EMAIL PROTECTED]> New module 'ioctl'. * modules/ioctl: New file. * lib/sys_socket.in.h (ioctl): Remove declaration. * lib/winsock.c: Include <sys/ioctl.h>. (rpl_ioctl): Define only of the gnulib module 'ioctl' is present. * m4/sys_socket_h.m4 (gl_PREREQ_SYS_H_WINSOCK2): Require gl_SYS_IOCTL_H_DEFAULTS. Set also SYS_IOCTL_H_HAVE_WINSOCK2_H. * modules/sys_socket (Files): Add m4/sys_ioctl_h.m4. * doc/posix-functions/ioctl.texi: Mention the new module. ======================== modules/ioctl ================================= Description: ioctl() function: issue device specific requests on files, devices, or sockets. Files: lib/winsock.c Depends-on: sys_ioctl sys_socket errno configure.ac: AC_REQUIRE([gl_HEADER_SYS_SOCKET]) if test "$ac_cv_header_winsock2_h" = yes; then AC_LIBOBJ([winsock]) gl_REPLACE_SYS_IOCTL_H fi gl_SYS_IOCTL_MODULE_INDICATOR([ioctl]) gl_MODULE_INDICATOR([ioctl]) Makefile.am: Include: <sys/ioctl.h> License: LGPLv2+ Maintainer: Paolo Bonzini, Simon Josefsson, Bruno Haible ======================================================================== *** lib/sys_socket.in.h.orig 2008-10-10 04:27:51.000000000 +0200 --- lib/sys_socket.in.h 2008-10-10 04:19:04.000000000 +0200 *************** *** 279,290 **** listen (s, b)) # endif - # if @HAVE_WINSOCK2_H@ - # undef ioctl - # define ioctl rpl_ioctl - extern int rpl_ioctl (int, int, ...); - # endif - # if @GNULIB_RECV@ # if @HAVE_WINSOCK2_H@ # undef recv --- 279,284 ---- *** lib/winsock.c.orig 2008-10-10 04:27:51.000000000 +0200 --- lib/winsock.c 2008-10-10 04:18:33.000000000 +0200 *************** *** 25,30 **** --- 25,33 ---- #include <fcntl.h> #include <io.h> #include <sys/socket.h> + #if GNULIB_IOCTL + #include <sys/ioctl.h> + #endif #undef socket #undef connect *************** *** 224,229 **** --- 227,233 ---- } #endif + #if GNULIB_IOCTL int rpl_ioctl (int fd, int req, ...) { *************** *** 243,248 **** --- 247,253 ---- return r; } + #endif #if GNULIB_RECV int *** m4/sys_socket_h.m4.orig 2008-10-10 04:27:51.000000000 +0200 --- m4/sys_socket_h.m4 2008-10-10 04:18:32.000000000 +0200 *************** *** 1,4 **** ! # sys_socket_h.m4 serial 9 dnl Copyright (C) 2005-2008 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, --- 1,4 ---- ! # sys_socket_h.m4 serial 10 dnl Copyright (C) 2005-2008 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, *************** *** 72,77 **** --- 72,78 ---- AC_DEFUN([gl_PREREQ_SYS_H_WINSOCK2], [ AC_REQUIRE([gl_UNISTD_H_DEFAULTS]) + AC_REQUIRE([gl_SYS_IOCTL_H_DEFAULTS]) AC_CHECK_HEADERS_ONCE([sys/socket.h]) if test $ac_cv_header_sys_socket_h != yes; then dnl We cannot use AC_CHECK_HEADERS_ONCE here, because that would make *************** *** 83,88 **** --- 84,90 ---- if test "$ac_cv_header_winsock2_h" = yes; then HAVE_WINSOCK2_H=1 UNISTD_H_HAVE_WINSOCK2_H=1 + SYS_IOCTL_H_HAVE_WINSOCK2_H=1 else HAVE_WINSOCK2_H=0 fi *** modules/sys_socket.orig 2008-10-10 04:27:51.000000000 +0200 --- modules/sys_socket 2008-10-10 04:18:32.000000000 +0200 *************** *** 7,12 **** --- 7,13 ---- m4/sys_socket_h.m4 m4/sockpfaf.m4 m4/unistd_h.m4 + m4/sys_ioctl_h.m4 Depends-on: include_next *** doc/posix-functions/ioctl.texi.orig 2008-10-10 04:27:51.000000000 +0200 --- doc/posix-functions/ioctl.texi 2008-10-10 04:18:32.000000000 +0200 *************** *** 4,10 **** POSIX specification: @url{http://www.opengroup.org/susv3xsh/ioctl.html} ! Gnulib module: sys_socket Portability problems fixed by Gnulib: @itemize --- 4,10 ---- POSIX specification: @url{http://www.opengroup.org/susv3xsh/ioctl.html} ! Gnulib module: ioctl Portability problems fixed by Gnulib: @itemize