summaryrefslogtreecommitdiff
path: root/libguile
diff options
context:
space:
mode:
authorAndy Wingo <wingo@pobox.com>2013-03-09 22:45:33 +0100
committerAndy Wingo <wingo@pobox.com>2013-03-09 22:45:33 +0100
commit6ab4de612510b7c8668f0b50388258392f25b157 (patch)
tree28dd2f712440880cbbb28361cfebf82a6b7468b8 /libguile
parentd3c88f18261b78f1ca9903f2f179b7f812288e1c (diff)
downloadguile-6ab4de612510b7c8668f0b50388258392f25b157.tar.gz
don't provide scm_std_select on mingw and similar platforms
* libguile/iselect.h: If we do not have sys/select.h, don't provide scm_std_select, SELECT_TYPE, FD_SET, FD_ZERO, FD_ISSET, or FD_CLR. Guile should not be setting these macros in public API. This is an incompatible change on mingw, but oh well. * libguile/threads.c: Rely on gnulib's select, and use that to implement scm_std_select. * libguile/deprecated.h: * libguile/deprecated.c: Only provide scm_internal_select if we have sys/select.h.
Diffstat (limited to 'libguile')
-rw-r--r--libguile/deprecated.c19
-rw-r--r--libguile/deprecated.h8
-rw-r--r--libguile/iselect.h33
-rw-r--r--libguile/threads.c22
4 files changed, 40 insertions, 42 deletions
diff --git a/libguile/deprecated.c b/libguile/deprecated.c
index b5e7cf395..e1dbfaf37 100644
--- a/libguile/deprecated.c
+++ b/libguile/deprecated.c
@@ -24,6 +24,12 @@
# include <config.h>
#endif
+#include <math.h>
+#include <stdio.h>
+#include <string.h>
+
+#include <arpa/inet.h>
+
#define SCM_BUILDING_DEPRECATED_CODE
#include "libguile/_scm.h"
@@ -60,11 +66,6 @@
#include "libguile/feature.h"
#include "libguile/uniform.h"
-#include <math.h>
-#include <stdio.h>
-#include <string.h>
-
-#include <arpa/inet.h>
#if (SCM_ENABLE_DEPRECATED == 1)
@@ -2356,16 +2357,18 @@ scm_thread_usleep (unsigned long t)
return scm_std_usleep (t);
}
+#ifdef HAVE_SYS_SELECT_H
int scm_internal_select (int fds,
- SELECT_TYPE *rfds,
- SELECT_TYPE *wfds,
- SELECT_TYPE *efds,
+ fd_set *rfds,
+ fd_set *wfds,
+ fd_set *efds,
struct timeval *timeout)
{
scm_c_issue_deprecation_warning
("`scm_internal_select' is deprecated. Use scm_std_select instead.");
return scm_std_select (fds, rfds, wfds, efds, timeout);
}
+#endif /* HAVE_SYS_SELECT_H */
diff --git a/libguile/deprecated.h b/libguile/deprecated.h
index 1812dd063..e17542b62 100644
--- a/libguile/deprecated.h
+++ b/libguile/deprecated.h
@@ -742,11 +742,13 @@ SCM_DEPRECATED SCM scm_c_make_keyword (const char *s);
SCM_DEPRECATED unsigned int scm_thread_sleep (unsigned int);
SCM_DEPRECATED unsigned long scm_thread_usleep (unsigned long);
+#if SCM_HAVE_SYS_SELECT_H
SCM_DEPRECATED int scm_internal_select (int fds,
- SELECT_TYPE *rfds,
- SELECT_TYPE *wfds,
- SELECT_TYPE *efds,
+ fd_set *rfds,
+ fd_set *wfds,
+ fd_set *efds,
struct timeval *timeout);
+#endif
/* Deprecated because the cuserid call is deprecated.
*/
diff --git a/libguile/iselect.h b/libguile/iselect.h
index 760d959d8..092fb07bf 100644
--- a/libguile/iselect.h
+++ b/libguile/iselect.h
@@ -3,7 +3,7 @@
#ifndef SCM_ISELECT_H
#define SCM_ISELECT_H
-/* Copyright (C) 1997,1998,2000,2001, 2002, 2006 Free Software Foundation, Inc.
+/* Copyright (C) 1997,1998,2000,2001, 2002, 2006, 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
@@ -29,35 +29,18 @@
#include <sys/types.h>
#if SCM_HAVE_SYS_SELECT_H
-# include <sys/select.h>
-#endif
-#if SCM_HAVE_WINSOCK2_H
-# include <winsock2.h>
-#endif
+#include <sys/select.h>
-#ifdef FD_SET
+SCM_API int scm_std_select (int fds,
+ fd_set *rfds,
+ fd_set *wfds,
+ fd_set *efds,
+ struct timeval *timeout);
#define SELECT_TYPE fd_set
-#define SELECT_SET_SIZE FD_SETSIZE
-
-#else /* no FD_SET */
-
-/* Define the macros to access a single-int bitmap of descriptors. */
-#define SELECT_SET_SIZE 32
-#define SELECT_TYPE int
-#define FD_SET(n, p) (*(p) |= (1 << (n)))
-#define FD_CLR(n, p) (*(p) &= ~(1 << (n)))
-#define FD_ISSET(n, p) (*(p) & (1 << (n)))
-#define FD_ZERO(p) (*(p) = 0)
-#endif /* no FD_SET */
-
-SCM_API int scm_std_select (int fds,
- SELECT_TYPE *rfds,
- SELECT_TYPE *wfds,
- SELECT_TYPE *efds,
- struct timeval *timeout);
+#endif /* SCM_HAVE_SYS_SELECT_H */
#endif /* SCM_ISELECT_H */
diff --git a/libguile/threads.c b/libguile/threads.c
index a3aee0f17..c1b9c3982 100644
--- a/libguile/threads.c
+++ b/libguile/threads.c
@@ -45,6 +45,8 @@
# include <pthread_np.h>
#endif
+#include <sys/select.h>
+
#include <assert.h>
#include <fcntl.h>
#include <nproc.h>
@@ -1851,9 +1853,9 @@ SCM_DEFINE (scm_condition_variable_p, "condition-variable?", 1, 0, 0,
struct select_args
{
int nfds;
- SELECT_TYPE *read_fds;
- SELECT_TYPE *write_fds;
- SELECT_TYPE *except_fds;
+ fd_set *read_fds;
+ fd_set *write_fds;
+ fd_set *except_fds;
struct timeval *timeout;
int result;
@@ -1876,11 +1878,19 @@ do_std_select (void *args)
return NULL;
}
+#if !SCM_HAVE_SYS_SELECT_H
+static int scm_std_select (int nfds,
+ fd_set *readfds,
+ fd_set *writefds,
+ fd_set *exceptfds,
+ struct timeval *timeout);
+#endif
+
int
scm_std_select (int nfds,
- SELECT_TYPE *readfds,
- SELECT_TYPE *writefds,
- SELECT_TYPE *exceptfds,
+ fd_set *readfds,
+ fd_set *writefds,
+ fd_set *exceptfds,
struct timeval *timeout)
{
fd_set my_readfds;