changeset 30307:8dd82105770d

New module 'ioctl'.
author Bruno Haible <bruno@clisp.org>
date Fri, 10 Oct 2008 04:33:25 +0200
parents b72336ea6096
children f3e7628fc1dd
files ChangeLog doc/posix-functions/ioctl.texi lib/sys_socket.in.h lib/winsock.c m4/sys_socket_h.m4 modules/ioctl modules/sys_socket
diffstat 7 files changed, 52 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Fri Oct 10 04:25:28 2008 +0200
+++ b/ChangeLog	Fri Oct 10 04:33:25 2008 +0200
@@ -1,3 +1,15 @@
+2008-10-09  Bruno Haible  <bruno@clisp.org>
+
+	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.
+
 2008-10-09  Bruno Haible  <bruno@clisp.org>
 
 	New module 'sys_ioctl'.
--- a/doc/posix-functions/ioctl.texi	Fri Oct 10 04:25:28 2008 +0200
+++ b/doc/posix-functions/ioctl.texi	Fri Oct 10 04:33:25 2008 +0200
@@ -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
--- a/lib/sys_socket.in.h	Fri Oct 10 04:25:28 2008 +0200
+++ b/lib/sys_socket.in.h	Fri Oct 10 04:33:25 2008 +0200
@@ -279,12 +279,6 @@
       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
--- a/lib/winsock.c	Fri Oct 10 04:25:28 2008 +0200
+++ b/lib/winsock.c	Fri Oct 10 04:33:25 2008 +0200
@@ -25,6 +25,9 @@
 #include <fcntl.h>
 #include <io.h>
 #include <sys/socket.h>
+#if GNULIB_IOCTL
+#include <sys/ioctl.h>
+#endif
 
 #undef socket
 #undef connect
@@ -224,6 +227,7 @@
 }
 #endif
 
+#if GNULIB_IOCTL
 int
 rpl_ioctl (int fd, int req, ...)
 {
@@ -243,6 +247,7 @@
 
   return r;
 }
+#endif
 
 #if GNULIB_RECV
 int
--- a/m4/sys_socket_h.m4	Fri Oct 10 04:25:28 2008 +0200
+++ b/m4/sys_socket_h.m4	Fri Oct 10 04:33:25 2008 +0200
@@ -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_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 @@
   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
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/ioctl	Fri Oct 10 04:33:25 2008 +0200
@@ -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:
+<sys/ioctl.h>
+
+License:
+LGPLv2+
+
+Maintainer:
+Paolo Bonzini, Simon Josefsson, Bruno Haible
--- a/modules/sys_socket	Fri Oct 10 04:25:28 2008 +0200
+++ b/modules/sys_socket	Fri Oct 10 04:33:25 2008 +0200
@@ -7,6 +7,7 @@
 m4/sys_socket_h.m4
 m4/sockpfaf.m4
 m4/unistd_h.m4
+m4/sys_ioctl_h.m4
 
 Depends-on:
 include_next