bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: winsock.c split


From: Bruno Haible
Subject: Re: winsock.c split
Date: Tue, 21 Oct 2008 13:06:08 +0200
User-agent: KMail/1.5.4

Hi Simon,

> I have pushed this, but would appreciate testing and review.

Everything's fine, except the change of doc/posix-functions/close.texi.
(close() sets errno also under Windows, only closesocket() does not.)

> In particular, I'm not sure the close module is handled correctly.

It's correct.

I'm proposing this addendum, mostly simplifications.


2008-10-21  Bruno Haible  <address@hidden>

        Simplification.
        * lib/sys_socket.in.h (_gl_close_fd_maybe_socket): Remove declaration.
        * lib/close.c (_gl_close_fd_maybe_socket): Make static.

        Simplification.
        * lib/ioctl.c (ioctl): Don't undefine.
        * lib/socket.c (socket): Don't undefine.

        Remove unused module indicator macros.
        * m4/sys_socket_h.m4 (gl_SYS_SOCKET_MODULE_INDICATOR): Don't define
        GNULIB_$1 as a C macro.

        * doc/posix-functions/close.texi: Undo last change.
        * doc/posix-functions/ioctl.texi: Merge the two paragraphs about
        Windows platforms.

*** lib/sys_socket.in.h.orig    2008-10-21 12:58:54.000000000 +0200
--- lib/sys_socket.in.h 2008-10-21 12:48:20.000000000 +0200
***************
*** 389,397 ****
  # endif
  
  # if @GNULIB_CLOSE@ && @HAVE_WINSOCK2_H@
! /* gnulib internal function.  */
  #  define HAVE__GL_CLOSE_FD_MAYBE_SOCKET 1
- extern int _gl_close_fd_maybe_socket (int fd);
  # endif
  
  # ifdef __cplusplus
--- 389,396 ----
  # endif
  
  # if @GNULIB_CLOSE@ && @HAVE_WINSOCK2_H@
! /* Need a gnulib internal function.  */
  #  define HAVE__GL_CLOSE_FD_MAYBE_SOCKET 1
  # endif
  
  # ifdef __cplusplus
*** lib/close.c.orig    2008-10-21 12:58:54.000000000 +0200
--- lib/close.c 2008-10-21 12:48:39.000000000 +0200
***************
*** 29,35 ****
  /* Get set_winsock_errno, FD_TO_SOCKET etc. */
  #include "w32sock.h"
  
! int
  _gl_close_fd_maybe_socket (int fd)
  {
    SOCKET sock = FD_TO_SOCKET (fd);
--- 29,35 ----
  /* Get set_winsock_errno, FD_TO_SOCKET etc. */
  #include "w32sock.h"
  
! static int
  _gl_close_fd_maybe_socket (int fd)
  {
    SOCKET sock = FD_TO_SOCKET (fd);
*** lib/ioctl.c.orig    2008-10-21 12:58:54.000000000 +0200
--- lib/ioctl.c 2008-10-21 12:53:29.000000000 +0200
***************
*** 28,35 ****
  /* Get set_winsock_errno, FD_TO_SOCKET etc. */
  #include "w32sock.h"
  
- #undef ioctl
- 
  int
  rpl_ioctl (int fd, int req, ...)
  {
--- 28,33 ----
*** lib/socket.c.orig   2008-10-21 12:58:54.000000000 +0200
--- lib/socket.c        2008-10-21 12:53:39.000000000 +0200
***************
*** 26,33 ****
  /* Get set_winsock_errno, FD_TO_SOCKET etc. */
  #include "w32sock.h"
  
- #undef socket
- 
  int
  rpl_socket (int domain, int type, int protocol)
  {
--- 26,31 ----
*** m4/sys_socket_h.m4.orig     2008-10-21 12:58:54.000000000 +0200
--- m4/sys_socket_h.m4  2008-10-21 12:57:19.000000000 +0200
***************
*** 96,102 ****
    dnl Use AC_REQUIRE here, so that the default settings are expanded once 
only.
    AC_REQUIRE([gl_SYS_SOCKET_H_DEFAULTS])
    
GNULIB_[]m4_translit([$1],[abcdefghijklmnopqrstuvwxyz./-],[ABCDEFGHIJKLMNOPQRSTUVWXYZ___])=1
-   gl_MODULE_INDICATOR([$1])
  ])
  
  AC_DEFUN([gl_SYS_SOCKET_H_DEFAULTS],
--- 96,101 ----
*** doc/posix-functions/close.texi.orig 2008-10-21 12:58:54.000000000 +0200
--- doc/posix-functions/close.texi      2008-10-21 12:40:29.000000000 +0200
***************
*** 12,21 ****
  On Windows platforms (excluding Cygwin), @code{socket} and @code{accept}
  do not return file descriptors that can be closed by @code{close}.
  Instead, @code{closesocket} must be used.
- @item
- On Windows platforms (excluding Cygwin), error codes for @code{close}
- are not placed in @code{errno}, and @code{WSAGetLastError} must be
- used instead.
  @end itemize
  
  Portability problems not fixed by Gnulib:
--- 12,17 ----
*** doc/posix-functions/ioctl.texi.orig 2008-10-21 12:58:54.000000000 +0200
--- doc/posix-functions/ioctl.texi      2008-10-21 12:53:16.000000000 +0200
***************
*** 9,19 ****
  Portability problems fixed by Gnulib:
  @itemize
  @item
! On Windows platforms (excluding Cygwin), error codes for @code{ioctl}
! are not placed in @code{errno}, and @code{WSAGetLastError} must be
! used instead.
! @item
! @code{ioctl} is called @code{ioctlsocket} under mingw
  @end itemize
  
  Portability problems not fixed by Gnulib:
--- 9,17 ----
  Portability problems fixed by Gnulib:
  @itemize
  @item
! On Windows platforms (excluding Cygwin), @code{ioctl} is called
! @code{ioctlsocket}, and error codes for this function are not placed in
! @code{errno}, and @code{WSAGetLastError} must be used instead.
  @end itemize
  
  Portability problems not fixed by Gnulib:





reply via email to

[Prev in Thread] Current Thread [Next in Thread]