summaryrefslogtreecommitdiff
path: root/source3/smbd/oplock_irix.c
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2006-02-14 23:00:39 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 11:10:07 -0500
commit5c149702b0885db8d63f189f4bba0e17fdaad7a4 (patch)
tree36176b6c105694a97a539785f0c32b99ea799eaa /source3/smbd/oplock_irix.c
parent7f7c9849e4aed9ff7b51989a81f6039c5b59f2dd (diff)
downloadsamba-5c149702b0885db8d63f189f4bba0e17fdaad7a4.tar.gz
r13498: Fix the kernel oplocks code for IRIX. Should fix #3515.
Jeremy. (This used to be commit 006cf9c3654e7f18e01b75a5fe87798df862d26a)
Diffstat (limited to 'source3/smbd/oplock_irix.c')
-rw-r--r--source3/smbd/oplock_irix.c27
1 files changed, 26 insertions, 1 deletions
diff --git a/source3/smbd/oplock_irix.c b/source3/smbd/oplock_irix.c
index 2224f9a6682..29bbb0f2cac 100644
--- a/source3/smbd/oplock_irix.c
+++ b/source3/smbd/oplock_irix.c
@@ -93,6 +93,9 @@ static files_struct *irix_oplock_receive_message(fd_set *fds)
char dummy;
files_struct *fsp;
+ /* Ensure we only get one call per select fd set. */
+ FD_CLR(fds, oplock_pipe_read);
+
/*
* Read one byte of zero to clear the
* kernel break notify message.
@@ -204,14 +207,36 @@ oplock state of %x.\n", fsp->fsp_name, (unsigned int)fsp->dev,
/****************************************************************************
Set *maxfd to include oplock read pipe.
+ Note that fds MAY BE NULL ! If so we must do our own select.
****************************************************************************/
static BOOL irix_oplock_msg_waiting(fd_set *fds)
{
+ int maxfd, selrtn;
+ fd_set myfds;
+ struct timeval to;
+
if (oplock_pipe_read == -1)
return False;
- return FD_ISSET(oplock_pipe_read,fds);
+ if (fds) {
+ return FD_ISSET(oplock_pipe_read,fds);
+ }
+
+ FD_ZERO(&myfds);
+ maxfd = setup_oplock_select_set(&myfds);
+ /* Only do the select if we have something to select *on*. */
+ if (maxfd == 0) {
+ return False;
+ }
+
+ /* Do a zero-time select. We just need to find out if there
+ * are any outstanding messages. We use sys_select_intr as
+ * we need to ignore any signals. */
+
+ to = timeval_set(0, 0);
+ selrtn = sys_select_intr(maxfd+1,&myfds,NULL,NULL,&to);
+ return (selrtn == 1) ? True : False;
}
/****************************************************************************