1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-05-20 03:30:27 +02:00

add check for struct pollfd

* configure.ac: Add check for struct pollfd.

* libguile/fports.c (fport_input_waiting):
* libguile/poll.c (scm_primitive_poll): Require struct pollfd.  Fixes
  bug 13903.
This commit is contained in:
Andy Wingo 2013-03-09 11:56:46 +01:00
parent 19113f1ca7
commit 4c187d46d4
3 changed files with 8 additions and 6 deletions

View file

@ -674,6 +674,8 @@ AC_CHECK_TYPE(socklen_t, ,
AC_CHECK_TYPES([struct ip_mreq], , , [#include <netinet/in.h>])
AC_CHECK_TYPES([struct pollfd], , , [#include <poll.h>])
GUILE_HEADER_LIBC_WITH_UNISTD
AC_TYPE_GETGROUPS

View file

@ -1,5 +1,5 @@
/* Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003,
* 2004, 2006, 2007, 2008, 2009, 2010, 2011, 2012 Free Software Foundation, Inc.
* 2004, 2006, 2007, 2008, 2009, 2010, 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
@ -609,7 +609,7 @@ fport_input_waiting (SCM port)
highest numerical value of file descriptors that can be monitored.
Thus, use poll(2) whenever that is possible. */
#ifdef HAVE_POLL
#if defined(HAVE_POLL) && defined(HAVE_STRUCT_POLLFD)
struct pollfd pollfd = { fdes, POLLIN, 0 };
if (poll (&pollfd, 1, 0) < 0)

View file

@ -1,4 +1,4 @@
/* Copyright (C) 2010 Free Software Foundation, Inc.
/* Copyright (C) 2010, 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
@ -73,7 +73,7 @@
If timeout is given and is non-negative, the poll will return after that
number of milliseconds if no fd became active.
*/
#ifdef HAVE_POLL
#if defined(HAVE_POLL) && defined(HAVE_STRUCT_POLLFD)
static SCM
scm_primitive_poll (SCM pollfds, SCM nfds, SCM ports, SCM timeout)
#define FUNC_NAME "primitive-poll"
@ -174,7 +174,7 @@ scm_primitive_poll (SCM pollfds, SCM nfds, SCM ports, SCM timeout)
return scm_from_int (rv);
}
#undef FUNC_NAME
#endif /* HAVE_POLL */
#endif /* HAVE_POLL && HAVE_STRUCT_POLLFD */
@ -182,7 +182,7 @@ scm_primitive_poll (SCM pollfds, SCM nfds, SCM ports, SCM timeout)
static void
scm_init_poll (void)
{
#if HAVE_POLL
#if defined(HAVE_POLL) && defined(HAVE_STRUCT_POLLFD)
scm_c_define_gsubr ("primitive-poll", 4, 0, 0, scm_primitive_poll);
scm_c_define ("%sizeof-struct-pollfd", scm_from_size_t (sizeof (struct pollfd)));
#else