From a8b0bc105630f27400f560cf59653f3d3c9ad29a Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Fri, 10 Oct 2008 04:33:25 +0200 Subject: [PATCH] New module 'ioctl'. --- ChangeLog | 12 ++++++++++++ doc/posix-functions/ioctl.texi | 2 +- lib/sys_socket.in.h | 6 ------ lib/winsock.c | 5 +++++ m4/sys_socket_h.m4 | 4 +++- modules/ioctl | 30 ++++++++++++++++++++++++++++++ modules/sys_socket | 1 + 7 files changed, 52 insertions(+), 8 deletions(-) create mode 100644 modules/ioctl diff --git a/ChangeLog b/ChangeLog index 09a89678e..37f0bbf4e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,17 @@ 2008-10-09 Bruno Haible + New module 'ioctl'. + * modules/ioctl: New file. + * lib/sys_socket.in.h (ioctl): Remove declaration. + * lib/winsock.c: Include . + (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. + +2008-10-09 Bruno Haible + New module 'sys_ioctl'. * lib/sys_ioctl.in.h: New file. * m4/sys_ioctl_h.m4: New file. diff --git a/doc/posix-functions/ioctl.texi b/doc/posix-functions/ioctl.texi index 86235d897..123069b8c 100644 --- a/doc/posix-functions/ioctl.texi +++ b/doc/posix-functions/ioctl.texi @@ -4,7 +4,7 @@ POSIX specification: @url{http://www.opengroup.org/susv3xsh/ioctl.html} -Gnulib module: sys_socket +Gnulib module: ioctl Portability problems fixed by Gnulib: @itemize diff --git a/lib/sys_socket.in.h b/lib/sys_socket.in.h index ddc4264ea..ad0860c70 100644 --- a/lib/sys_socket.in.h +++ b/lib/sys_socket.in.h @@ -279,12 +279,6 @@ extern int rpl_listen (int, int); 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 diff --git a/lib/winsock.c b/lib/winsock.c index 53b9336b9..2ca781363 100644 --- a/lib/winsock.c +++ b/lib/winsock.c @@ -25,6 +25,9 @@ #include #include #include +#if GNULIB_IOCTL +#include +#endif #undef socket #undef connect @@ -224,6 +227,7 @@ rpl_listen (int fd, int backlog) } #endif +#if GNULIB_IOCTL int rpl_ioctl (int fd, int req, ...) { @@ -243,6 +247,7 @@ rpl_ioctl (int fd, int req, ...) return r; } +#endif #if GNULIB_RECV int diff --git a/m4/sys_socket_h.m4 b/m4/sys_socket_h.m4 index e61de7bcb..e60ce7337 100644 --- a/m4/sys_socket_h.m4 +++ b/m4/sys_socket_h.m4 @@ -1,4 +1,4 @@ -# sys_socket_h.m4 serial 9 +# 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,6 +72,7 @@ AC_DEFUN([gl_HEADER_SYS_SOCKET], 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,6 +84,7 @@ AC_DEFUN([gl_PREREQ_SYS_H_WINSOCK2], 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 diff --git a/modules/ioctl b/modules/ioctl new file mode 100644 index 000000000..b425dee9d --- /dev/null +++ b/modules/ioctl @@ -0,0 +1,30 @@ +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: + + +License: +LGPLv2+ + +Maintainer: +Paolo Bonzini, Simon Josefsson, Bruno Haible diff --git a/modules/sys_socket b/modules/sys_socket index 0d435707e..016dedd59 100644 --- a/modules/sys_socket +++ b/modules/sys_socket @@ -7,6 +7,7 @@ lib/winsock.c m4/sys_socket_h.m4 m4/sockpfaf.m4 m4/unistd_h.m4 +m4/sys_ioctl_h.m4 Depends-on: include_next -- 2.11.0