[LTP] [PATCH v3] epoll_pwait/epoll_pwait01.c: add new testcase

Cyril Hrubis chrubis@suse.cz
Thu Mar 3 16:13:15 CET 2016


Hi!
Pushed with two changes, thanks.

> +#ifndef EPOLL_PWAIT_H
> +#define EPOLL_PWAIT_H
> +
> +#include <sys/types.h>
> +#include "config.h"
> +#include "linux_syscall_numbers.h"
> +
> +#if !defined(HAVE_EPOLL_PWAIT)
> +int epoll_pwait(int epfd, struct epoll_event *events, int maxevents,
> +	int timeout, const sigset_t *sigmask)
> +{
> +	return ltp_syscall(__NR_epoll_pwait, epfd, events, maxevents,
> +		timeout, sigmask);

The syscall takes one more parameter than the glibc wrapper. I had to
add the size of the sigmask i.e. _NSIG/8 here otherwise we will get
EINVAL from kernel.

> +}
> +#endif

...

> +static void verify_nonsigmask(void)
> +{
> +	if (TEST_RETURN != -1) {
> +		tst_resm(TFAIL, "epoll_wait() succeeded unexpectedly");
> +	} else {
> +		if (TEST_ERRNO == EINTR) {
> +			tst_resm(TPASS | TTERRNO,
> +				 "epoll_wait() failed as expected");
> +		} else {
> +			tst_resm(TFAIL | TTERRNO,
> +				 "epoll_wait() failed unexpectedly, "
> +				 "expected errno is EINTR");
> +		}
> +	}
> +}

And changed these two verify function to use return after tst_resm() so
that we don't have to do the else-if spagetti code.

-- 
Cyril Hrubis
chrubis@suse.cz


More information about the ltp mailing list