On Fri, Apr 08, 2016 at 03:59:15PM +0800, Fei Jie wrote:
> * tests/epoll_ctl.c: New file.
> * tests/epoll_ctl.test: New test.
> * tests/.gitignore: Add epoll_ctl.
> * tests/Makefile.am (check_PROGRAMS): Likewise.
> (DECODER_TESTS): Add epoll_ctl.test.
> ---
>  tests/.gitignore     |  1 +
>  tests/Makefile.am    |  2 ++
>  tests/epoll_ctl.c    | 31 +++++++++++++++++++++++++++++++
>  tests/epoll_ctl.test |  6 ++++++
>  4 files changed, 40 insertions(+)
>  create mode 100644 tests/epoll_ctl.c
>  create mode 100755 tests/epoll_ctl.test
> 
> diff --git a/tests/.gitignore b/tests/.gitignore
> index 0478e18..849d6ef 100644
> --- a/tests/.gitignore
> +++ b/tests/.gitignore
> @@ -27,6 +27,7 @@ dup2
>  dup3
>  epoll_create
>  epoll_create1
> +epoll_ctl
>  eventfd
>  execve
>  execve-v
> diff --git a/tests/Makefile.am b/tests/Makefile.am
> index 8dc6673..2a761d8 100644
> --- a/tests/Makefile.am
> +++ b/tests/Makefile.am
> @@ -78,6 +78,7 @@ check_PROGRAMS = \
>       dup3 \
>       epoll_create \
>       epoll_create1 \
> +     epoll_ctl \
>       eventfd \
>       execve \
>       execve-v \
> @@ -278,6 +279,7 @@ DECODER_TESTS = \
>       dup3.test \
>       epoll_create.test \
>       epoll_create1.test \
> +     epoll_ctl.test \
>       eventfd.test \
>       execve.test \
>       execve-v.test \
> diff --git a/tests/epoll_ctl.c b/tests/epoll_ctl.c
> new file mode 100644
> index 0000000..b24bae8
> --- /dev/null
> +++ b/tests/epoll_ctl.c
> @@ -0,0 +1,31 @@
> +#include "tests.h"
> +#include <sys/syscall.h>
> +
> +#ifdef __NR_epoll_ctl
> +
> +# 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>
> +# include <inttypes.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).

> +     ev->events = EPOLLIN;
> +     int rc = syscall(__NR_epoll_ctl, -1, EPOLL_CTL_ADD, -1, ev);
> +     printf("epoll_ctl(-1, EPOLL_CTL_ADD, -1, {EPOLLIN,"
> +            " {u32=%u, u64=%" PRIu64 "}}) = %d %s (%m)\n",
> +            ev->data.u32, ev->data.u64, rc,
> +            errno == ENOSYS ? "ENOSYS" : "EBADF");
> +
> +     puts("+++ exited with 0 +++");
> +     return 0;
> +}
> +
> +#else
> +
> +SKIP_MAIN_UNDEFINED("__NR_epoll_create")
> +
> +#endif

Applied with these editions.


-- 
ldv

Attachment: pgpmnB77mOH95.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