]> git.ipfire.org Git - thirdparty/glibc.git/blob - nptl/tst-sem13.c
Once again forgot to add new test file.
[thirdparty/glibc.git] / nptl / tst-sem13.c
1 #include <errno.h>
2 #include <semaphore.h>
3 #include <stdio.h>
4 #include <unistd.h>
5 #include <pthread.h>
6 #include <internaltypes.h>
7
8
9 static int
10 do_test (void)
11 {
12 union
13 {
14 sem_t s;
15 struct new_sem ns;
16 } u;
17
18 if (sem_init (&u.s, 0, 0) != 0)
19 {
20 puts ("sem_init failed");
21 return 1;
22 }
23
24 struct timespec ts = { 0, 1000000001 }; /* Invalid. */
25 errno = 0;
26 if (sem_timedwait (&u.s, &ts) >= 0)
27 {
28 puts ("sem_timedwait did not fail");
29 return 1;
30 }
31 if (errno != EINVAL)
32 {
33 puts ("sem_timedwait did not fail with EINVAL");
34 return 1;
35 }
36 if (u.ns.nwaiters != 0)
37 {
38 puts ("nwaiters modified");
39 return 1;
40 }
41
42 return 0;
43 }
44
45 #define TEST_FUNCTION do_test ()
46 #include "../test-skeleton.c"