-#define OLD_NTDOMAIN 1
/*
- Unix SMB/Netbios implementation.
- Version 3.0
+ Unix SMB/CIFS implementation.
change notify handling - linux kernel based implementation
Copyright (C) Andrew Tridgell 2000
#if HAVE_KERNEL_CHANGE_NOTIFY
-extern int DEBUGLEVEL;
-static VOLATILE SIG_ATOMIC_T fd_pending;
-static VOLATILE SIG_ATOMIC_T signals_received;
-static VOLATILE SIG_ATOMIC_T signals_processed;
+static VOLATILE sig_atomic_t fd_pending;
+static VOLATILE sig_atomic_t signals_received;
+static VOLATILE sig_atomic_t signals_processed;
#ifndef DN_ACCESS
#define DN_ACCESS 0x00000001 /* File accessed in directory */
/****************************************************************************
the signal handler for change notify
*****************************************************************************/
-static void signal_handler(int signal, siginfo_t *info, void *unused)
+static void signal_handler(int sig, siginfo_t *info, void *unused)
{
- BlockSignals(True, signal);
- fd_pending = (SIG_ATOMIC_T)info->si_fd;
+ BlockSignals(True, sig);
+ fd_pending = (sig_atomic_t)info->si_fd;
signals_received++;
sys_select_signal();
}
/****************************************************************************
-check if a change notify should be issued
+ Check if a change notify should be issued.
+ time non-zero means timeout check (used for hash). Ignore this (async method
+ where time is zero will be used instead).
*****************************************************************************/
static BOOL kernel_check_notify(connection_struct *conn, uint16 vuid, char *path, uint32 flags, void *datap, time_t t)
{
struct change_data *data = (struct change_data *)datap;
+ if (t)
+ return False;
+
if (data->directory_handle != (int)fd_pending) return False;
DEBUG(3,("kernel change notify on %s fd=%d\n", path, (int)fd_pending));
close((int)fd_pending);
- fd_pending = (SIG_ATOMIC_T)-1;
+ fd_pending = (sig_atomic_t)-1;
data->directory_handle = -1;
signals_processed++;
BlockSignals(False, RT_SIGNAL_NOTIFY);
int fd = data->directory_handle;
if (fd != -1) {
if (fd == (int)fd_pending) {
- fd_pending = (SIG_ATOMIC_T)-1;
+ fd_pending = (sig_atomic_t)-1;
signals_processed++;
BlockSignals(False, RT_SIGNAL_NOTIFY);
}
close(fd);
}
- free(data);
+ SAFE_FREE(data);
DEBUG(3,("removed kernel change notify fd=%d\n", fd));
}
int fd;
unsigned long kernel_flags;
- fd = dos_open(path, O_RDONLY, 0);
+ fd = conn->vfs_ops.open(conn, path, O_RDONLY, 0);
if (fd == -1) {
DEBUG(3,("Failed to open directory %s for change notify\n", path));
#else
void notify_kernel_dummy(void) {}
#endif /* HAVE_KERNEL_CHANGE_NOTIFY */
-
-#undef OLD_NTDOMAIN