-/* Copyright (C) 1991-1999, 2000, 2001 Free Software Foundation, Inc.
+/* Copyright (C) 1991-1999, 2000, 2001, 2003 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
#define IPPROTO_PIM IPPROTO_PIM
IPPROTO_COMP = 108, /* Compression Header Protocol. */
#define IPPROTO_COMP IPPROTO_COMP
+ IPPROTO_SCTP = 132, /* Stream Control Transmission Protocol. */
+#define IPPROTO_SCTP IPPROTO_SCTP
IPPROTO_RAW = 255, /* Raw IP packets. */
#define IPPROTO_RAW IPPROTO_RAW
IPPROTO_MAX
/* Tests for POSIX timer implementation.
- Copyright (C) 2000, 2002 Free Software Foundation, Inc.
+ Copyright (C) 2000, 2002, 2003 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Kaz Kylheku <kaz@ashi.footprints.net>.
static void
-notify_func (union sigval sigval)
+notify_func1 (union sigval sigval)
{
- puts ("notify_func");
+ puts ("notify_func1");
+}
+
+
+static void
+notify_func2 (union sigval sigval)
+{
+ puts ("notify_func2");
}
retval = clock_gettime (CLOCK_REALTIME, &ts);
sigev2.sigev_notify = SIGEV_THREAD;
- sigev2.sigev_notify_function = notify_func;
+ sigev2.sigev_notify_function = notify_func1;
sigev2.sigev_notify_attributes = NULL;
setvbuf (stdout, 0, _IOLBF, 0);
printf ("clock_getres returned %d, timespec = { %ld, %ld }\n",
retval, ts.tv_sec, ts.tv_nsec);
- timer_create (CLOCK_REALTIME, &sigev1, &timer_sig);
- timer_create (CLOCK_REALTIME, &sigev2, &timer_thr1);
- timer_create (CLOCK_REALTIME, &sigev2, &timer_thr2);
-
- timer_settime (timer_thr1, 0, &itimer2, &old);
- timer_settime (timer_thr2, 0, &itimer3, &old);
+ if (timer_create (CLOCK_REALTIME, &sigev1, &timer_sig) != 0)
+ {
+ printf ("timer_create for timer_sig failed: %m\n");
+ exit (1);
+ }
+ if (timer_create (CLOCK_REALTIME, &sigev2, &timer_thr1) != 0)
+ {
+ printf ("timer_create for timer_thr1 failed: %m\n");
+ exit (1);
+ }
+ sigev2.sigev_notify_function = notify_func2;
+ if (timer_create (CLOCK_REALTIME, &sigev2, &timer_thr2) != 0)
+ {
+ printf ("timer_create for timer_thr2 failed: %m\n");
+ exit (1);
+ }
+
+ if (timer_settime (timer_thr1, 0, &itimer2, &old) != 0)
+ {
+ printf ("timer_settime for timer_thr1 failed: %m\n");
+ exit (1);
+ }
+ if (timer_settime (timer_thr2, 0, &itimer3, &old) != 0)
+ {
+ printf ("timer_settime for timer_thr2 failed: %m\n");
+ exit (1);
+ }
signal (ZSIGALRM, signal_func);
- timer_settime (timer_sig, 0, &itimer1, &old);
-
- timer_delete (-1);
+ if (timer_settime (timer_sig, 0, &itimer1, &old) != 0)
+ {
+ printf ("timer_settime for timer_sig failed: %m\n");
+ exit (1);
+ }
intr_sleep (3);
- timer_delete (timer_sig);
- timer_delete (timer_thr1);
+ if (timer_delete (timer_sig) != 0)
+ {
+ printf ("timer_delete for timer_sig failed: %m\n");
+ exit (1);
+ }
+ if (timer_delete (timer_thr1) != 0)
+ {
+ printf ("timer_delete for timer_thr1 failed: %m\n");
+ exit (1);
+ }
intr_sleep (3);
- timer_delete (timer_thr2);
+ if (timer_delete (timer_thr2) != 0)
+ {
+ printf ("timer_delete for timer_thr2 failed: %m\n");
+ exit (1);
+ }
return 0;
}