From ffa09ecfc1a77f03174ec0460d566190f2413a4d Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Thu, 22 Feb 2001 17:39:36 +0000 Subject: 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) --- source3/lib/select.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'source3/lib/select.c') 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(); } -- cgit