]> git.decadent.org.uk Git - nfs-utils.git/commitdiff
2001-08-17 Ragnar Kjørstad <nfs@ragnark.vestdata.no>
authorhjl <hjl>
Fri, 17 Aug 2001 16:12:05 +0000 (16:12 +0000)
committerhjl <hjl>
Fri, 17 Aug 2001 16:12:05 +0000 (16:12 +0000)
    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".

ChangeLog
etc/redhat/nfslock.init
utils/statd/statd.c
utils/statd/statd.man
utils/statd/state.c

index 7cc62a005a00a8e6d3afe0eca328088bdad78430..9bc2e695b2d4025148a289281e176998de51bbb7 100644 (file)
--- 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.
 2001-07-26  H.J. Lu <hjl@lucon.org>
 
        * nfs-utils.spec (Release): Set to 8.
index 401c61445dd5238ba10bf01879ded1d7c0c5ab70..48cea0f3fc5633ea6f083d2129984c4eb868579b 100755 (executable)
@@ -25,6 +25,12 @@ fi
 [ -x /sbin/rpc.lockd ] || exit 0
 [ -x /sbin/rpc.statd ] || exit 0
 
 [ -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)
 # 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.lockd
        echo
        echo -n "Starting NFS statd: "
-       daemon rpc.statd
+       daemon rpc.statd ${STATDARG}
        echo
        touch /var/lock/subsys/nfslock
        ;;
        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.lockd
        echo -n "rpc.statd "
        killproc rpc.statd
-       daemon rpc.statd
+       daemon rpc.statd ${STATDARG}
        touch /var/lock/subsys/nfslock
        echo "done."
        ;;
        touch /var/lock/subsys/nfslock
        echo "done."
        ;;
index 3d90d641851aa26c86f5920b6bdd38976db8f9df..4fc135abee256c58484947734f3e8a415aa85787 100644 (file)
@@ -42,6 +42,7 @@ static struct option longopts[] =
        { "version", 0, 0, 'v' },
        { "outgoing-port", 1, 0, 'o' },
        { "port", 1, 0, 'p' },
        { "version", 0, 0, 'v' },
        { "outgoing-port", 1, 0, 'o' },
        { "port", 1, 0, 'p' },
+       { "name", 1, 0, 'n' },
        { NULL, 0, 0, 0 }
 };
 
        { 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,"      -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;
        }
        
                version_p = VERSION;
        }
        
+       /* Set hostname */
+       MY_NAME = NULL;
+
        /* Process command line switches */
        /* 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':
                switch (arg) {
                case 'V':       /* Version */
                case 'v':
@@ -186,6 +191,9 @@ int main (int argc, char **argv)
                                exit(1);
                        }
                        break;
                                exit(1);
                        }
                        break;
+               case 'n':       /* Specify local hostname */
+                       MY_NAME = xstrdup(optarg);
+                       break;
                case '?':       /* heeeeeelllllllpppp? heh */
                case 'h':
                        usage();
                case '?':       /* heeeeeelllllllpppp? heh */
                case 'h':
                        usage();
index 84199e83f91fffbb65be51b4ec4316944a387c3c..9f861b29023be57044843e7b52b48cfc04badb75 100644 (file)
@@ -8,7 +8,7 @@
 .SH NAME
 rpc.statd \- NSM status monitor
 .SH SYNOPSIS
 .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
 .SH DESCRIPTION
 The
 .B rpc.statd
@@ -52,6 +52,17 @@ be used in conjunction with the
 .B -F
 parameter.
 .TP
 .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
 .BI "\-o," "" " \-\-outgoing\-port "  port
 specify a port for
 .B rpc.statd
index 101c00b447968edf1b17fa21591d703fa0730f56..6becdc7521d39e334c0350d69507255b544b1925 100644 (file)
@@ -56,7 +56,7 @@ change_state (void)
   if (close (fd) == -1)
     log (L_ERROR, "close (%s): %s", SM_STAT_PATH, strerror (errno));
 
   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;
 
     char fullhost[SM_MAXSTRLEN + 1];
     struct hostent *hostinfo;