summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGreg Banks <gnb@melbourne.sgi.com>2006-06-27 20:28:02 +1000
committerGreg Banks <gnb@melbourne.sgi.com>2006-06-27 20:28:02 +1000
commita09eeb36c2c45151b9bb89f5015da0c584799716 (patch)
treec29b395fb296b96c53529500b06d02b60c6ce39c
parent93608a52655abf5ac23404c4b5cc05fe575a9c04 (diff)
downloadnfs-utils-a09eeb36c2c45151b9bb89f5015da0c584799716.tar.gz
nfs-utils-a09eeb36c2c45151b9bb89f5015da0c584799716.tar.xz
nfs-utils-a09eeb36c2c45151b9bb89f5015da0c584799716.zip
Replace the deprecated sigblock() with more modern
signal functions to avoid compile warnings.
-rw-r--r--configure.in2
-rw-r--r--utils/nhfsstone/nhfsstone.c22
2 files changed, 23 insertions, 1 deletions
diff --git a/configure.in b/configure.in
index 1a1a25d..3f8fbb5 100644
--- a/configure.in
+++ b/configure.in
@@ -242,7 +242,7 @@ AC_CHECK_FUNCS([alarm atexit dup2 fdatasync ftruncate getcwd \
gethostbyaddr gethostbyname gethostname getmntent \
gettimeofday hasmntopt inet_ntoa innetgr memset mkdir pathconf \
realpath rmdir select socket strcasecmp strchr strdup \
- strerror strrchr strtol strtoul])
+ strerror strrchr strtol strtoul sigprocmask])
dnl *************************************************************
diff --git a/utils/nhfsstone/nhfsstone.c b/utils/nhfsstone/nhfsstone.c
index 034ba79..ceff966 100644
--- a/utils/nhfsstone/nhfsstone.c
+++ b/utils/nhfsstone/nhfsstone.c
@@ -10,6 +10,7 @@ static char sccsid[] = "@(#)nhfsstone.c 1.22 90/05/08 Copyright (c) 1990, Legato
* Ported to Linux by Olaf Kirch <okir@monad.swb.de>
*/
+#include "config.h"
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
@@ -312,7 +313,11 @@ main(int argc, char **argv)
int pid; /* process id */
int delay; /* msecs since last checked current time */
int randnum; /* a random number */
+#if HAVE_SIGPROCMASK
+ sigset_t oldmask; /* saved signal mask */
+#else
int oldmask; /* saved signal mask */
+#endif
int sampletime; /* secs between reading kernel stats */
char *opts; /* option parsing */
int pct;
@@ -478,7 +483,20 @@ main(int argc, char **argv)
(void) signal(SIGINT, cleanup);
(void) signal(SIGUSR1, startup);
+#if HAVE_SIGPROCMASK
+ {
+ sigset_t mask;
+ sigemptyset(&mask);
+ sigaddset(&mask, SIGUSR1);
+ sigprocmask(SIG_BLOCK, &mask, &oldmask);
+ }
+#else
+ /*
+ * sigblock() is marked deprecated in modern
+ * glibc and hence generates a warning.
+ */
oldmask = sigblock(sigmask(SIGUSR1));
+#endif
if (ncalls == 0) {
if (runtime == 0) {
@@ -630,7 +648,11 @@ main(int argc, char **argv)
exit(1);
}
+#if HAVE_SIGPROCMASK
+ sigsuspend(&oldmask);
+#else
sigpause(oldmask);
+#endif
/*
* Initialize counters