};
} /* namespace */
-static void test_select_big(void)
+static void test_select_big()
{
fd_set rfds, wfds, exfds;
struct timeval tv;
if (timeout > 0) {
ret = select(fd2 + 1, &rfds, &wfds, &exfds, &tv);
} else {
- ret = select(fd2 + 1, &rfds, &wfds, &exfds, NULL);
+ ret = select(fd2 + 1, &rfds, &wfds, &exfds, nullptr);
}
if (ret == -1) {
return;
}
-static void test_pselect(void)
+static void test_pselect()
{
fd_set rfds;
struct timespec tv;
tv.tv_nsec = timeout * MSEC_PER_NSEC;
if (timeout > 0) {
- ret = pselect(1, &rfds, NULL, NULL, &tv, NULL);
+ ret = pselect(1, &rfds, nullptr, nullptr, &tv, nullptr);
} else {
- ret = pselect(1, &rfds, NULL, NULL, NULL, NULL);
+ ret = pselect(1, &rfds, nullptr, nullptr, nullptr, nullptr);
}
if (ret == -1) {
}
}
-static void test_select(void)
+static void test_select()
{
fd_set rfds;
struct timeval tv;
tv.tv_usec = timeout * MSEC_PER_USEC;
if (timeout > 0) {
- ret = select(1, &rfds, NULL, NULL, &tv);
+ ret = select(1, &rfds, nullptr, nullptr, &tv);
} else {
- ret = select(1, &rfds, NULL, NULL, NULL);
+ ret = select(1, &rfds, nullptr, nullptr, nullptr);
}
if (ret == -1) {
}
}
-static void test_poll(void)
+static void test_poll()
{
struct pollfd ufds[NB_FD];
char buf[BUF_SIZE];
}
}
-static void test_ppoll(void)
+static void test_ppoll()
{
struct pollfd ufds[NB_FD];
char buf[BUF_SIZE];
if (timeout > 0) {
ts.tv_sec = 0;
ts.tv_nsec = timeout * MSEC_PER_NSEC;
- ret = ppoll(ufds, 1, &ts, NULL);
+ ret = ppoll(ufds, 1, &ts, nullptr);
} else {
- ret = ppoll(ufds, 1, NULL, NULL);
+ ret = ppoll(ufds, 1, nullptr, nullptr);
}
if (ret < 0) {
ufds[i].events = POLLIN | POLLPRI;
}
- ret = ppoll(ufds, MAX_FDS, NULL, NULL);
+ ret = ppoll(ufds, MAX_FDS, nullptr, nullptr);
if (ret < 0) {
PERROR("ppoll");
}
if (timeout > 0) {
- ret = epoll_pwait(epollfd, &epoll_event, 1, timeout, NULL);
+ ret = epoll_pwait(epollfd, &epoll_event, 1, timeout, nullptr);
} else {
- ret = epoll_pwait(epollfd, &epoll_event, 1, -1, NULL);
+ ret = epoll_pwait(epollfd, &epoll_event, 1, -1, nullptr);
}
if (ret == 1) {
usleep(100);
}
- return NULL;
+ return nullptr;
}
static void do_ppoll(int *fds, struct pollfd *ufds)
ufds[i].events = POLLIN | POLLPRI;
}
- ret = ppoll(ufds, MAX_FDS, &ts, NULL);
+ ret = ppoll(ufds, MAX_FDS, &ts, nullptr);
if (ret < 0) {
PERROR("ppoll");
thread_data.value = value;
stop_thread = 0;
- ret = pthread_create(&writer, NULL, &ppoll_writer, (void *) &thread_data);
+ ret = pthread_create(&writer, nullptr, &ppoll_writer, (void *) &thread_data);
if (ret != 0) {
fprintf(stderr, "[error] pthread_create\n");
goto end;
do_ppoll(fds, ufds);
}
stop_thread = 1;
- ret = pthread_join(writer, NULL);
+ ret = pthread_join(writer, nullptr);
if (ret) {
fprintf(stderr, "[error] pthread_join\n");
goto end;
static void *epoll_pwait_writer(void *addr)
{
- srand(time(NULL));
+ srand(time(nullptr));
while (!stop_thread) {
usleep(rand() % 30);
munmap(addr, MAX_FDS * sizeof(struct epoll_event));
}
- return NULL;
+ return nullptr;
}
/*
goto error;
}
- epoll_event = (struct epoll_event *) mmap(NULL,
+ epoll_event = (struct epoll_event *) mmap(nullptr,
MAX_FDS * sizeof(struct epoll_event),
PROT_READ | PROT_WRITE,
MAP_PRIVATE | MAP_ANONYMOUS,
}
}
stop_thread = 0;
- ret = pthread_create(&writer, NULL, &epoll_pwait_writer, (void *) epoll_event);
+ ret = pthread_create(&writer, nullptr, &epoll_pwait_writer, (void *) epoll_event);
if (ret != 0) {
fprintf(stderr, "[error] pthread_create\n");
goto error_unmap;
}
- ret = epoll_pwait(epollfd, epoll_event, 1, 1, NULL);
+ ret = epoll_pwait(epollfd, epoll_event, 1, 1, nullptr);
if (ret == 1) {
ret = read(wait_fd, buf, BUF_SIZE);
}
stop_thread = 1;
- ret = pthread_join(writer, NULL);
+ ret = pthread_join(writer, nullptr);
if (ret) {
fprintf(stderr, "[error] pthread_join\n");
goto error_unmap;
return;
}
-static void print_list(void)
+static void print_list()
{
fprintf(stderr, "Test list (-t X):\n");
fprintf(stderr,
int c, ret, test = -1;
poptContext optCon;
struct rlimit open_lim;
- FILE *test_validation_output_file = NULL;
- const char *test_validation_output_file_path = NULL;
+ FILE *test_validation_output_file = nullptr;
+ const char *test_validation_output_file_path = nullptr;
struct poptOption optionsTable[] = {
- { "test", 't', POPT_ARG_INT, &test, 0, "Test to run", NULL },
- { "list", 'l', 0, 0, 'l', "List of tests (-t X)", NULL },
+ { "test", 't', POPT_ARG_INT, &test, 0, "Test to run", nullptr },
+ { "list", 'l', 0, nullptr, 'l', "List of tests (-t X)", nullptr },
{ "validation-file",
'o',
POPT_ARG_STRING,
&test_validation_output_file_path,
0,
"Test case output",
- NULL },
- POPT_AUTOHELP{ NULL, 0, 0, NULL, 0, NULL, NULL }
+ nullptr },
+ POPT_AUTOHELP{ nullptr, 0, 0, nullptr, 0, nullptr, nullptr }
};
const struct test_case *test_case;
- optCon = poptGetContext(NULL, argc, argv, optionsTable, 0);
+ optCon = poptGetContext(nullptr, argc, argv, optionsTable, 0);
if (argc < 2) {
poptPrintUsage(optCon, stderr, 0);
* for the validation, disabling the buffering on the validation file
* works.
*/
- setbuf(test_validation_output_file, NULL);
+ setbuf(test_validation_output_file, nullptr);
wait_fd = STDIN_FILENO;
/* Test case id is 1-based. */