summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2000-06-14 07:11:27 +0000
committerAndrew Tridgell <tridge@samba.org>2000-06-14 07:11:27 +0000
commitcc5502a4d01bfc4946fbd198aad75ea03e9734d3 (patch)
tree0f2ed7048c5c403f8bf90e3e259d7aa907f2cc3c /source3
parent1896c721fbd01b6d1f95b05350010c17fccbf612 (diff)
downloadsamba-cc5502a4d01bfc4946fbd198aad75ea03e9734d3.tar.gz
samba-cc5502a4d01bfc4946fbd198aad75ea03e9734d3.tar.bz2
samba-cc5502a4d01bfc4946fbd198aad75ea03e9734d3.zip
allow the notify implementation to choose the select timeout change
(This used to be commit b1441d9622609af5ef598c5e1e1f5af438dc0731)
Diffstat (limited to 'source3')
-rw-r--r--source3/include/config.h.in1
-rw-r--r--source3/include/proto.h2
-rw-r--r--source3/include/smb.h1
-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
7 files changed, 21 insertions, 17 deletions
diff --git a/source3/include/config.h.in b/source3/include/config.h.in
index e3afd6a66a..ab9da3a7ad 100644
--- a/source3/include/config.h.in
+++ b/source3/include/config.h.in
@@ -144,6 +144,7 @@
#undef HAVE_LIBREADLINE
#undef HAVE_KERNEL_OPLOCKS_IRIX
#undef HAVE_KERNEL_OPLOCKS_LINUX
+#undef HAVE_KERNEL_CHANGE_NOTIFY
#undef HAVE_IRIX_SPECIFIC_CAPABILITIES
#undef HAVE_INT16_FROM_RPC_RPC_H
#undef HAVE_UINT16_FROM_RPC_RPC_H
diff --git a/source3/include/proto.h b/source3/include/proto.h
index e801f779f6..0609674e59 100644
--- a/source3/include/proto.h
+++ b/source3/include/proto.h
@@ -3254,7 +3254,7 @@ BOOL disk_quotas(char *path,SMB_BIG_UINT *bsize,SMB_BIG_UINT *dfree,SMB_BIG_UINT
void remove_pending_change_notify_requests_by_fid(files_struct *fsp);
void remove_pending_change_notify_requests_by_mid(int mid);
void remove_pending_change_notify_requests_by_filename(files_struct *fsp);
-BOOL change_notifies_pending(void);
+int change_notify_timeout(void);
BOOL process_pending_change_notify_queue(time_t t);
BOOL change_notify_set(char *inbuf, files_struct *fsp, connection_struct *conn, uint32 flags);
BOOL init_change_notify(void);
diff --git a/source3/include/smb.h b/source3/include/smb.h
index cf93689f64..bc552e0470 100644
--- a/source3/include/smb.h
+++ b/source3/include/smb.h
@@ -1643,6 +1643,7 @@ struct cnotify_fns {
void * (*register_notify)(connection_struct *conn, char *path, uint32 flags);
BOOL (*check_notify)(connection_struct *conn, uint16 vuid, char *path, uint32 flags, void *data, time_t t);
void (*remove_notify)(void *data);
+ int select_time;
};
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;
}
/****************************************************************************