diff options
author | dfr <dfr@FreeBSD.org> | 2008-03-27 11:54:20 +0000 |
---|---|---|
committer | dfr <dfr@FreeBSD.org> | 2008-03-27 11:54:20 +0000 |
commit | dc98ee4196c8969bd3d587924ee9e570228ec62f (patch) | |
tree | 567b9aa2e60465e9958f917ce391a9eb7692527f /usr.sbin/rpc.lockd/lockd.c | |
parent | 34e730ca273d9bd38d9081bc80c78688c6abdd4c (diff) | |
download | FreeBSD-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/lockd.c')
-rw-r--r-- | usr.sbin/rpc.lockd/lockd.c | 19 |
1 files changed, 14 insertions, 5 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); |