From 8cad05c5ef88b56a3821a8b50c204661968bf7ea Mon Sep 17 00:00:00 2001 From: "Dmitry V. Levin" Date: Tue, 5 Jan 2016 23:12:51 +0000 Subject: [PATCH] tests/eventfd.c: use libtests * tests/eventfd.c: Use SKIP_MAIN_UNDEFINED. (main): Use perror_msg_and_skip. --- tests/eventfd.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/tests/eventfd.c b/tests/eventfd.c index ce83f476..8b08443c 100644 --- a/tests/eventfd.c +++ b/tests/eventfd.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015 Dmitry V. Levin + * Copyright (c) 2015-2016 Dmitry V. Levin * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -30,14 +30,19 @@ #include #include +#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 -} -- 2.50.1