diff options
author | Andrew Tridgell <tridge@samba.org> | 2000-06-11 06:46:05 +0000 |
---|---|---|
committer | Andrew Tridgell <tridge@samba.org> | 2000-06-11 06:46:05 +0000 |
commit | a4ba9bb939ff066c8844273da312209a1d1100d2 (patch) | |
tree | 724ec6c0c96d02168d2d062be4751aca063274b4 /source3/smbd | |
parent | 0fb1dbe7fa0da5a1374e4a8cb9c3e922c9a08c8d (diff) | |
download | samba-a4ba9bb939ff066c8844273da312209a1d1100d2.tar.gz samba-a4ba9bb939ff066c8844273da312209a1d1100d2.tar.bz2 samba-a4ba9bb939ff066c8844273da312209a1d1100d2.zip |
a better test for oplocks being enabled in this kernel
(This used to be commit cc0e919fdcb116c8f9688a4f5d7803fc8d7f9588)
Diffstat (limited to 'source3/smbd')
-rw-r--r-- | source3/smbd/oplock_linux.c | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/source3/smbd/oplock_linux.c b/source3/smbd/oplock_linux.c index ae0a72d0f6..46290683d2 100644 --- a/source3/smbd/oplock_linux.c +++ b/source3/smbd/oplock_linux.c @@ -31,7 +31,6 @@ static unsigned signals_received; static unsigned signals_processed; static int fd_pending; /* the fd of the current pending SIGIO */ - #ifndef F_SETLEASE #define F_SETLEASE 1024 #endif @@ -237,6 +236,19 @@ static BOOL linux_oplock_msg_waiting(fd_set *fds) return signals_processed != signals_received; } +/**************************************************************************** +see if the kernel supports oplocks +****************************************************************************/ +static BOOL linux_oplocks_available(void) +{ + int fd, ret; + fd = open("/dev/null", O_RDONLY); + if (fd == -1) return False; /* uggh! */ + ret = fcntl(fd, F_GETLEASE, 0); + close(fd); + return ret == F_UNLCK; +} + /**************************************************************************** setup kernel oplocks @@ -246,6 +258,11 @@ struct kernel_oplocks *linux_init_kernel_oplocks(void) static struct kernel_oplocks koplocks; struct sigaction act; + if (!linux_oplocks_available()) { + DEBUG(3,("Linux kernel oplocks not available\n")); + return NULL; + } + act.sa_handler = NULL; act.sa_sigaction = sigio_handler; act.sa_flags = SA_SIGINFO; |