diff options
Diffstat (limited to 'clients/zstat/zstat.c')
-rw-r--r-- | clients/zstat/zstat.c | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/clients/zstat/zstat.c b/clients/zstat/zstat.c index ed013a1..a72ed4b 100644 --- a/clients/zstat/zstat.c +++ b/clients/zstat/zstat.c @@ -163,6 +163,9 @@ hm_stat(host,server) long runtime; struct tm *tim; ZNotice_t notice; +#ifdef POSIX + struct sigaction sa; +#endif _BZERO((char *)&sin,sizeof(struct sockaddr_in)); @@ -202,8 +205,14 @@ hm_stat(host,server) com_err("zstat", ret, "sending notice"); exit(-1); } - +#ifdef POSIX + sigemptyset(&sa.sa_mask); + sa.sa_flags = 0; + sa.sa_handler = timeout; + (void) sigaction(SIGALRM, &sa, (struct sigaction *)0); +#else (void) signal(SIGALRM,timeout); +#endif outoftime = 0; (void) alarm(10); if (((ret = ZReceiveNotice(¬ice, (struct sockaddr_in *) 0)) @@ -259,7 +268,10 @@ srv_stat(host) ZNotice_t notice; long runtime; struct tm *tim; - +#ifdef POSIX + struct sigaction sa; +#endif + _BZERO((char *) &sin,sizeof(struct sockaddr_in)); sin.sin_port = srv_port; @@ -299,7 +311,14 @@ srv_stat(host) exit(-1); } +#ifdef POSIX + sigemptyset(&sa.sa_mask); + sa.sa_flags = 0; + sa.sa_handler = timeout; + (void) sigaction(SIGALRM, &sa, (struct sigaction *)0); +#else (void) signal(SIGALRM,timeout); +#endif outoftime = 0; (void) alarm(10); if (((ret = ZReceiveNotice(¬ice, (struct sockaddr_in *) 0)) |