diff options
| author | Ravi Pokala <rpokala@FreeBSD.org> | 2019-11-22 16:53:30 +0000 |
|---|---|---|
| committer | Ravi Pokala <rpokala@FreeBSD.org> | 2019-11-22 16:53:30 +0000 |
| commit | 90e43b446d7f3cfd571feee5554627a100b7c8bf (patch) | |
| tree | 764c4519717c598a5df6f45f5e1fc0259f13b665 /usr.sbin/rpc.lockd | |
| parent | 9c770a27cee56467a431b14b14f053ef25ba1997 (diff) | |
Notes
Diffstat (limited to 'usr.sbin/rpc.lockd')
| -rw-r--r-- | usr.sbin/rpc.lockd/lockd.c | 10 | ||||
| -rw-r--r-- | usr.sbin/rpc.lockd/rpc.lockd.8 | 14 |
2 files changed, 20 insertions, 4 deletions
diff --git a/usr.sbin/rpc.lockd/lockd.c b/usr.sbin/rpc.lockd/lockd.c index a208fdbf33527..9aac9273b3fd3 100644 --- a/usr.sbin/rpc.lockd/lockd.c +++ b/usr.sbin/rpc.lockd/lockd.c @@ -120,6 +120,7 @@ main(int argc, char **argv) char *endptr, **hosts_bak; struct sigaction sigalarm; int grace_period = 30; + int foreground = 0; struct netconfig *nconf; int have_v6 = 1; int maxrec = RPC_MAXDATASIZE; @@ -127,7 +128,7 @@ main(int argc, char **argv) int attempt_cnt, port_len, port_pos, ret; char **port_list; - while ((ch = getopt(argc, argv, "d:g:h:p:")) != (-1)) { + while ((ch = getopt(argc, argv, "d:Fg:h:p:")) != (-1)) { switch (ch) { case 'd': debug_level = atoi(optarg); @@ -136,6 +137,9 @@ main(int argc, char **argv) /* NOTREACHED */ } break; + case 'F': + foreground = 1; + break; case 'g': grace_period = atoi(optarg); if (!grace_period) { @@ -422,7 +426,7 @@ main(int argc, char **argv) * Note that it is NOT sensible to run this program from inetd - the * protocol assumes that it will run immediately at boot time. */ - if (daemon(0, debug_level > 0)) { + if ((foreground == 0) && daemon(0, debug_level > 0)) { err(1, "cannot fork"); /* NOTREACHED */ } @@ -844,7 +848,7 @@ void usage() { errx(1, "usage: rpc.lockd [-d <debuglevel>]" - " [-g <grace period>] [-h <bindip>] [-p <port>]"); + " [-F] [-g <grace period>] [-h <bindip>] [-p <port>]"); } /* diff --git a/usr.sbin/rpc.lockd/rpc.lockd.8 b/usr.sbin/rpc.lockd/rpc.lockd.8 index 763a163ffebe5..52d3675c54241 100644 --- a/usr.sbin/rpc.lockd/rpc.lockd.8 +++ b/usr.sbin/rpc.lockd/rpc.lockd.8 @@ -29,7 +29,7 @@ .\" .\" $FreeBSD$ .\" -.Dd November 2, 2007 +.Dd November 21, 2019 .Dt RPC.LOCKD 8 .Os .Sh NAME @@ -38,6 +38,7 @@ .Sh SYNOPSIS .Nm .Op Fl d Ar debug_level +.Op Fl F .Op Fl g Ar grace period .Op Fl h Ar bindip .Op Fl p Ar port @@ -70,6 +71,17 @@ in the generation of one log line per protocol operation. Higher debug levels can be specified, causing display of operation arguments and internal operations of the daemon. +.It Fl F +Run +.Nm +in the foreground, rather than going into daemon mode. +This is useful if some other process uses +.Xr fork 2 +and +.Xr exec 3 +to run +.Nm , +and wants to monitor when and how it exits. .It Fl g The .Fl g |
