mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-06-29 22:40:34 +02:00
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.
This commit is contained in:
parent
d3c88f1826
commit
6ab4de6125
4 changed files with 41 additions and 43 deletions
|
@ -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 */
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -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.
|
||||
*/
|
||||
|
|
|
@ -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,36 +29,19 @@
|
|||
#include <sys/types.h>
|
||||
|
||||
#if SCM_HAVE_SYS_SELECT_H
|
||||
# include <sys/select.h>
|
||||
#endif
|
||||
|
||||
#if SCM_HAVE_WINSOCK2_H
|
||||
# include <winsock2.h>
|
||||
#endif
|
||||
|
||||
#ifdef FD_SET
|
||||
|
||||
#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 */
|
||||
#include <sys/select.h>
|
||||
|
||||
SCM_API int scm_std_select (int fds,
|
||||
SELECT_TYPE *rfds,
|
||||
SELECT_TYPE *wfds,
|
||||
SELECT_TYPE *efds,
|
||||
fd_set *rfds,
|
||||
fd_set *wfds,
|
||||
fd_set *efds,
|
||||
struct timeval *timeout);
|
||||
|
||||
#define SELECT_TYPE fd_set
|
||||
|
||||
#endif /* SCM_HAVE_SYS_SELECT_H */
|
||||
|
||||
#endif /* SCM_ISELECT_H */
|
||||
|
||||
/*
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue