unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
* select issue
@ 2011-10-12  7:13 rixed
  2011-10-15 14:27 ` Ludovic Courtès
  0 siblings, 1 reply; 2+ messages in thread
From: rixed @ 2011-10-12  7:13 UTC (permalink / raw)
  To: guile-devel

[-- Attachment #1: Type: text/plain, Size: 175 bytes --]

I still got this patch (attached) on v2.0.2 on my own repo, which
fixes runtime behavior when more than 1024 files are opened.

Can someone please comment/commit/reject it ?


[-- Attachment #2: patch --]
[-- Type: text/plain, Size: 1086 bytes --]

commit da70784bd2048f7f1a8934711e5e24f975d68b0b
Author: Cedric Cellier <cedric.cellier@securactive.net>
Date:   Tue Jun 21 16:30:45 2011 +0200

    Fix fport_input_waiting when fd > SELECT_SET_SIZE (cherry-picked from 1-8-8)
    
      By allowing this function to use poll instead of select.

diff --git a/libguile/fports.c b/libguile/fports.c
index 0b84d44..f19d291 100644
--- a/libguile/fports.c
+++ b/libguile/fports.c
@@ -49,7 +49,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>
 
@@ -585,7 +587,14 @@ scm_fdes_to_port (int fdes, char *mode, SCM name)
 static int
 fport_input_waiting (SCM port)
 {
-#ifdef HAVE_SELECT
+#ifdef HAVE_POLL
+  int fdes = SCM_FSTREAM (port)->fdes;
+  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)
   int fdes = SCM_FSTREAM (port)->fdes;
   struct timeval timeout;
   SELECT_TYPE read_set;

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: select issue
  2011-10-12  7:13 select issue rixed
@ 2011-10-15 14:27 ` Ludovic Courtès
  0 siblings, 0 replies; 2+ messages in thread
From: Ludovic Courtès @ 2011-10-15 14:27 UTC (permalink / raw)
  To: guile-devel

rixed@happyleptic.org skribis:

> I still got this patch (attached) on v2.0.2 on my own repo, which
> fixes runtime behavior when more than 1024 files are opened.

Applied with minor changes, thanks!

Ludo'.




^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2011-10-15 14:27 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-10-12  7:13 select issue rixed
2011-10-15 14:27 ` Ludovic Courtès

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).