+/*
+ * Copyright (C) 2016 Julien Desfossez <jdesfossez@efficios.com>
+ *
+ * SPDX-License-Identifier: GPL-2.0-only
+ *
+ */
+
#include <stdio.h>
#include <poll.h>
#include <signal.h>
int value;
};
+static
void test_select_big(void)
{
fd_set rfds, wfds, exfds;
return;
}
+static
void test_pselect(void)
{
fd_set rfds;
}
+static
void test_select(void)
{
fd_set rfds;
}
+static
void test_poll(void)
{
struct pollfd ufds[NB_FD];
}
}
+static
void test_ppoll(void)
{
struct pollfd ufds[NB_FD];
}
}
+static
void test_ppoll_big(void)
{
struct pollfd ufds[MAX_FDS];
return;
}
+static
void test_epoll(void)
{
int ret, epollfd;
return;
}
+static
void test_pepoll(void)
{
int ret, epollfd;
return;
}
+static
void run_working_cases(void)
{
int ret;
* segfault (eventually with a "*** stack smashing detected ***" message).
* The event should contain an array of 100 FDs filled with garbage.
*/
+static
void ppoll_fds_buffer_overflow(void)
{
struct pollfd ufds[NB_FD];
* cleanly fail with a "Invalid argument".
* The event should contain an empty array of FDs and overflow = 1.
*/
+static
void ppoll_fds_ulong_max(void)
{
struct pollfd ufds[NB_FD];
* Pass an invalid file descriptor to pselect6(). The syscall should return
* -EBADF. The recorded event should contain a "ret = -EBADF (-9)".
*/
+static
void pselect_invalid_fd(void)
{
fd_set rfds;
* Invalid pointer as writefds, should output a ppoll event
* with 0 FDs.
*/
+static
void pselect_invalid_pointer(void)
{
fd_set rfds;
* Pass an invalid pointer to epoll_pwait, should fail with
* "Bad address", the event returns 0 FDs.
*/
+static
void epoll_pwait_invalid_pointer(void)
{
int ret, epollfd;
* Set maxevents to INT_MAX, should output "Invalid argument"
* The event should return an empty array.
*/
+static
void epoll_pwait_int_max(void)
{
int ret, epollfd;
return;
}
+static
void *ppoll_writer(void *arg)
{
struct ppoll_thread_data *data = (struct ppoll_thread_data *) arg;
return NULL;
}
+static
void do_ppoll(int *fds, struct pollfd *ufds)
{
int i, ret;
}
}
+static
void stress_ppoll(int *fds, int value)
{
pthread_t writer;
*
* ppoll should work as expected and the trace should be readable at the end.
*/
+static
void ppoll_concurrent_write(void)
{
int i, ret, fds[MAX_FDS];
return;
}
+static
void *epoll_pwait_writer(void *addr)
{
srand(time(NULL));
* buffer allocated for the returned data. This should randomly segfault.
* The trace should be readable and no kernel OOPS should occur.
*/
+static
void epoll_pwait_concurrent_munmap(void)
{
int ret, epollfd, i, fds[MAX_FDS];
return;
}
-void usage(poptContext optCon, int exitcode, char *error, char *addl)
-{
- poptPrintUsage(optCon, stderr, 0);
- if (error) {
- fprintf(stderr, "%s: %s\n", error, addl);
- }
- exit(exitcode);
-}
-
+static
void print_list(void)
{
fprintf(stderr, "Test list (-t X):\n");