summaryrefslogtreecommitdiff
path: root/source3/lib/select.c
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2001-02-22 17:39:36 +0000
committerJeremy Allison <jra@samba.org>2001-02-22 17:39:36 +0000
commitffa09ecfc1a77f03174ec0460d566190f2413a4d (patch)
tree053eb310fb0e700338454b3be3ad3f56ff650441 /source3/lib/select.c
parent5462cf51ee3056b93dbf48138f5b3268f18a5158 (diff)
downloadsamba-ffa09ecfc1a77f03174ec0460d566190f2413a4d.tar.gz
samba-ffa09ecfc1a77f03174ec0460d566190f2413a4d.tar.bz2
samba-ffa09ecfc1a77f03174ec0460d566190f2413a4d.zip
lib/select.c: Fix for Linux 2.0.x kernel that causes select to return true on a pipe
and then a blocking read to fail. Make the pipe read/write non blocking. printing/printing.c: Added a mutex around the code that enumerates all the jobs in a print queue. Allows only one smbd to be doing this at any one time. This fixes a capacity problem discovered at HP with <10,000 jobs in a print queue. Jeremy. (This used to be commit 0d3ae603a2b86d476458ee2a7d4f7d22636c3f66)
Diffstat (limited to 'source3/lib/select.c')
-rw-r--r--source3/lib/select.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/source3/lib/select.c b/source3/lib/select.c
index 458642f57e..c654a4a02c 100644
--- a/source3/lib/select.c
+++ b/source3/lib/select.c
@@ -58,6 +58,21 @@ int sys_select(int maxfd, fd_set *fds,struct timeval *tval)
if (initialised != sys_getpid()) {
pipe(select_pipe);
+
+ /*
+ * These next two lines seem to fix a bug with the Linux
+ * 2.0.x kernel (and probably other UNIXes as well) where
+ * the one byte read below can block even though the
+ * select returned that there is data in the pipe and
+ * the pipe_written variable was incremented. Thanks to
+ * HP for finding this one. JRA.
+ */
+
+ if(set_blocking(select_pipe[0],0)==-1)
+ smb_panic("select_pipe[0]: O_NONBLOCK failed.\n");
+ if(set_blocking(select_pipe[1],0)==-1)
+ smb_panic("select_pipe[1]: O_NONBLOCK failed.\n");
+
initialised = sys_getpid();
}