summaryrefslogtreecommitdiff
path: root/fstests/timertest.c
diff options
context:
space:
mode:
Diffstat (limited to 'fstests/timertest.c')
-rw-r--r--fstests/timertest.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/fstests/timertest.c b/fstests/timertest.c
index db19f4d6..9f3ae74f 100644
--- a/fstests/timertest.c
+++ b/fstests/timertest.c
@@ -15,18 +15,21 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
+#include <signal.h>
+#include <sys/time.h>
+#include <stdio.h>
-int
-alarm_handler ()
+void
+alarm_handler (int signo)
{
printf ("Received alarm\n");
fflush (stdout);
}
+int
main()
{
struct itimerval real_timer;
- error_t err;
real_timer.it_interval.tv_usec = 0;
real_timer.it_interval.tv_sec = 1;
@@ -35,8 +38,12 @@ main()
signal (SIGALRM, alarm_handler);
- err = setitimer (ITIMER_REAL, &real_timer, 0);
-
+ if (setitimer (ITIMER_REAL, &real_timer, 0) < 0)
+ {
+ perror ("Setting timer");
+ exit (1);
+ }
+
while (1)
{
printf ("Pausing\n");