/*
- * 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 <stdio.h>
-#include <stdint.h>
-#include <time.h>
#include <fcntl.h>
-#include <unistd.h>
#include <sys/syscall.h>
#if defined __NR_timerfd_create \
&& defined __NR_timerfd_settime \
&& defined O_CLOEXEC
+# include <stdio.h>
+# include <stdint.h>
+# include <time.h>
+# include <unistd.h>
+
int
main(void)
{
(void) close(0);
if (syscall(__NR_timerfd_create, CLOCK_MONOTONIC, O_CLOEXEC | O_NONBLOCK))
- return 77;
+ perror_msg_and_skip("timerfd_create");
puts("timerfd_create(CLOCK_MONOTONIC, TFD_CLOEXEC|TFD_NONBLOCK) = 0");
struct {
};
if (syscall(__NR_timerfd_settime, 0, 0, &new.its, &old.its))
- return 77;
+ perror_msg_and_skip("timerfd_settime");
printf("timerfd_settime(0, 0"
", {it_interval={%jd, %jd}, it_value={%jd, %jd}}"
", {it_interval={%jd, %jd}, it_value={%jd, %jd}}"
(intmax_t) old.its.it_value.tv_nsec);
if (syscall(__NR_timerfd_gettime, 0, &old.its))
- return 77;
+ perror_msg_and_skip("timerfd_gettime");
printf("timerfd_gettime(0"
", {it_interval={%jd, %jd}, it_value={%jd, %jd}}"
") = 0\n",
#else
-int
-main(void)
-{
- return 77;
-}
+SKIP_MAIN_UNDEFINED("__NR_timerfd_create && __NR_timerfd_gettime"
+ " && __NR_timerfd_settime && O_CLOEXEC")
#endif