guile-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Guile-commits] GNU Guile branch, branch_release-1-8, updated. release_1


From: Ludovic Courtès
Subject: [Guile-commits] GNU Guile branch, branch_release-1-8, updated. release_1-8-8-4-gc27411f
Date: Wed, 19 Oct 2011 15:35:59 +0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU Guile".

http://git.savannah.gnu.org/cgit/guile.git/commit/?id=c27411f180c42c89e1282edf0c992b6d11c8db7f

The branch, branch_release-1-8 has been updated
       via  c27411f180c42c89e1282edf0c992b6d11c8db7f (commit)
      from  99c6be814f06952e228b1610407faa9161a65cdf (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit c27411f180c42c89e1282edf0c992b6d11c8db7f
Author: Cedric Cellier <address@hidden>
Date:   Sat Oct 15 16:25:21 2011 +0200

    Default to using poll(2) in `fport_input_waiting'.
    
    * libguile/fports.c (fport_input_waiting): Use poll(2) instead of
      select(2) when possible.  Cosmetic changes by Ludovic Courtès.
    
    * configure.in: Look for <poll.h> and `poll'.

-----------------------------------------------------------------------

Summary of changes:
 configure.in      |    7 ++++---
 libguile/fports.c |   19 +++++++++++++++++--
 2 files changed, 21 insertions(+), 5 deletions(-)

diff --git a/configure.in b/configure.in
index 217ac83..4ce2783 100644
--- a/configure.in
+++ b/configure.in
@@ -4,7 +4,8 @@ dnl
 
 define(GUILE_CONFIGURE_COPYRIGHT,[[
 
-Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 
2008, 2009 Free Software Foundation, Inc.
+Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
+  2006, 2007, 2008, 2009, 2011 Free Software Foundation, Inc.
 
 This file is part of GUILE
 
@@ -661,7 +662,7 @@ AC_CHECK_HEADERS([complex.h fenv.h io.h libc.h limits.h 
malloc.h memory.h proces
 regex.h rxposix.h rx/rxposix.h sys/dir.h sys/ioctl.h sys/select.h \
 sys/time.h sys/timeb.h sys/times.h sys/stdtypes.h sys/types.h \
 sys/utime.h time.h unistd.h utime.h pwd.h grp.h sys/utsname.h \
-direct.h strings.h machine/fpu.h])
+direct.h strings.h machine/fpu.h poll.h])
 
 # "complex double" is new in C99, and "complex" is only a keyword if
 # <complex.h> is included
@@ -755,7 +756,7 @@ AC_CHECK_HEADERS([assert.h crt_externs.h])
 #   isblank - available as a GNU extension or in C99
 #   _NSGetEnviron - Darwin specific
 #
-AC_CHECK_FUNCS([DINFINITY DQNAN cexp chsize clog clog10 ctermid fesetround 
ftime ftruncate fchown getcwd geteuid gettimeofday gmtime_r ioctl lstat mkdir 
mknod nice pipe _pipe readdir_r readdir64_r readlink rename rmdir select 
setegid seteuid setlocale setpgid setsid sigaction siginterrupt stat64 strftime 
strptime symlink sync sysconf tcgetpgrp tcsetpgrp times uname waitpid strdup 
system usleep atexit on_exit chown link fcntl ttyname getpwent getgrent kill 
getppid getpgrp fork setitimer getitimer strchr strcmp index bcopy memcpy 
rindex truncate unsetenv isblank _NSGetEnviron strncasecmp])
+AC_CHECK_FUNCS([DINFINITY DQNAN cexp chsize clog clog10 ctermid fesetround 
ftime ftruncate fchown getcwd geteuid gettimeofday gmtime_r ioctl lstat mkdir 
mknod nice pipe _pipe readdir_r readdir64_r readlink rename rmdir select 
setegid seteuid setlocale setpgid setsid sigaction siginterrupt stat64 strftime 
strptime symlink sync sysconf tcgetpgrp tcsetpgrp times uname waitpid strdup 
system usleep atexit on_exit chown link fcntl ttyname getpwent getgrent kill 
getppid getpgrp fork setitimer getitimer strchr strcmp index bcopy memcpy 
rindex truncate unsetenv isblank _NSGetEnviron strncasecmp poll])
 
 # Reasons for testing:
 #   netdb.h - not in mingw
diff --git a/libguile/fports.c b/libguile/fports.c
index 007ee3f..e7ad4a3 100644
--- a/libguile/fports.c
+++ b/libguile/fports.c
@@ -46,7 +46,9 @@
 #ifdef HAVE_STRUCT_STAT_ST_BLKSIZE
 #include <sys/stat.h>
 #endif
-
+#ifdef HAVE_POLL_H
+#include <poll.h>
+#endif
 #include <errno.h>
 #include <sys/types.h>
 
@@ -485,8 +487,21 @@ scm_fdes_to_port (int fdes, char *mode, SCM name)
 static int
 fport_input_waiting (SCM port)
 {
-#ifdef HAVE_SELECT
   int fdes = SCM_FSTREAM (port)->fdes;
+
+  /* `FD_SETSIZE', which is 1024 on GNU systems, effectively limits the
+     highest numerical value of file descriptors that can be monitored.
+     Thus, use poll(2) whenever that is possible.  */
+
+#ifdef HAVE_POLL
+  struct pollfd pollfd = { fdes, POLLIN, 0 };
+
+  if (poll (&pollfd, 1, 0) < 0)
+    scm_syserror ("fport_input_waiting");
+
+  return pollfd.revents & POLLIN ? 1 : 0;
+
+#elif defined(HAVE_SELECT)
   struct timeval timeout;
   SELECT_TYPE read_set;
   SELECT_TYPE write_set;


hooks/post-receive
-- 
GNU Guile



reply via email to

[Prev in Thread] Current Thread [Next in Thread]