summaryrefslogtreecommitdiffstats
path: root/utils/statd/statd.c
diff options
context:
space:
mode:
authorNeil Brown <neilb@suse.de>2007-03-20 10:13:00 +1100
committerNeil Brown <neilb@suse.de>2007-03-20 10:13:00 +1100
commit632127e335095b6053fa93b7b695d688918f36bb (patch)
treea87781ca66d3597af491355f2b15e07017dda194 /utils/statd/statd.c
parentf113db5225e2954a53fd7eecccfc08326904909f (diff)
downloadnfs-utils-632127e335095b6053fa93b7b695d688918f36bb.tar.gz
nfs-utils-632127e335095b6053fa93b7b695d688918f36bb.tar.xz
nfs-utils-632127e335095b6053fa93b7b695d688918f36bb.zip
Allow rpc.statd to *not* run sm-notify.
With -L (for Listen-only) or --no-notify, statd will not run sm-notify.
Diffstat (limited to 'utils/statd/statd.c')
-rw-r--r--utils/statd/statd.c46
1 files changed, 27 insertions, 19 deletions
diff --git a/utils/statd/statd.c b/utils/statd/statd.c
index 6200911..17e2947 100644
--- a/utils/statd/statd.c
+++ b/utils/statd/statd.c
@@ -70,6 +70,7 @@ static struct option longopts[] =
{ "state-directory-path", 1, 0, 'P' },
{ "notify-mode", 0, 0, 'N' },
{ "ha-callout", 1, 0, 'H' },
+ { "no-notify", 0, 0, 'L' },
{ NULL, 0, 0, 0 }
};
@@ -158,6 +159,7 @@ usage()
fprintf(stderr," -n, --name Specify a local hostname.\n");
fprintf(stderr," -P State directory path.\n");
fprintf(stderr," -N Run in notify only mode.\n");
+ fprintf(stderr," -L, --no-notify Do not perform any notification.\n");
fprintf(stderr," -H Specify a high-availability callout program.\n");
}
@@ -274,7 +276,7 @@ int main (int argc, char **argv)
MY_NAME = NULL;
/* Process command line switches */
- while ((arg = getopt_long(argc, argv, "h?vVFNH:dn:p:o:P:", longopts, NULL)) != EOF) {
+ while ((arg = getopt_long(argc, argv, "h?vVFNH:dn:p:o:P:L", longopts, NULL)) != EOF) {
switch (arg) {
case 'V': /* Version */
case 'v':
@@ -286,6 +288,9 @@ int main (int argc, char **argv)
case 'N':
run_mode |= MODE_NOTIFY_ONLY;
break;
+ case 'L': /* Listen only */
+ run_mode |= MODE_NO_NOTIFY;
+ break;
case 'd': /* No daemon only - log to stderr */
run_mode |= MODE_LOG_STDERR;
break;
@@ -458,15 +463,16 @@ int main (int argc, char **argv)
create_pidfile();
atexit(truncate_pidfile);
- switch (pid = fork()) {
- case 0:
- run_sm_notify(out_port);
- break;
- case -1:
- break;
- default:
- waitpid(pid, NULL, 0);
- }
+ if (! (run_mode & MODE_NO_NOTIFY))
+ switch (pid = fork()) {
+ case 0:
+ run_sm_notify(out_port);
+ break;
+ case -1:
+ break;
+ default:
+ waitpid(pid, NULL, 0);
+ }
drop_privs();
@@ -496,15 +502,17 @@ int main (int argc, char **argv)
* responding to SM_SIMU_CRASH is an important use cases to
* get perfect.
*/
- switch (pid = fork()) {
- case 0:
- run_sm_notify(out_port);
- break;
- case -1:
- break;
- default:
- waitpid(pid, NULL, 0);
- }
+ if (! (run_mode & MODE_NO_NOTIFY))
+ switch (pid = fork()) {
+ case 0:
+ run_sm_notify(out_port);
+ break;
+ case -1:
+ break;
+ default:
+ waitpid(pid, NULL, 0);
+ }
+
}
return 0;
}