summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog14
-rwxr-xr-xetc/redhat/nfslock.init10
-rw-r--r--utils/statd/statd.c10
-rw-r--r--utils/statd/statd.man13
-rw-r--r--utils/statd/state.c2
5 files changed, 44 insertions, 5 deletions
diff --git a/ChangeLog b/ChangeLog
index 7cc62a0..9bc2e69 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,17 @@
+2001-08-17 Ragnar Kjørstad <nfs@ragnark.vestdata.no>
+ H.J. Lu <hjl@lucon.org>
+
+ * 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".
+
2001-07-26 H.J. Lu <hjl@lucon.org>
* nfs-utils.spec (Release): Set to 8.
diff --git a/etc/redhat/nfslock.init b/etc/redhat/nfslock.init
index 401c614..48cea0f 100755
--- a/etc/redhat/nfslock.init
+++ b/etc/redhat/nfslock.init
@@ -25,6 +25,12 @@ fi
[ -x /sbin/rpc.lockd ] || exit 0
[ -x /sbin/rpc.statd ] || exit 0
+if [ -n "${STATD_HOSTNAME}" ]; then
+ STATDARG="-n ${STATD_HOSTNAME}"
+else
+ STATDARG=""
+fi
+
# See how we were called.
case "$1" in
start)
@@ -34,7 +40,7 @@ case "$1" in
daemon rpc.lockd
echo
echo -n "Starting NFS statd: "
- daemon rpc.statd
+ daemon rpc.statd ${STATDARG}
echo
touch /var/lock/subsys/nfslock
;;
@@ -69,7 +75,7 @@ case "$1" in
daemon rpc.lockd
echo -n "rpc.statd "
killproc rpc.statd
- daemon rpc.statd
+ daemon rpc.statd ${STATDARG}
touch /var/lock/subsys/nfslock
echo "done."
;;
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;