]> granicus.if.org Git - strace/blobdiff - tests/epoll_create1.c
tests: extend TEST_NETLINK_OBJECT macro
[strace] / tests / epoll_create1.c
index 270ab52cc276a732d232e7095920007c8c9e7073..cd905ecb15196bf147bb34f4c191127c8f056d77 100644 (file)
 
 #include "tests.h"
 #include <fcntl.h>
-#include <sys/syscall.h>
+#include <asm/unistd.h>
 
 #if defined __NR_epoll_create1 && defined O_CLOEXEC
 
-# include <assert.h>
-# include <errno.h>
 # include <stdio.h>
 # include <unistd.h>
 
 int
 main(void)
 {
-       int rc = syscall(__NR_epoll_create1, O_CLOEXEC);
-       if (rc == -1) {
-               if (ENOSYS != errno)
-                       perror_msg_and_fail("epoll_create1 O_CLOEXEC");
-               printf("epoll_create1(EPOLL_CLOEXEC) = -1 ENOSYS (%m)\n");
-       } else {
-               printf("epoll_create1(EPOLL_CLOEXEC) = %d\n", rc);
-       }
-
-       assert(syscall(__NR_epoll_create1, O_CLOEXEC | O_NONBLOCK) == -1);
-       printf("epoll_create1(EPOLL_CLOEXEC|%#x) = -1 %s (%m)\n",
-              O_NONBLOCK, ENOSYS == errno ? "ENOSYS" : "EINVAL");
+       long rc = syscall(__NR_epoll_create1, O_CLOEXEC);
+       printf("epoll_create1(EPOLL_CLOEXEC) = %s\n", sprintrc(rc));
+
+       rc = syscall(__NR_epoll_create1, O_CLOEXEC | O_NONBLOCK);
+       printf("epoll_create1(EPOLL_CLOEXEC|%#x) = %s\n",
+              O_NONBLOCK, sprintrc(rc));
 
        puts("+++ exited with 0 +++");
        return 0;