6 #include <internaltypes.h>
18 if (sem_init (&u
.s
, 0, 0) != 0)
20 puts ("sem_init failed");
24 struct timespec ts
= { 0, 1000000001 }; /* Invalid. */
26 if (sem_timedwait (&u
.s
, &ts
) >= 0)
28 puts ("sem_timedwait did not fail");
33 perror ("sem_timedwait did not fail with EINVAL");
36 if (u
.ns
.nwaiters
!= 0)
38 printf ("sem_timedwait modified nwaiters: %ld\n", u
.ns
.nwaiters
);
42 ts
.tv_sec
= /* Invalid. */ -2;
45 if (sem_timedwait (&u
.s
, &ts
) >= 0)
47 puts ("2nd sem_timedwait did not fail");
50 if (errno
!= ETIMEDOUT
)
52 perror ("2nd sem_timedwait did not fail with ETIMEDOUT");
55 if (u
.ns
.nwaiters
!= 0)
57 printf ("2nd sem_timedwait modified nwaiters: %ld\n", u
.ns
.nwaiters
);
64 #define TEST_FUNCTION do_test ()
65 #include "../test-skeleton.c"