From a09eeb36c2c45151b9bb89f5015da0c584799716 Mon Sep 17 00:00:00 2001 From: Greg Banks Date: Tue, 27 Jun 2006 20:28:02 +1000 Subject: [PATCH] Replace the deprecated sigblock() with more modern signal functions to avoid compile warnings. --- configure.in | 2 +- utils/nhfsstone/nhfsstone.c | 22 ++++++++++++++++++++++ 2 files changed, 23 insertions(+), 1 deletion(-) 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 */ +#include "config.h" #include #include #include @@ -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 -- 2.39.5