[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Guile-commits] GNU Guile branch, stable-2.0, updated. v2.0.7-162-g09b20
From: |
Andy Wingo |
Subject: |
[Guile-commits] GNU Guile branch, stable-2.0, updated. v2.0.7-162-g09b204d |
Date: |
Sat, 09 Mar 2013 15:49:55 +0000 |
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU Guile".
http://git.savannah.gnu.org/cgit/guile.git/commit/?id=09b204d38756f0fa9ab4319874c8ce2838488dd0
The branch, stable-2.0 has been updated
via 09b204d38756f0fa9ab4319874c8ce2838488dd0 (commit)
via 7e369c38993cc7cf4063a6cadc8496552abf323d (commit)
from 4c187d46d40aff1601f38675c11f92a73a13a7c9 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit 09b204d38756f0fa9ab4319874c8ce2838488dd0
Author: Andy Wingo <address@hidden>
Date: Sat Mar 9 16:39:47 2013 +0100
squish remove some mingw-specific code that is covered by gnulib
* libguile/socket.c (scm_init_socket): Remove mingw-specific code.
* libguile/fports.c: Remove ftruncate redefine; mingw is fine.
(scm_i_fdes_to_port): If we have no F_GETFL, just do an fstat. The
right place for an F_GETFL replacement would be in gnulib.
(fport_input_waiting): Remove an outdated comment.
* libguile/error.c (SCM_I_STRERROR, SCM_I_ERRNO): Remove, replacing uses
with strerror and errno.
* libguile/win32-socket.c:
* libguile/win32-socket.h: Remove. Mingw has suitable replacements.
* configure.ac:
* libguile/Makefile.am (address@hidden@_la_SOURCES):
(noinst_HEADERS): Update for win32-socket removal.
commit 7e369c38993cc7cf4063a6cadc8496552abf323d
Author: Andy Wingo <address@hidden>
Date: Sat Mar 9 15:56:30 2013 +0100
remove mingw32 implementations of {get,end,set}{serv,proto}ent
* libguile/win32-socket.h:
* libguile/win32-socket.c (getservent, endservent, setservent)
(getprotoent, endprotoent, setprotoent): Remove mingw32 wrappers.
Their place is in gnulib, if anywhere.
-----------------------------------------------------------------------
Summary of changes:
configure.ac | 3 -
libguile/Makefile.am | 4 +-
libguile/error.c | 17 +-
libguile/fports.c | 83 +------
libguile/net_db.c | 24 +--
libguile/socket.c | 16 +-
libguile/win32-socket.c | 632 -----------------------------------------------
libguile/win32-socket.h | 42 ---
8 files changed, 27 insertions(+), 794 deletions(-)
delete mode 100644 libguile/win32-socket.c
delete mode 100644 libguile/win32-socket.h
diff --git a/configure.ac b/configure.ac
index 4157982..d8919d3 100644
--- a/configure.ac
+++ b/configure.ac
@@ -707,9 +707,6 @@ case $host in
[Define if you have the <winsock2.h> header file.])])
AC_CHECK_LIB(ws2_32, main)
AC_LIBOBJ([win32-uname])
- if test "$enable_networking" = yes ; then
- AC_LIBOBJ([win32-socket])
- fi
if test "$enable_shared" = yes ; then
EXTRA_DEFS="-DSCM_IMPORT"
AC_DEFINE([USE_DLL_IMPORT], 1,
diff --git a/libguile/Makefile.am b/libguile/Makefile.am
index 8df2f7c..d77bdfe 100644
--- a/libguile/Makefile.am
+++ b/libguile/Makefile.am
@@ -434,7 +434,7 @@ address@hidden@_la_SOURCES = _scm.h \
dynl.c regex-posix.c \
posix.c net_db.c socket.c \
debug-malloc.c mkstemp.c \
- win32-uname.c win32-socket.c \
+ win32-uname.c \
locale-categories.h
## delete guile-snarf.awk from the installation bindir, in case it's
@@ -450,7 +450,7 @@ install-exec-hook:
noinst_HEADERS = conv-integer.i.c conv-uinteger.i.c \
srfi-14.i.c \
quicksort.i.c \
- win32-uname.h win32-socket.h \
+ win32-uname.h \
private-gc.h private-options.h
# vm instructions
diff --git a/libguile/error.c b/libguile/error.c
index 790ed05..0df4c73 100644
--- a/libguile/error.c
+++ b/libguile/error.c
@@ -1,5 +1,5 @@
/* Copyright (C) 1995, 1996, 1997, 1998, 2000, 2001, 2004, 2006, 2010,
- * 2012 Free Software Foundation, Inc.
+ * 2012, 2013 Free Software Foundation, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
@@ -100,17 +100,6 @@ SCM_DEFINE (scm_error_scm, "scm-error", 5, 0, 0,
}
#undef FUNC_NAME
-#if defined __MINGW32__ && defined HAVE_NETWORKING
-# include "win32-socket.h"
-# define SCM_I_STRERROR(err) \
- ((err >= WSABASEERR) ? scm_i_socket_strerror (err) : strerror (err))
-# define SCM_I_ERRNO() \
- (errno ? errno : scm_i_socket_errno ())
-#else
-# define SCM_I_STRERROR(err) strerror (err)
-# define SCM_I_ERRNO() errno
-#endif /* __MINGW32__ */
-
/* strerror may not be thread safe, for instance in glibc (version 2.3.2) an
error number not among the known values results in a string like "Unknown
error 9999" formed in a static buffer, which will be overwritten by a
@@ -136,7 +125,7 @@ SCM_DEFINE (scm_strerror, "strerror", 1, 0, 0,
scm_dynwind_begin (0);
scm_i_dynwind_pthread_mutex_lock (&scm_i_misc_mutex);
- ret = scm_from_locale_string (SCM_I_STRERROR (scm_to_int (err)));
+ ret = scm_from_locale_string (strerror (scm_to_int (err)));
scm_dynwind_end ();
return ret;
@@ -147,7 +136,7 @@ SCM_GLOBAL_SYMBOL (scm_system_error_key, "system-error");
void
scm_syserror (const char *subr)
{
- SCM err = scm_from_int (SCM_I_ERRNO ());
+ SCM err = scm_from_int (errno);
/* It could be that we're getting here because the syscall was
interrupted by a signal. In that case a signal handler might have
diff --git a/libguile/fports.c b/libguile/fports.c
index c1a2800..cdb9f99 100644
--- a/libguile/fports.c
+++ b/libguile/fports.c
@@ -55,32 +55,12 @@
#endif
#include <errno.h>
#include <sys/types.h>
-
-#include <full-write.h>
+#include <sys/stat.h>
#include "libguile/iselect.h"
-/* Some defines for Windows (native port, not Cygwin). */
-#ifdef __MINGW32__
-# include <sys/stat.h>
-# include <winsock2.h>
-#endif /* __MINGW32__ */
-
#include <full-write.h>
-/* Mingw (version 3.4.5, circa 2006) has ftruncate as an alias for chsize
- already, but have this code here in case that wasn't so in past versions,
- or perhaps to help other minimal DOS environments.
-
- gnulib ftruncate.c has code using fcntl F_CHSIZE and F_FREESP, which
- might be possibilities if we've got other systems without ftruncate. */
-
-#if defined HAVE_CHSIZE && ! defined HAVE_FTRUNCATE
-# define ftruncate(fd, size) chsize (fd, size)
-# undef HAVE_FTRUNCATE
-# define HAVE_FTRUNCATE 1
-#endif
-
#if SIZEOF_OFF_T == SIZEOF_INT
#define OFF_T_MAX INT_MAX
#define OFF_T_MIN INT_MIN
@@ -496,48 +476,6 @@ SCM_DEFINE (scm_open_file, "open-file", 2, 0, 0,
#undef FUNC_NAME
-#ifdef __MINGW32__
-/*
- * Try getting the appropiate file flags for a given file descriptor
- * under Windows. This incorporates some fancy operations because Windows
- * differentiates between file, pipe and socket descriptors.
- */
-#ifndef O_ACCMODE
-# define O_ACCMODE 0x0003
-#endif
-
-static int getflags (int fdes)
-{
- int flags = 0;
- struct stat buf;
- int error, optlen = sizeof (int);
-
- /* Is this a socket ? */
- if (getsockopt (fdes, SOL_SOCKET, SO_ERROR, (void *) &error, &optlen) >= 0)
- flags = O_RDWR;
- /* Maybe a regular file ? */
- else if (fstat (fdes, &buf) < 0)
- flags = -1;
- else
- {
- /* Or an anonymous pipe handle ? */
- if (buf.st_mode & _S_IFIFO)
- flags = PeekNamedPipe ((HANDLE) _get_osfhandle (fdes), NULL, 0,
- NULL, NULL, NULL) ? O_RDONLY : O_WRONLY;
- /* stdin ? */
- else if (fdes == fileno (stdin) && isatty (fdes))
- flags = O_RDONLY;
- /* stdout / stderr ? */
- else if ((fdes == fileno (stdout) || fdes == fileno (stderr)) &&
- isatty (fdes))
- flags = O_WRONLY;
- else
- flags = buf.st_mode;
- }
- return flags;
-}
-#endif /* __MINGW32__ */
-
/* Building Guile ports from a file descriptor. */
/* Build a Scheme port from an open file descriptor `fdes'.
@@ -551,14 +489,10 @@ scm_i_fdes_to_port (int fdes, long mode_bits, SCM name)
{
SCM port;
scm_t_port *pt;
- int flags;
- /* test that fdes is valid. */
-#ifdef __MINGW32__
- flags = getflags (fdes);
-#else
- flags = fcntl (fdes, F_GETFL, 0);
-#endif
+ /* Test that fdes is valid. */
+#ifdef F_GETFL
+ int flags = fcntl (fdes, F_GETFL, 0);
if (flags == -1)
SCM_SYSERROR;
flags &= O_ACCMODE;
@@ -568,6 +502,13 @@ scm_i_fdes_to_port (int fdes, long mode_bits, SCM name)
{
SCM_MISC_ERROR ("requested file mode not available on fdes", SCM_EOL);
}
+#else
+ /* If we don't have F_GETFL, as on mingw, at least we can test that
+ it is a valid file descriptor. */
+ struct stat st;
+ if (fstat (fdes, &st) != 0)
+ SCM_SYSERROR;
+#endif
scm_i_scm_pthread_mutex_lock (&scm_i_port_table_mutex);
@@ -639,8 +580,6 @@ fport_input_waiting (SCM port)
return FD_ISSET (fdes, &read_set) ? 1 : 0;
#elif HAVE_IOCTL && defined (FIONREAD)
- /* Note: cannot test just defined(FIONREAD) here, since mingw has FIONREAD
- (for use with winsock ioctlsocket()) but not ioctl(). */
int fdes = SCM_FSTREAM (port)->fdes;
int remir;
ioctl(fdes, FIONREAD, &remir);
diff --git a/libguile/net_db.c b/libguile/net_db.c
index 8dccb72..f8007a4 100644
--- a/libguile/net_db.c
+++ b/libguile/net_db.c
@@ -55,23 +55,15 @@
#include <netinet/in.h>
#include <arpa/inet.h>
-#ifdef __MINGW32__
-#include "win32-socket.h"
-#endif
-#if !defined (HAVE_H_ERRNO) && !defined (__MINGW32__) && !defined (__CYGWIN__)
-/* h_errno not found in netdb.h, maybe this will help. */
-extern int h_errno;
-#endif
+#if defined (HAVE_H_ERRNO)
+/* Only wrap gethostbyname / gethostbyaddr if h_errno is available. */
-#if defined HAVE_HSTRERROR && !HAVE_DECL_HSTRERROR \
- && !defined __MINGW32__ && !defined __CYGWIN__
+#if defined HAVE_HSTRERROR && !HAVE_DECL_HSTRERROR
/* Some OSes, such as Tru64 5.1b, lack a declaration for hstrerror(3). */
extern const char *hstrerror (int);
#endif
-
-
SCM_SYMBOL (scm_host_not_found_key, "host-not-found");
SCM_SYMBOL (scm_try_again_key, "try-again");
SCM_SYMBOL (scm_no_recovery_key, "no-recovery");
@@ -200,6 +192,8 @@ SCM_DEFINE (scm_gethost, "gethost", 0, 1, 0,
}
#undef FUNC_NAME
+#endif /* HAVE_H_ERRNO */
+
/* In all subsequent getMUMBLE functions, when we're called with no
arguments, we're supposed to traverse the tables entry by entry.
@@ -263,7 +257,7 @@ SCM_DEFINE (scm_getnet, "getnet", 0, 1, 0,
#undef FUNC_NAME
#endif
-#if defined (HAVE_GETPROTOENT) || defined (__MINGW32__)
+#if defined (HAVE_GETPROTOENT)
SCM_DEFINE (scm_getproto, "getproto", 0, 1, 0,
(SCM protocol),
"@deffnx {Scheme Procedure} getprotobyname name\n"
@@ -314,7 +308,7 @@ SCM_DEFINE (scm_getproto, "getproto", 0, 1, 0,
#undef FUNC_NAME
#endif
-#if defined (HAVE_GETSERVENT) || defined (__MINGW32__)
+#if defined (HAVE_GETSERVENT)
static SCM
scm_return_entry (struct servent *entry)
{
@@ -416,7 +410,7 @@ SCM_DEFINE (scm_setnet, "setnet", 0, 1, 0,
#undef FUNC_NAME
#endif
-#if defined (HAVE_SETPROTOENT) && defined (HAVE_ENDPROTOENT) || defined
(__MINGW32__)
+#if defined (HAVE_SETPROTOENT) && defined (HAVE_ENDPROTOENT)
SCM_DEFINE (scm_setproto, "setproto", 0, 1, 0,
(SCM stayopen),
"If @var{stayopen} is omitted, this is equivalent to
@code{endprotoent}.\n"
@@ -432,7 +426,7 @@ SCM_DEFINE (scm_setproto, "setproto", 0, 1, 0,
#undef FUNC_NAME
#endif
-#if defined (HAVE_SETSERVENT) && defined (HAVE_ENDSERVENT) || defined
(__MINGW32__)
+#if defined (HAVE_SETSERVENT) && defined (HAVE_ENDSERVENT)
SCM_DEFINE (scm_setserv, "setserv", 0, 1, 0,
(SCM stayopen),
"If @var{stayopen} is omitted, this is equivalent to
@code{endservent}.\n"
diff --git a/libguile/socket.c b/libguile/socket.c
index 5119ce3..ecb6754 100644
--- a/libguile/socket.c
+++ b/libguile/socket.c
@@ -1,5 +1,5 @@
/* Copyright (C) 1996, 1997, 1998, 2000, 2001, 2002, 2003, 2004, 2005,
- * 2006, 2007, 2009, 2011, 2012 Free Software Foundation, Inc.
+ * 2006, 2007, 2009, 2011, 2012, 2013 Free Software Foundation, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
@@ -44,11 +44,6 @@
# include "libguile/deprecation.h"
#endif
-#ifdef __MINGW32__
-#include "win32-socket.h"
-#include <netdb.h>
-#endif
-
#ifdef HAVE_STDINT_H
#include <stdint.h>
#endif
@@ -59,9 +54,6 @@
#include <unistd.h>
#endif
#include <sys/types.h>
-#ifdef HAVE_WINSOCK2_H
-#include <winsock2.h>
-#else
#include <sys/socket.h>
#ifdef HAVE_UNIX_DOMAIN_SOCKETS
#include <sys/un.h>
@@ -69,7 +61,7 @@
#include <netinet/in.h>
#include <netdb.h>
#include <arpa/inet.h>
-#endif
+
#if defined (HAVE_UNIX_DOMAIN_SOCKETS) && !defined (SUN_LEN)
#define SUN_LEN(ptr) ((size_t) (((struct sockaddr_un *) 0)->sun_path) \
@@ -1877,10 +1869,6 @@ scm_init_socket ()
scm_c_define ("MSG_DONTROUTE", scm_from_int (MSG_DONTROUTE));
#endif
-#ifdef __MINGW32__
- scm_i_init_socket_Win32 ();
-#endif
-
#ifdef IP_ADD_MEMBERSHIP
scm_c_define ("IP_ADD_MEMBERSHIP", scm_from_int (IP_ADD_MEMBERSHIP));
scm_c_define ("IP_DROP_MEMBERSHIP", scm_from_int (IP_DROP_MEMBERSHIP));
diff --git a/libguile/win32-socket.c b/libguile/win32-socket.c
deleted file mode 100644
index 825b4c4..0000000
--- a/libguile/win32-socket.c
+++ /dev/null
@@ -1,632 +0,0 @@
-/* Copyright (C) 2001, 2006 Free Software Foundation, Inc.
- *
- * This library 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 3 of
- * the License, or (at your option) any later version.
- *
- * This library 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 library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA
- */
-
-
-
-
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-#include "libguile/__scm.h"
-#include "libguile/modules.h"
-#include "libguile/numbers.h"
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <ctype.h>
-#include <errno.h>
-#include <limits.h>
-
-#ifndef PATH_MAX
-#define PATH_MAX 255
-#endif
-
-#include "win32-socket.h"
-
-/* Winsock API error description structure. The error description is
- necessary because there is no error list available. */
-typedef struct
-{
- int error; /* Error code. */
- char *str; /* Error description. */
- int replace; /* Possible error code replacement. */
- char *replace_str; /* Replacement symbol. */
- char *correct_str; /* Original symbol. */
-}
-socket_error_t;
-
-#define FILE_ETC_SERVICES "services"
-#define ENVIRON_ETC_SERVICES "SERVICES"
-#define FILE_ETC_NETWORKS "networks"
-#define ENVIRON_ETC_NETWORKS "NETWORKS"
-#define FILE_ETC_PROTOCOLS "protocol"
-#define ENVIRON_ETC_PROTOCOLS "PROTOCOLS"
-#define MAX_NAMLEN 256
-#define MAX_ALIASES 4
-
-/* Internal structure for a thread's M$-Windows servent interface. */
-typedef struct
-{
- FILE *fd; /* Current file. */
- char file[PATH_MAX]; /* File name. */
- struct servent ent; /* Return value. */
- char name[MAX_NAMLEN]; /* Service name. */
- char proto[MAX_NAMLEN]; /* Protocol name. */
- char alias[MAX_ALIASES][MAX_NAMLEN]; /* All aliases. */
- char *aliases[MAX_ALIASES]; /* Alias pointers. */
- int port; /* Network port. */
-}
-scm_i_servent_t;
-
-static scm_i_servent_t scm_i_servent;
-
-/* Internal structure for a thread's M$-Windows protoent interface. */
-typedef struct
-{
- FILE *fd; /* Current file. */
- char file[PATH_MAX]; /* File name. */
- struct protoent ent; /* Return value. */
- char name[MAX_NAMLEN]; /* Protocol name. */
- char alias[MAX_ALIASES][MAX_NAMLEN]; /* All aliases. */
- char *aliases[MAX_ALIASES]; /* Alias pointers. */
- int proto; /* Protocol number. */
-}
-scm_i_protoent_t;
-
-static scm_i_protoent_t scm_i_protoent;
-
-/* Define replacement symbols for most of the WSA* error codes. */
-#ifndef EWOULDBLOCK
-# define EWOULDBLOCK WSAEWOULDBLOCK
-#endif
-#ifndef EINPROGRESS
-# define EINPROGRESS WSAEINPROGRESS
-#endif
-#ifndef EALREADY
-# define EALREADY WSAEALREADY
-#endif
-#ifndef EDESTADDRREQ
-# define EDESTADDRREQ WSAEDESTADDRREQ
-#endif
-#ifndef EMSGSIZE
-# define EMSGSIZE WSAEMSGSIZE
-#endif
-#ifndef EPROTOTYPE
-# define EPROTOTYPE WSAEPROTOTYPE
-#endif
-#ifndef ENOTSOCK
-# define ENOTSOCK WSAENOTSOCK
-#endif
-#ifndef ENOPROTOOPT
-# define ENOPROTOOPT WSAENOPROTOOPT
-#endif
-#ifndef EPROTONOSUPPORT
-# define EPROTONOSUPPORT WSAEPROTONOSUPPORT
-#endif
-#ifndef ESOCKTNOSUPPORT
-# define ESOCKTNOSUPPORT WSAESOCKTNOSUPPORT
-#endif
-#ifndef EOPNOTSUPP
-# define EOPNOTSUPP WSAEOPNOTSUPP
-#endif
-#ifndef EPFNOSUPPORT
-# define EPFNOSUPPORT WSAEPFNOSUPPORT
-#endif
-#ifndef EAFNOSUPPORT
-# define EAFNOSUPPORT WSAEAFNOSUPPORT
-#endif
-#ifndef EADDRINUSE
-# define EADDRINUSE WSAEADDRINUSE
-#endif
-#ifndef EADDRNOTAVAIL
-# define EADDRNOTAVAIL WSAEADDRNOTAVAIL
-#endif
-#ifndef ENETDOWN
-# define ENETDOWN WSAENETDOWN
-#endif
-#ifndef ENETUNREACH
-# define ENETUNREACH WSAENETUNREACH
-#endif
-#ifndef ENETRESET
-# define ENETRESET WSAENETRESET
-#endif
-#ifndef ECONNABORTED
-# define ECONNABORTED WSAECONNABORTED
-#endif
-#ifndef ECONNRESET
-# define ECONNRESET WSAECONNRESET
-#endif
-#ifndef ENOBUFS
-# define ENOBUFS WSAENOBUFS
-#endif
-#ifndef EISCONN
-# define EISCONN WSAEISCONN
-#endif
-#ifndef ENOTCONN
-# define ENOTCONN WSAENOTCONN
-#endif
-#ifndef ESHUTDOWN
-# define ESHUTDOWN WSAESHUTDOWN
-#endif
-#ifndef ETOOMANYREFS
-# define ETOOMANYREFS WSAETOOMANYREFS
-#endif
-#ifndef ETIMEDOUT
-# define ETIMEDOUT WSAETIMEDOUT
-#endif
-#ifndef ECONNREFUSED
-# define ECONNREFUSED WSAECONNREFUSED
-#endif
-#ifndef ELOOP
-# define ELOOP WSAELOOP
-#endif
-#ifndef EHOSTDOWN
-# define EHOSTDOWN WSAEHOSTDOWN
-#endif
-#ifndef EHOSTUNREACH
-# define EHOSTUNREACH WSAEHOSTUNREACH
-#endif
-#ifndef EPROCLIM
-# define EPROCLIM WSAEPROCLIM
-#endif
-#ifndef EUSERS
-# define EUSERS WSAEUSERS
-#endif
-#ifndef EDQUOT
-# define EDQUOT WSAEDQUOT
-#endif
-#ifndef ESTALE
-# define ESTALE WSAESTALE
-#endif
-#ifndef EREMOTE
-# define EREMOTE WSAEREMOTE
-#endif
-
-/* List of error structures. */
-static socket_error_t socket_errno [] = {
- /* 000 */ { 0, NULL, 0, NULL, NULL },
- /* 001 */ { 0, NULL, 0, NULL, NULL },
- /* 002 */ { 0, NULL, 0, NULL, NULL },
- /* 003 */ { 0, NULL, 0, NULL, NULL },
- /* 004 */ { WSAEINTR, "Interrupted function call", EINTR, NULL, "WSAEINTR" },
- /* 005 */ { 0, NULL, 0, NULL, NULL },
- /* 006 */ { 0, NULL, 0, NULL, NULL },
- /* 007 */ { 0, NULL, 0, NULL, NULL },
- /* 008 */ { 0, NULL, 0, NULL, NULL },
- /* 009 */ { WSAEBADF, "Bad file number", EBADF, NULL, "WSAEBADF" },
- /* 010 */ { 0, NULL, 0, NULL, NULL },
- /* 011 */ { 0, NULL, 0, NULL, NULL },
- /* 012 */ { 0, NULL, 0, NULL, NULL },
- /* 013 */ { WSAEACCES, "Permission denied", EACCES, NULL, "WSAEACCES" },
- /* 014 */ { WSAEFAULT, "Bad address", EFAULT, NULL, "WSAEFAULT" },
- /* 015 */ { 0, NULL, 0, NULL, NULL },
- /* 016 */ { 0, NULL, 0, NULL, NULL },
- /* 017 */ { 0, NULL, 0, NULL, NULL },
- /* 018 */ { 0, NULL, 0, NULL, NULL },
- /* 019 */ { 0, NULL, 0, NULL, NULL },
- /* 020 */ { 0, NULL, 0, NULL, NULL },
- /* 021 */ { 0, NULL, 0, NULL, NULL },
- /* 022 */ { WSAEINVAL, "Invalid argument", EINVAL, NULL, "WSAEINVAL" },
- /* 023 */ { 0, NULL, 0, NULL, NULL },
- /* 024 */ { WSAEMFILE, "Too many open files", EMFILE, NULL, "WSAEMFILE" },
- /* 025 */ { 0, NULL, 0, NULL, NULL },
- /* 026 */ { 0, NULL, 0, NULL, NULL },
- /* 027 */ { 0, NULL, 0, NULL, NULL },
- /* 028 */ { 0, NULL, 0, NULL, NULL },
- /* 029 */ { 0, NULL, 0, NULL, NULL },
- /* 030 */ { 0, NULL, 0, NULL, NULL },
- /* 031 */ { 0, NULL, 0, NULL, NULL },
- /* 032 */ { 0, NULL, 0, NULL, NULL },
- /* 033 */ { 0, NULL, 0, NULL, NULL },
- /* 034 */ { 0, NULL, 0, NULL, NULL },
- /* 035 */ { WSAEWOULDBLOCK, "Resource temporarily unavailable",
- EWOULDBLOCK, "EWOULDBLOCK", "WSAEWOULDBLOCK" },
- /* 036 */ { WSAEINPROGRESS, "Operation now in progress",
- EINPROGRESS, "EINPROGRESS", "WSAEINPROGRESS" },
- /* 037 */ { WSAEALREADY, "Operation already in progress",
- EALREADY, "EALREADY", "WSAEALREADY" },
- /* 038 */ { WSAENOTSOCK, "Socket operation on non-socket",
- ENOTSOCK, "ENOTSOCK", "WSAENOTSOCK"},
- /* 039 */ { WSAEDESTADDRREQ, "Destination address required",
- EDESTADDRREQ, "EDESTADDRREQ", "WSAEDESTADDRREQ" },
- /* 040 */ { WSAEMSGSIZE, "Message too long",
- EMSGSIZE, "EMSGSIZE", "WSAEMSGSIZE" },
- /* 041 */ { WSAEPROTOTYPE, "Protocol wrong type for socket",
- EPROTOTYPE, "EPROTOTYPE", "WSAEPROTOTYPE" },
- /* 042 */ { WSAENOPROTOOPT, "Bad protocol option",
- ENOPROTOOPT, "ENOPROTOOPT", "WSAENOPROTOOPT" },
- /* 043 */ { WSAEPROTONOSUPPORT, "Protocol not supported",
- EPROTONOSUPPORT, "EPROTONOSUPPORT", "WSAEPROTONOSUPPORT" },
- /* 044 */ { WSAESOCKTNOSUPPORT, "Socket type not supported",
- ESOCKTNOSUPPORT, "ESOCKTNOSUPPORT", "WSAESOCKTNOSUPPORT" },
- /* 045 */ { WSAEOPNOTSUPP, "Operation not supported",
- EOPNOTSUPP, "EOPNOTSUPP", "WSAEOPNOTSUPP" },
- /* 046 */ { WSAEPFNOSUPPORT, "Protocol family not supported",
- EPFNOSUPPORT, "EPFNOSUPPORT", "WSAEPFNOSUPPORT" },
- /* 047 */ { WSAEAFNOSUPPORT,
- "Address family not supported by protocol family",
- EAFNOSUPPORT, "EAFNOSUPPORT", "WSAEAFNOSUPPORT" },
- /* 048 */ { WSAEADDRINUSE, "Address already in use",
- EADDRINUSE, "EADDRINUSE", "WSAEADDRINUSE" },
- /* 049 */ { WSAEADDRNOTAVAIL, "Cannot assign requested address",
- EADDRNOTAVAIL, "EADDRNOTAVAIL", "WSAEADDRNOTAVAIL" },
- /* 050 */ { WSAENETDOWN, "Network is down",
- ENETDOWN, "ENETDOWN", "WSAENETDOWN" },
- /* 051 */ { WSAENETUNREACH, "Network is unreachable",
- ENETUNREACH, "ENETUNREACH", "WSAENETUNREACH" },
- /* 052 */ { WSAENETRESET, "Network dropped connection on reset",
- ENETRESET, "ENETRESET", "WSAENETRESET" },
- /* 053 */ { WSAECONNABORTED, "Software caused connection abort",
- ECONNABORTED, "ECONNABORTED", "WSAECONNABORTED" },
- /* 054 */ { WSAECONNRESET, "Connection reset by peer",
- ECONNRESET, "ECONNRESET", "WSAECONNRESET" },
- /* 055 */ { WSAENOBUFS, "No buffer space available",
- ENOBUFS, "ENOBUFS", "WSAENOBUFS" },
- /* 056 */ { WSAEISCONN, "Socket is already connected",
- EISCONN, "EISCONN", "WSAEISCONN" },
- /* 057 */ { WSAENOTCONN, "Socket is not connected",
- ENOTCONN, "ENOTCONN", "WSAENOTCONN" },
- /* 058 */ { WSAESHUTDOWN, "Cannot send after socket shutdown",
- ESHUTDOWN, "ESHUTDOWN", "WSAESHUTDOWN" },
- /* 059 */ { WSAETOOMANYREFS, "Too many references; can't splice",
- ETOOMANYREFS, "ETOOMANYREFS", "WSAETOOMANYREFS" },
- /* 060 */ { WSAETIMEDOUT, "Connection timed out",
- ETIMEDOUT, "ETIMEDOUT", "WSAETIMEDOUT" },
- /* 061 */ { WSAECONNREFUSED, "Connection refused",
- ECONNREFUSED, "ECONNREFUSED", "WSAECONNREFUSED" },
- /* 062 */ { WSAELOOP, "Too many levels of symbolic links",
- ELOOP, "ELOOP", "WSAELOOP" },
- /* 063 */ { WSAENAMETOOLONG, "File name too long",
- ENAMETOOLONG, NULL, "WSAENAMETOOLONG" },
- /* 064 */ { WSAEHOSTDOWN, "Host is down",
- EHOSTDOWN, "EHOSTDOWN", "WSAEHOSTDOWN" },
- /* 065 */ { WSAEHOSTUNREACH, "No route to host",
- EHOSTUNREACH, "EHOSTUNREACH", "WSAEHOSTUNREACH" },
- /* 066 */ { WSAENOTEMPTY, "Directory not empty",
- ENOTEMPTY, NULL, "WSAENOTEMPTY" },
- /* 067 */ { WSAEPROCLIM, "Too many processes",
- EPROCLIM, "EPROCLIM", "WSAEPROCLIM" },
- /* 068 */ { WSAEUSERS, "Too many users",
- EUSERS, "EUSERS", "WSAEUSERS" },
- /* 069 */ { WSAEDQUOT, "Disc quota exceeded",
- EDQUOT, "EDQUOT", "WSAEDQUOT" },
- /* 070 */ { WSAESTALE, "Stale NFS file handle",
- ESTALE, "ESTALE", "WSAESTALE" },
- /* 071 */ { WSAEREMOTE, "Too many levels of remote in path",
- EREMOTE, "EREMOTE", "WSAEREMOTE" },
- /* 072 */ { 0, NULL, 0, NULL, NULL },
- /* 073 */ { 0, NULL, 0, NULL, NULL },
- /* 074 */ { 0, NULL, 0, NULL, NULL },
- /* 075 */ { 0, NULL, 0, NULL, NULL },
- /* 076 */ { 0, NULL, 0, NULL, NULL },
- /* 077 */ { 0, NULL, 0, NULL, NULL },
- /* 078 */ { 0, NULL, 0, NULL, NULL },
- /* 079 */ { 0, NULL, 0, NULL, NULL },
- /* 080 */ { 0, NULL, 0, NULL, NULL },
- /* 081 */ { 0, NULL, 0, NULL, NULL },
- /* 082 */ { 0, NULL, 0, NULL, NULL },
- /* 083 */ { 0, NULL, 0, NULL, NULL },
- /* 084 */ { 0, NULL, 0, NULL, NULL },
- /* 085 */ { 0, NULL, 0, NULL, NULL },
- /* 086 */ { 0, NULL, 0, NULL, NULL },
- /* 087 */ { 0, NULL, 0, NULL, NULL },
- /* 088 */ { 0, NULL, 0, NULL, NULL },
- /* 089 */ { 0, NULL, 0, NULL, NULL },
- /* 090 */ { 0, NULL, 0, NULL, NULL },
- /* 091 */ { WSASYSNOTREADY, "Network subsystem is unavailable",
- 0, NULL, "WSASYSNOTREADY" },
- /* 092 */ { WSAVERNOTSUPPORTED, "WINSOCK.DLL version out of range",
- 0, NULL, "WSAVERNOTSUPPORTED" },
- /* 093 */ { WSANOTINITIALISED, "Successful WSAStartup not yet performed",
- 0, NULL, "WSANOTINITIALISED" },
- /* 094 */ { 0, NULL, 0, NULL, NULL },
- /* 095 */ { 0, NULL, 0, NULL, NULL },
- /* 096 */ { 0, NULL, 0, NULL, NULL },
- /* 097 */ { 0, NULL, 0, NULL, NULL },
- /* 098 */ { 0, NULL, 0, NULL, NULL },
- /* 099 */ { 0, NULL, 0, NULL, NULL },
- /* 100 */ { 0, NULL, 0, NULL, NULL },
- /* 101 */ { WSAEDISCON, "Graceful shutdown in progress",
- 0, NULL, "WSAEDISCON" },
- /* 102 */ { WSAENOMORE, "No more services",
- 0, NULL, "WSAENOMORE" },
- /* 103 */ { WSAECANCELLED, "Service lookup cancelled",
- 0, NULL, "WSAECANCELLED" },
- /* 104 */ { WSAEINVALIDPROCTABLE, "Invalid procedure call table",
- 0, NULL, "WSAEINVALIDPROCTABLE" },
- /* 105 */ { WSAEINVALIDPROVIDER, "Invalid service provider",
- 0, NULL, "WSAEINVALIDPROVIDER" },
- /* 106 */ { WSAEPROVIDERFAILEDINIT, "Service provider failure",
- 0, NULL, "WSAEPROVIDERFAILEDINIT" },
- /* 107 */ { WSASYSCALLFAILURE, "System call failed",
- 0, NULL, "WSASYSCALLFAILURE" },
- /* 108 */ { WSASERVICE_NOT_FOUND, "No such service",
- 0, NULL, "WSASERVICE_NOT_FOUND" },
- /* 109 */ { WSATYPE_NOT_FOUND, "Class not found",
- 0, NULL, "WSATYPE_NOT_FOUND" },
- /* 110 */ { WSA_E_NO_MORE, "No more services",
- 0, NULL, "WSA_E_NO_MORE" },
- /* 111 */ { WSA_E_CANCELLED, "Service lookup cancelled",
- 0, NULL, "WSA_E_CANCELLED" },
- /* 112 */ { WSAEREFUSED, "Database query refused",
- 0, NULL, "WSAEREFUSED" },
- /* end */ { -1, NULL, -1, NULL, NULL }
-};
-
-/* Extended list of error structures. */
-static socket_error_t socket_h_errno [] = {
- /* 000 */ { 0, NULL, 0, NULL, NULL },
- /* 001 */ { WSAHOST_NOT_FOUND, "Host not found",
- HOST_NOT_FOUND, "HOST_NOT_FOUND", "WSAHOST_NOT_FOUND" },
- /* 002 */ { WSATRY_AGAIN, "Non-authoritative host not found",
- TRY_AGAIN, "TRY_AGAIN", "WSATRY_AGAIN" },
- /* 003 */ { WSANO_RECOVERY, "This is a non-recoverable error",
- NO_RECOVERY, "NO_RECOVERY", "WSANO_RECOVERY" },
- /* 004 */ { WSANO_DATA, "Valid name, no data record of requested type",
- NO_DATA, "NO_DATA", "WSANO_DATA" },
- /* 005 */ { WSANO_ADDRESS, "No address, look for MX record",
- NO_ADDRESS, "NO_ADDRESS", "WSANO_ADDRESS" },
- /* end */ { -1, NULL, -1, NULL, NULL }
-};
-
-/* Returns the result of @code{WSAGetLastError()}. */
-int
-scm_i_socket_errno (void)
-{
- return WSAGetLastError ();
-}
-
-/* Returns a valid error message for Winsock-API error codes obtained via
- @code{WSAGetLastError()} or NULL otherwise. */
-char *
-scm_i_socket_strerror (int error)
-{
- if (error >= WSABASEERR && error <= (WSABASEERR + 112))
- return socket_errno[error - WSABASEERR].str;
- else if (error >= (WSABASEERR + 1000) && error <= (WSABASEERR + 1005))
- return socket_h_errno[error - (WSABASEERR + 1000)].str;
- return NULL;
-}
-
-/* Constructs a valid filename for the given file @var{file} in the M$-Windows
- directory. This is usually the default location for the network files. */
-char *
-scm_i_socket_filename (char *file)
-{
- static char dir[PATH_MAX];
- int len = PATH_MAX;
-
- len = GetWindowsDirectory (dir, len);
- if (dir[len - 1] != '\\')
- strcat (dir, "\\");
- strcat (dir, file);
- return dir;
-}
-
-/* Removes comments and white spaces at end of line and returns a pointer
- to the end of the line. */
-static char *
-scm_i_socket_uncomment (char *line)
-{
- char *end;
-
- if ((end = strchr (line, '#')) != NULL)
- *end-- = '\0';
- else
- {
- end = line + strlen (line) - 1;
- while (end > line && (*end == '\r' || *end == '\n'))
- *end-- = '\0';
- }
- while (end > line && isspace ((int) (*end)))
- *end-- = '\0';
-
- return end;
-}
-
-/* The getservent() function reads the next line from the file `/etc/services'
- and returns a structure servent containing the broken out fields from the
- line. The `/etc/services' file is opened if necessary. */
-struct servent *
-getservent (void)
-{
- char line[MAX_NAMLEN], *end, *p;
- int done = 0, i, n, a;
- struct servent *e = NULL;
-
- /* Ensure a open file. */
- if (scm_i_servent.fd == NULL || feof (scm_i_servent.fd))
- {
- setservent (1);
- if (scm_i_servent.fd == NULL)
- return NULL;
- }
-
- while (!done)
- {
- /* Get new line. */
- if (fgets (line, MAX_NAMLEN, scm_i_servent.fd) != NULL)
- {
- end = scm_i_socket_uncomment (line);
-
- /* Scan the line. */
- if ((i = sscanf (line, "%s %d/%s%n",
- scm_i_servent.name,
- &scm_i_servent.port,
- scm_i_servent.proto, &n)) != 3)
- continue;
-
- /* Scan the remaining aliases. */
- p = line + n;
- for (a = 0; a < MAX_ALIASES && p < end && i != -1 && n > 1;
- a++, p += n)
- i = sscanf (p, "%s%n", scm_i_servent.alias[a], &n);
-
- /* Prepare the return value. */
- e = &scm_i_servent.ent;
- e->s_name = scm_i_servent.name;
- e->s_port = htons (scm_i_servent.port);
- e->s_proto = scm_i_servent.proto;
- e->s_aliases = scm_i_servent.aliases;
- scm_i_servent.aliases[a] = NULL;
- while (a--)
- scm_i_servent.aliases[a] = scm_i_servent.alias[a];
- done = 1;
- }
- else
- break;
- }
- return done ? e : NULL;
-}
-
-/* The setservent() function opens and rewinds the `/etc/services' file.
- This file can be set from outside with an environment variable specifying
- the file name. */
-void
-setservent (int stayopen)
-{
- char *file = NULL;
-
- endservent ();
- if ((file = getenv (ENVIRON_ETC_SERVICES)) != NULL)
- strcpy (scm_i_servent.file, file);
- else if ((file = scm_i_socket_filename (FILE_ETC_SERVICES)) != NULL)
- strcpy (scm_i_servent.file, file);
- scm_i_servent.fd = fopen (scm_i_servent.file, "rt");
-}
-
-/* The endservent() function closes the `/etc/services' file. */
-void
-endservent (void)
-{
- if (scm_i_servent.fd != NULL)
- {
- fclose (scm_i_servent.fd);
- scm_i_servent.fd = NULL;
- }
-}
-
-/* The getprotoent() function reads the next line from the file
- `/etc/protocols' and returns a structure protoent containing the broken
- out fields from the line. The `/etc/protocols' file is opened if
- necessary. */
-struct protoent *
-getprotoent (void)
-{
- char line[MAX_NAMLEN], *end, *p;
- int done = 0, i, n, a;
- struct protoent *e = NULL;
-
- /* Ensure a open file. */
- if (scm_i_protoent.fd == NULL || feof (scm_i_protoent.fd))
- {
- setprotoent (1);
- if (scm_i_protoent.fd == NULL)
- return NULL;
- }
-
- while (!done)
- {
- /* Get new line. */
- if (fgets (line, MAX_NAMLEN, scm_i_protoent.fd) != NULL)
- {
- end = scm_i_socket_uncomment (line);
-
- /* Scan the line. */
- if ((i = sscanf (line, "%s %d%n",
- scm_i_protoent.name,
- &scm_i_protoent.proto, &n)) != 2)
- continue;
-
- /* Scan the remaining aliases. */
- p = line + n;
- for (a = 0; a < MAX_ALIASES && p < end && i != -1 && n > 1;
- a++, p += n)
- i = sscanf (p, "%s%n", scm_i_protoent.alias[a], &n);
-
- /* Prepare the return value. */
- e = &scm_i_protoent.ent;
- e->p_name = scm_i_protoent.name;
- e->p_proto = scm_i_protoent.proto;
- e->p_aliases = scm_i_protoent.aliases;
- scm_i_protoent.aliases[a] = NULL;
- while (a--)
- scm_i_protoent.aliases[a] = scm_i_protoent.alias[a];
- done = 1;
- }
- else
- break;
- }
- return done ? e : NULL;
-}
-
-/* The setprotoent() function opens and rewinds the `/etc/protocols' file.
- As in setservent() the user can modify the location of the file using
- an environment variable. */
-void
-setprotoent (int stayopen)
-{
- char *file = NULL;
-
- endprotoent ();
- if ((file = getenv (ENVIRON_ETC_PROTOCOLS)) != NULL)
- strcpy (scm_i_protoent.file, file);
- else if ((file = scm_i_socket_filename (FILE_ETC_PROTOCOLS)) != NULL)
- strcpy (scm_i_protoent.file, file);
- scm_i_protoent.fd = fopen (scm_i_protoent.file, "rt");
-}
-
-/* The endprotoent() function closes `/etc/protocols'. */
-void
-endprotoent (void)
-{
- if (scm_i_protoent.fd != NULL)
- {
- fclose (scm_i_protoent.fd);
- scm_i_protoent.fd = NULL;
- }
-}
-
-/* Define both the original and replacement error symbol is possible. Thus
- the user is able to check symbolic errors after unsuccessful networking
- function calls. */
-static void
-scm_socket_symbols_Win32 (socket_error_t * e)
-{
- while (e->error != -1)
- {
- if (e->error)
- {
- if (e->correct_str)
- scm_c_define (e->correct_str, scm_from_int (e->error));
- if (e->replace && e->replace_str)
- scm_c_define (e->replace_str, scm_from_int (e->replace));
- }
- e++;
- }
-}
-
-/* Initialize Winsock API under M$-Windows. */
-void
-scm_i_init_socket_Win32 (void)
-{
- scm_socket_symbols_Win32 (socket_errno);
- scm_socket_symbols_Win32 (socket_h_errno);
-}
diff --git a/libguile/win32-socket.h b/libguile/win32-socket.h
deleted file mode 100644
index 4ab9b94..0000000
--- a/libguile/win32-socket.h
+++ /dev/null
@@ -1,42 +0,0 @@
-/* classes: h_files */
-
-#ifndef SCM_WIN32_SOCKET_H
-#define SCM_WIN32_SOCKET_H
-
-/* Copyright (C) 2001, 2006 Free Software Foundation, Inc.
- *
- * This library 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 3 of
- * the License, or (at your option) any later version.
- *
- * This library 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 library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA
- */
-
-#include "libguile/__scm.h"
-
-#ifdef SCM_HAVE_WINSOCK2_H
-# include <winsock2.h>
-#endif
-
-int scm_i_socket_errno (void);
-char * scm_i_socket_strerror (int error);
-void scm_i_init_socket_Win32 (void);
-char * scm_i_socket_filename (char *file);
-
-struct servent * getservent (void);
-void setservent (int stayopen);
-void endservent (void);
-struct protoent * getprotoent (void);
-void setprotoent (int stayopen);
-void endprotoent (void);
-
-#endif /* SCM_WIN32_SOCKET_H */
hooks/post-receive
--
GNU Guile
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Guile-commits] GNU Guile branch, stable-2.0, updated. v2.0.7-162-g09b204d,
Andy Wingo <=