]> granicus.if.org Git - strace/blobdiff - tests/eventfd.c
tests: extend TEST_NETLINK_OBJECT macro
[strace] / tests / eventfd.c
index ce83f47646641e95a106afe5a5f6b3aa683f2724..d6ad6492e432c04d7b39b655df5ace4328955668 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015 Dmitry V. Levin <ldv@altlinux.org>
+ * Copyright (c) 2015-2016 Dmitry V. Levin <ldv@altlinux.org>
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
 #include "tests.h"
 #include <fcntl.h>
 #include <unistd.h>
-#include <sys/syscall.h>
+#include <asm/unistd.h>
+
+#if defined __NR_eventfd2 && defined O_CLOEXEC
 
 int
 main(void)
 {
-#if defined __NR_eventfd2 && defined O_CLOEXEC
        (void) close(0);
-       return syscall(__NR_eventfd2, -1L, 1 | O_CLOEXEC | O_NONBLOCK) == 0 ?
-               0 : 77;
+       if (syscall(__NR_eventfd2, -1L, 1 | O_CLOEXEC | O_NONBLOCK))
+               perror_msg_and_skip("eventfd2");
+       return 0;
+}
+
 #else
-        return 77;
+
+SKIP_MAIN_UNDEFINED("__NR_eventfd2 && O_CLOEXEC")
+
 #endif
-}