summaryrefslogtreecommitdiff
path: root/clients/zstat/zstat.c
diff options
context:
space:
mode:
authorGravatar Richard Basch <probe@mit.edu>1993-10-16 17:51:26 +0000
committerGravatar Richard Basch <probe@mit.edu>1993-10-16 17:51:26 +0000
commit5ba5e3379dc21d1d53622902114fc9d5e3accdec (patch)
treec62e9dc1f9449a508a62d7c1777e527ed1a0d9d8 /clients/zstat/zstat.c
parentecde205da8aba4ef19fd1eed4be6a3d5ab0b6d6e (diff)
POSIX signal handling
Diffstat (limited to 'clients/zstat/zstat.c')
-rw-r--r--clients/zstat/zstat.c23
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(&notice, (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(&notice, (struct sockaddr_in *) 0))