From e7a90e99053a6c0575efcb19f3ddda3abd5f59cd Mon Sep 17 00:00:00 2001 From: hjl Date: Fri, 17 Aug 2001 16:12:05 +0000 Subject: 2001-08-17 Ragnar Kjørstad H.J. Lu MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * etc/redhat/nfslock.init (STATDARG): New. Pass it to rpc.statd. * utils/statd/statd.c (longopts): Add "name". (usage): Add "-n/--name". (main): Set MY_NAME with "-n/--name". * utils/statd/state.c (change_state): Set MY_NAME only if it is NULL. * utils/statd/statd.man: Updated for "-n/--name". --- utils/statd/statd.c | 10 +++++++++- utils/statd/statd.man | 13 ++++++++++++- utils/statd/state.c | 2 +- 3 files changed, 22 insertions(+), 3 deletions(-) (limited to 'utils/statd') diff --git a/utils/statd/statd.c b/utils/statd/statd.c index 3d90d64..4fc135a 100644 --- a/utils/statd/statd.c +++ b/utils/statd/statd.c @@ -42,6 +42,7 @@ static struct option longopts[] = { "version", 0, 0, 'v' }, { "outgoing-port", 1, 0, 'o' }, { "port", 1, 0, 'p' }, + { "name", 1, 0, 'n' }, { NULL, 0, 0, 0 } }; @@ -126,6 +127,7 @@ usage() fprintf(stderr," -p, --port Port to listen on\n"); fprintf(stderr," -o, --outgoing-port Port for outgoing connections\n"); fprintf(stderr," -V, -v, --version Display version information and exit.\n"); + fprintf(stderr," -n, --name Specify a local hostname.\n"); } /* @@ -155,8 +157,11 @@ int main (int argc, char **argv) version_p = VERSION; } + /* Set hostname */ + MY_NAME = NULL; + /* Process command line switches */ - while ((arg = getopt_long(argc, argv, "h?vVFdp:o:", longopts, NULL)) != EOF) { + while ((arg = getopt_long(argc, argv, "h?vVFdn:p:o:", longopts, NULL)) != EOF) { switch (arg) { case 'V': /* Version */ case 'v': @@ -186,6 +191,9 @@ int main (int argc, char **argv) exit(1); } break; + case 'n': /* Specify local hostname */ + MY_NAME = xstrdup(optarg); + break; case '?': /* heeeeeelllllllpppp? heh */ case 'h': usage(); diff --git a/utils/statd/statd.man b/utils/statd/statd.man index 84199e8..9f861b2 100644 --- a/utils/statd/statd.man +++ b/utils/statd/statd.man @@ -8,7 +8,7 @@ .SH NAME rpc.statd \- NSM status monitor .SH SYNOPSIS -.B "/sbin/rpc.statd [-F] [-d] [-?] [-o " port "] [-p " port "] [-V]" +.B "/sbin/rpc.statd [-F] [-d] [-?] [-n " name "] [-o " port "] [-p " port "] [-V]" .SH DESCRIPTION The .B rpc.statd @@ -52,6 +52,17 @@ be used in conjunction with the .B -F parameter. .TP +.BI "\-n," "" " \-\-name " name +specify a name for +.B rpc.statd +to use as the local hostname. By default, +.BR rpc.statd +will call +.BR gethostname (2) +to get the local hostname. Specifying +a local hostname may be useful for machines with more than one +interfaces. +.TP .BI "\-o," "" " \-\-outgoing\-port " port specify a port for .B rpc.statd diff --git a/utils/statd/state.c b/utils/statd/state.c index 101c00b..6becdc7 100644 --- a/utils/statd/state.c +++ b/utils/statd/state.c @@ -56,7 +56,7 @@ change_state (void) if (close (fd) == -1) log (L_ERROR, "close (%s): %s", SM_STAT_PATH, strerror (errno)); - if (!restart) { + if (MY_NAME == NULL) { char fullhost[SM_MAXSTRLEN + 1]; struct hostent *hostinfo; -- cgit