libvirt/gnulib/lib/sys_socket.in.h
Jim Meyering 130426c659 update from gnulib
* gnulib/lib/inet_ntop.h: Remove file.
* gnulib/m4/onceonly_2_57.m4: Remove file.
* build-aux/useless-if-before-free: Update.
* build-aux/vc-list-files: Update.
* gnulib/lib/.cvsignore: Update.
* gnulib/lib/Makefile.am: Update.
* gnulib/lib/fseeko.c: Update.
* gnulib/lib/getaddrinfo.c: Update.
* gnulib/lib/getdelim.c: Update.
* gnulib/lib/inet_ntop.c: Update.
* gnulib/lib/inet_ntop.h: Update.
* gnulib/lib/poll.c: Update.
* gnulib/lib/snprintf.c: Update.
* gnulib/lib/stdlib.in.h: Update.
* gnulib/lib/string.in.h: Update.
* gnulib/lib/sys_socket.in.h: Update.
* gnulib/lib/sys_stat.in.h: Update.
* gnulib/lib/vasnprintf.c: Update.
* gnulib/lib/vasprintf.c: Update.
* gnulib/lib/wchar.in.h: Update.
* gnulib/m4/arpa_inet_h.m4: Update.
* gnulib/m4/extensions.m4: Update.
* gnulib/m4/gnulib-common.m4: Update.
* gnulib/m4/gnulib-comp.m4: Update.
* gnulib/m4/include_next.m4: Update.
* gnulib/m4/inet_ntop.m4: Update.
* gnulib/m4/netinet_in_h.m4: Update.
* gnulib/m4/onceonly_2_57.m4: Update.
* gnulib/m4/physmem.m4: Update.
* gnulib/m4/snprintf.m4: Update.
* gnulib/m4/stdint.m4: Update.
* gnulib/m4/stdio_h.m4: Update.
* gnulib/m4/stdlib_h.m4: Update.
* gnulib/m4/string_h.m4: Update.
* gnulib/m4/strndup.m4: Update.
* gnulib/m4/sys_select_h.m4: Update.
* gnulib/m4/sys_socket_h.m4: Update.
* gnulib/m4/sys_stat_h.m4: Update.
* gnulib/m4/vasnprintf.m4: Update.
* gnulib/tests/Makefile.am: Update.
* gnulib/tests/test-fseeko.c: Update.
* gnulib/tests/test-getaddrinfo.c: Update.
* gnulib/tests/test-getdelim.c: Update.
* gnulib/tests/test-getline.c: Update.
* gnulib/tests/test-lseek.c: Update.
* gnulib/tests/test-snprintf.c: Update.
* gnulib/tests/test-sys_stat.c: Update.
* gnulib/tests/test-vasnprintf.c: Update.
* gnulib/tests/test-vasprintf.c: Update.
2008-04-29 19:52:26 +00:00

119 lines
3.8 KiB
C

/* Provide a sys/socket header file for systems lacking it (read: MinGW)
and for systems where it is incomplete.
Copyright (C) 2005-2008 Free Software Foundation, Inc.
Written by Simon Josefsson.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1, 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 Lesser General Public License for more details.
You should have received a copy of the GNU Lesser 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. */
/* This file is supposed to be used on platforms that lack <sys/socket.h>,
on platforms where <sys/socket.h> cannot be included standalone, and on
platforms where <sys/socket.h> does not provide all necessary definitions.
It is intended to provide definitions and prototypes needed by an
application. */
#ifndef _GL_SYS_SOCKET_H
#if @HAVE_SYS_SOCKET_H@
/* On many platforms, <sys/socket.h> assumes prior inclusion of
<sys/types.h>. */
# include <sys/types.h>
/* The include_next requires a split double-inclusion guard. */
# @INCLUDE_NEXT@ @NEXT_SYS_SOCKET_H@
#endif
#ifndef _GL_SYS_SOCKET_H
#define _GL_SYS_SOCKET_H
#if @HAVE_SYS_SOCKET_H@
/* A platform that has <sys/socket.h>. */
/* For shutdown(). */
# if !defined SHUT_RD
# define SHUT_RD 0
# endif
# if !defined SHUT_WR
# define SHUT_WR 1
# endif
# if !defined SHUT_RDWR
# define SHUT_RDWR 2
# endif
#else
/* A platform that lacks <sys/socket.h>.
Currently only MinGW is supported. See the gnulib manual regarding
Windows sockets. MinGW has the header files winsock2.h and
ws2tcpip.h that declare the sys/socket.h definitions we need. Note
that you can influence which definitions you get by setting the
WINVER symbol before including these two files. For example,
getaddrinfo is only available if _WIN32_WINNT >= 0x0501 (that
symbol is set indiriectly through WINVER). You can set this by
adding AC_DEFINE(WINVER, 0x0501) to configure.ac. Note that your
code may not run on older Windows releases then. My Windows 2000
box was not able to run the code, for example. The situation is
slightly confusing because:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winsock/winsock/getaddrinfo_2.asp
suggests that getaddrinfo should be available on all Windows
releases. */
# if @HAVE_WINSOCK2_H@
# include <winsock2.h>
# endif
# if @HAVE_WS2TCPIP_H@
# include <ws2tcpip.h>
# endif
/* For shutdown(). */
# if !defined SHUT_RD && defined SD_RECEIVE
# define SHUT_RD SD_RECEIVE
# endif
# if !defined SHUT_WR && defined SD_SEND
# define SHUT_WR SD_SEND
# endif
# if !defined SHUT_RDWR && defined SD_BOTH
# define SHUT_RDWR SD_BOTH
# endif
# if defined _WIN32 || defined __WIN32__
# define ENOTSOCK WSAENOTSOCK
# define EADDRINUSE WSAEADDRINUSE
# define ENETRESET WSAENETRESET
# define ECONNABORTED WSAECONNABORTED
# define ECONNRESET WSAECONNRESET
# define ENOTCONN WSAENOTCONN
# define ESHUTDOWN WSAESHUTDOWN
# endif
# if (defined _WIN32 || defined __WIN32__) && !defined __CYGWIN__
# define setsockopt(a,b,c,d,e) rpl_setsockopt(a,b,c,d,e)
static inline int
rpl_setsockopt(int socket, int level, int optname, const void *optval,
socklen_t optlen)
{
return (setsockopt)(socket, level, optname, optval, optlen);
}
# endif
#endif /* HAVE_SYS_SOCKET_H */
#endif /* _GL_SYS_SOCKET_H */
#endif /* _GL_SYS_SOCKET_H */