On Fri, Apr 08, 2016 at 03:59:16PM +0800, Fei Jie wrote:
> * tests/epoll_wait.c: New file.
> * tests/epoll_wait.test: New test.
> * tests/.gitignore: Add epoll_wait.
> * tests/Makefile.am (check_PROGRAMS): Likewise.
> (DECODER_TESTS): Add epoll_wait.test.
> ---
>  tests/.gitignore      |  1 +
>  tests/Makefile.am     |  2 ++
>  tests/epoll_wait.c    | 27 +++++++++++++++++++++++++++
>  tests/epoll_wait.test |  6 ++++++
>  4 files changed, 36 insertions(+)
>  create mode 100644 tests/epoll_wait.c
>  create mode 100755 tests/epoll_wait.test
> 
> diff --git a/tests/.gitignore b/tests/.gitignore
> index 849d6ef..9ef0c03 100644
> --- a/tests/.gitignore
> +++ b/tests/.gitignore
> @@ -28,6 +28,7 @@ dup3
>  epoll_create
>  epoll_create1
>  epoll_ctl
> +epoll_wait
>  eventfd
>  execve
>  execve-v
> diff --git a/tests/Makefile.am b/tests/Makefile.am
> index 2a761d8..7cd3991 100644
> --- a/tests/Makefile.am
> +++ b/tests/Makefile.am
> @@ -79,6 +79,7 @@ check_PROGRAMS = \
>       epoll_create \
>       epoll_create1 \
>       epoll_ctl \
> +     epoll_wait \
>       eventfd \
>       execve \
>       execve-v \
> @@ -280,6 +281,7 @@ DECODER_TESTS = \
>       epoll_create.test \
>       epoll_create1.test \
>       epoll_ctl.test \
> +     epoll_wait.test \
>       eventfd.test \
>       execve.test \
>       execve-v.test \
> diff --git a/tests/epoll_wait.c b/tests/epoll_wait.c
> new file mode 100644
> index 0000000..2edcb7c
> --- /dev/null
> +++ b/tests/epoll_wait.c
> @@ -0,0 +1,27 @@
> +#include "tests.h"
> +#include <sys/syscall.h>
> +
> +#ifdef __NR_epoll_wait
> +
> +# include <errno.h>
> +# include <stdio.h>
> +# include <sys/epoll.h>

Inclusion of <sys/epoll.h> has to be guarded with HAVE_SYS_EPOLL_H.

> +# include <unistd.h>
> +
> +int
> +main(void)
> +{
> +     struct epoll_event *const ev = tail_alloc(sizeof(struct epoll_event));

sizeof(struct epoll_event) can be replaced with sizeof(*ev).

> +     int rc = syscall(__NR_epoll_wait, -1, ev, 1, 0);
> +     printf("epoll_wait(-1, %p, 1, 0) = %d %s (%m)\n",
> +            ev, rc, errno == ENOSYS ? "ENOSYS" : "EBADF");
> +
> +     puts("+++ exited with 0 +++");
> +     return 0;
> +}
> +
> +#else
> +
> +SKIP_MAIN_UNDEFINED("__NR_epoll_wait")
> +
> +#endif

Applied with these editions.


-- 
ldv

Attachment: pgp9JKEbRhNDQ.pgp
Description: PGP signature

------------------------------------------------------------------------------
Find and fix application performance issues faster with Applications Manager
Applications Manager provides deep performance insights into multiple tiers of
your business applications. It resolves application problems quickly and
reduces your MTTR. Get your free trial! http://pubads.g.doubleclick.net/
gampad/clk?id=1444514301&iu=/ca-pub-7940484522588532
_______________________________________________
Strace-devel mailing list
Strace-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/strace-devel

Reply via email to