summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndy Wingo <wingo@pobox.com>2013-03-09 11:56:46 +0100
committerAndy Wingo <wingo@pobox.com>2013-03-09 11:56:56 +0100
commit4c187d46d40aff1601f38675c11f92a73a13a7c9 (patch)
tree43aa99815ac65cc170d64c90c31098fc31d3cad0
parent19113f1ca7a747de06d7b43c6c1eca4cd58d05e5 (diff)
downloadguile-4c187d46d40aff1601f38675c11f92a73a13a7c9.tar.gz
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.
-rw-r--r--configure.ac2
-rw-r--r--libguile/fports.c4
-rw-r--r--libguile/poll.c8
3 files changed, 8 insertions, 6 deletions
diff --git a/configure.ac b/configure.ac
index cbad0a162..4157982d3 100644
--- a/configure.ac
+++ b/configure.ac
@@ -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
diff --git a/libguile/fports.c b/libguile/fports.c
index 10cf6713a..c1a2800a2 100644
--- a/libguile/fports.c
+++ b/libguile/fports.c
@@ -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)
diff --git a/libguile/poll.c b/libguile/poll.c
index 1bb75727b..5bfd97b05 100644
--- a/libguile/poll.c
+++ b/libguile/poll.c
@@ -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