summaryrefslogtreecommitdiff
path: root/source3/smbd
diff options
context:
space:
mode:
Diffstat (limited to 'source3/smbd')
-rw-r--r--source3/smbd/notify.c4
-rw-r--r--source3/smbd/notify_hash.c1
-rw-r--r--source3/smbd/notify_kernel.c7
-rw-r--r--source3/smbd/process.c22
4 files changed, 18 insertions, 16 deletions
diff --git a/source3/smbd/notify.c b/source3/smbd/notify.c
index c577d0aef3..912ab43e9e 100644
--- a/source3/smbd/notify.c
+++ b/source3/smbd/notify.c
@@ -144,9 +144,9 @@ void remove_pending_change_notify_requests_by_filename(files_struct *fsp)
/****************************************************************************
Return true if there are pending change notifies.
****************************************************************************/
-BOOL change_notifies_pending(void)
+int change_notify_timeout(void)
{
- return (change_notify_list != NULL);
+ return cnotify->select_time;
}
/****************************************************************************
diff --git a/source3/smbd/notify_hash.c b/source3/smbd/notify_hash.c
index e01f660700..fe09d9cf9d 100644
--- a/source3/smbd/notify_hash.c
+++ b/source3/smbd/notify_hash.c
@@ -165,6 +165,7 @@ struct cnotify_fns *hash_notify_init(void)
cnotify.register_notify = hash_register_notify;
cnotify.check_notify = hash_check_notify;
cnotify.remove_notify = hash_remove_notify;
+ cnotify.select_time = lp_change_notify_timeout();
return &cnotify;
}
diff --git a/source3/smbd/notify_kernel.c b/source3/smbd/notify_kernel.c
index c7fb5ca0dd..a7d4591cc9 100644
--- a/source3/smbd/notify_kernel.c
+++ b/source3/smbd/notify_kernel.c
@@ -167,7 +167,7 @@ static BOOL kernel_notify_available(void)
if (fd == -1) return False; /* uggh! */
ret = fcntl(fd, F_NOTIFY, 0);
close(fd);
- return ret == 0 || errno != EINVAL;
+ return ret == 0;
}
@@ -179,8 +179,6 @@ struct cnotify_fns *kernel_notify_init(void)
static struct cnotify_fns cnotify;
struct sigaction act;
- if (!kernel_notify_available()) return NULL;
-
act.sa_handler = NULL;
act.sa_sigaction = signal_handler;
act.sa_flags = SA_SIGINFO;
@@ -189,9 +187,12 @@ struct cnotify_fns *kernel_notify_init(void)
return NULL;
}
+ if (!kernel_notify_available()) return NULL;
+
cnotify.register_notify = kernel_register_notify;
cnotify.check_notify = kernel_check_notify;
cnotify.remove_notify = kernel_remove_notify;
+ cnotify.select_time = -1;
return &cnotify;
}
diff --git a/source3/smbd/process.c b/source3/smbd/process.c
index b84e55343e..3c85c05312 100644
--- a/source3/smbd/process.c
+++ b/source3/smbd/process.c
@@ -836,21 +836,21 @@ int chain_reply(char *inbuf,char *outbuf,int size,int bufsize)
static int setup_select_timeout(void)
{
- int change_notify_timeout = lp_change_notify_timeout() * 1000;
- int select_timeout;
+ int select_timeout;
+ int t;
- /*
- * Increase the select timeout back to SMBD_SELECT_TIMEOUT if we
- * have removed any blocking locks. JRA.
- */
+ /*
+ * Increase the select timeout back to SMBD_SELECT_TIMEOUT if we
+ * have removed any blocking locks. JRA.
+ */
- select_timeout = blocking_locks_pending() ? SMBD_SELECT_TIMEOUT_WITH_PENDING_LOCKS*1000 :
- SMBD_SELECT_TIMEOUT*1000;
+ select_timeout = blocking_locks_pending() ? SMBD_SELECT_TIMEOUT_WITH_PENDING_LOCKS*1000 :
+ SMBD_SELECT_TIMEOUT*1000;
- if (change_notifies_pending())
- select_timeout = MIN(select_timeout, change_notify_timeout);
+ t = change_notify_timeout();
+ if (t != -1) select_timeout = MIN(select_timeout, t*1000);
- return select_timeout;
+ return select_timeout;
}
/****************************************************************************