diff options
Diffstat (limited to 'libguile')
-rw-r--r-- | libguile/deprecated.c | 19 | ||||
-rw-r--r-- | libguile/deprecated.h | 8 | ||||
-rw-r--r-- | libguile/iselect.h | 33 | ||||
-rw-r--r-- | libguile/threads.c | 22 |
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; |