summaryrefslogtreecommitdiffstats
path: root/usr.sbin/rpc.lockd
diff options
context:
space:
mode:
authordfr <dfr@FreeBSD.org>2008-03-27 11:54:20 +0000
committerdfr <dfr@FreeBSD.org>2008-03-27 11:54:20 +0000
commitdc98ee4196c8969bd3d587924ee9e570228ec62f (patch)
tree567b9aa2e60465e9958f917ce391a9eb7692527f /usr.sbin/rpc.lockd
parent34e730ca273d9bd38d9081bc80c78688c6abdd4c (diff)
downloadFreeBSD-src-dc98ee4196c8969bd3d587924ee9e570228ec62f.zip
FreeBSD-src-dc98ee4196c8969bd3d587924ee9e570228ec62f.tar.gz
Add kernel module support for nfslockd and krpc. Use the module system
to detect (or load) kernel NLM support in rpc.lockd. Remove the '-k' option to rpc.lockd and make kernel NLM the default. A user can still force the use of the old user NLM by building a kernel without NFSLOCKD and/or removing the nfslockd.ko module.
Diffstat (limited to 'usr.sbin/rpc.lockd')
-rw-r--r--usr.sbin/rpc.lockd/lockd.c19
-rw-r--r--usr.sbin/rpc.lockd/rpc.lockd.86
2 files changed, 14 insertions, 11 deletions
diff --git a/usr.sbin/rpc.lockd/lockd.c b/usr.sbin/rpc.lockd/lockd.c
index 3b1572e..1e55540 100644
--- a/usr.sbin/rpc.lockd/lockd.c
+++ b/usr.sbin/rpc.lockd/lockd.c
@@ -46,7 +46,9 @@ __RCSID("$NetBSD: lockd.c,v 1.7 2000/08/12 18:08:44 thorpej Exp $");
* The actual program logic is in the file lock_proc.c
*/
-#include <sys/types.h>
+#include <sys/param.h>
+#include <sys/linker.h>
+#include <sys/module.h>
#include <sys/socket.h>
#include <sys/stat.h>
@@ -116,7 +118,7 @@ main(int argc, char **argv)
int maxrec = RPC_MAXDATASIZE;
in_port_t svcport = 0;
- while ((ch = getopt(argc, argv, "d:g:h:kp:")) != (-1)) {
+ while ((ch = getopt(argc, argv, "d:g:h:p:")) != (-1)) {
switch (ch) {
case 'd':
debug_level = atoi(optarg);
@@ -153,9 +155,6 @@ main(int argc, char **argv)
out_of_mem();
}
break;
- case 'k':
- kernel_lockd = TRUE;
- break;
case 'p':
endptr = NULL;
svcport = (in_port_t)strtoul(optarg, &endptr, 10);
@@ -175,6 +174,16 @@ main(int argc, char **argv)
exit(1);
}
+ kernel_lockd = FALSE;
+ if (modfind("nfslockd") < 0) {
+ if (kldload("nfslockd") < 0) {
+ fprintf(stderr, "Can't find or load kernel support for rpc.lockd - using non-kernel implementation\n");
+ }
+ kernel_lockd = TRUE;
+ } else {
+ kernel_lockd = TRUE;
+ }
+
(void)rpcb_unset(NLM_PROG, NLM_SM, NULL);
(void)rpcb_unset(NLM_PROG, NLM_VERS, NULL);
(void)rpcb_unset(NLM_PROG, NLM_VERSX, NULL);
diff --git a/usr.sbin/rpc.lockd/rpc.lockd.8 b/usr.sbin/rpc.lockd/rpc.lockd.8
index 9cd429b..4fabe5d 100644
--- a/usr.sbin/rpc.lockd/rpc.lockd.8
+++ b/usr.sbin/rpc.lockd/rpc.lockd.8
@@ -41,7 +41,6 @@
.Nd NFS file locking daemon
.Sh SYNOPSIS
.Nm
-.Op Fl k
.Op Fl d Ar debug_level
.Op Fl g Ar grace period
.Op Fl h Ar bindip
@@ -59,11 +58,6 @@ with
Options and operands available for
.Nm :
.Bl -tag -width indent
-.It Fl k
-The
-.Fl k
-option specifies the use of the kernel-resident NFS lock manager, if
-possible.
.It Fl d
The
.Fl d
OpenPOWER on IntegriCloud