2 * Test program for some Linux syscalls introduced during 2006 and 2007:
3 * - epoll_pwait() was introduced in the 2.6.19 kernel, released in November
5 * - utimensat(), eventfd(), timerfd() and signalfd() were introduced in the
6 * 2.6.22 kernel, released in July 2007.
8 * See also http://bugs.kde.org/show_bug.cgi?id=160907.
13 #include "../../config.h"
17 #if defined(HAVE_SYS_EPOLL_H)
18 #include <sys/epoll.h>
20 #if defined(HAVE_SYS_EVENTFD_H)
21 #include <sys/eventfd.h>
24 #if defined(HAVE_SYS_SIGNALFD_H)
25 #include <sys/signalfd.h>
32 #if defined(HAVE_SIGNALFD) && defined(HAVE_EVENTFD) \
33 && defined(HAVE_EVENTFD_READ) && defined(HAVE_PPOLL)
38 struct timespec ts
= { .tv_sec
= 1, .tv_nsec
= 0 };
42 sigaddset (&mask
, SIGUSR1
);
43 fd
= signalfd (-1, &mask
, 0);
44 sigaddset (&mask
, SIGUSR2
);
45 fd
= signalfd (fd
, &mask
, 0);
47 eventfd_read (fd2
, &ev
);
49 pfd
[0].events
= POLLIN
|POLLOUT
;
51 pfd
[1].events
= POLLIN
|POLLOUT
;
52 ppoll (pfd
, 2, &ts
, &mask
);
56 #if defined(HAVE_UTIMENSAT)
57 unlink("/tmp/valgrind-utimensat-test");
58 close (creat ("/tmp/valgrind-utimensat-test", S_IRUSR
| S_IWUSR
));
60 struct timespec ts2
[2] = { [0].tv_sec
= 10000000, [1].tv_sec
= 20000000 };
61 utimensat (AT_FDCWD
, "/tmp/valgrind-utimensat-test", ts2
, 0);
63 unlink("/tmp/valgrind-utimensat-test");
66 #if defined(HAVE_EPOLL_CREATE) && defined(HAVE_EPOLL_PWAIT)
69 struct epoll_event evs
[10];
73 sigaddset (&mask
, SIGUSR1
);
74 sigaddset (&mask
, SIGUSR2
);
75 fd3
= epoll_create (10);
76 epoll_pwait (fd3
, evs
, 10, 0, &mask
);
80 #if defined(HAVE_EPOLL_CREATE) && defined(HAVE_EPOLL_PWAIT)
83 struct epoll_event evs
[10];
85 fd3
= epoll_create (10);
86 /* epoll_pwait can take a NULL sigmask. */
87 epoll_pwait (fd3
, evs
, 10, 1, NULL
);