mirror of
https://github.com/torvalds/linux.git
synced 2026-09-24 06:24:02 +02:00
selftests: timers: Use clock_name() and constants from clock-helpers.h
Replace the many repetitions of custom clockid_t to string translation with the clock_name() helper from clock-helpers.h. Also drop the custom ?SEC_PER_?SEC definitions. Signed-off-by: Thomas Weißschuh (Schneider Electric) <thomas.weissschuh@linutronix.de> Signed-off-by: Thomas Gleixner <tglx@kernel.org> Acked-by: John Stultz <jstultz@google.com> Link: https://patch.msgid.link/20260803-auxclock-nanosleep-prep-v2-7-910cbd485390@linutronix.de
This commit is contained in:
parent
431012dd0a
commit
54200b8748
|
|
@ -22,10 +22,9 @@
|
|||
#include <sys/time.h>
|
||||
#include <sys/timex.h>
|
||||
#include <time.h>
|
||||
#include "kselftest.h"
|
||||
|
||||
#define NSEC_PER_SEC 1000000000LL
|
||||
#define USEC_PER_SEC 1000000LL
|
||||
#include "clock-helpers.h"
|
||||
#include "kselftest.h"
|
||||
|
||||
#define MILLION 1000000
|
||||
|
||||
|
|
|
|||
|
|
@ -29,10 +29,9 @@
|
|||
#include <stdlib.h>
|
||||
#include <pthread.h>
|
||||
#include <errno.h>
|
||||
#include "clock-helpers.h"
|
||||
#include "kselftest.h"
|
||||
|
||||
#define NSEC_PER_SEC 1000000000LL
|
||||
|
||||
#define UNREASONABLE_LAT (NSEC_PER_SEC * 5) /* hopefully we resume in 5 secs */
|
||||
|
||||
#define SUSPEND_SECS 15
|
||||
|
|
@ -40,37 +39,6 @@ int alarmcount;
|
|||
int alarm_clock_id;
|
||||
struct timespec start_time;
|
||||
|
||||
|
||||
char *clockstring(int clockid)
|
||||
{
|
||||
switch (clockid) {
|
||||
case CLOCK_REALTIME:
|
||||
return "CLOCK_REALTIME";
|
||||
case CLOCK_MONOTONIC:
|
||||
return "CLOCK_MONOTONIC";
|
||||
case CLOCK_PROCESS_CPUTIME_ID:
|
||||
return "CLOCK_PROCESS_CPUTIME_ID";
|
||||
case CLOCK_THREAD_CPUTIME_ID:
|
||||
return "CLOCK_THREAD_CPUTIME_ID";
|
||||
case CLOCK_MONOTONIC_RAW:
|
||||
return "CLOCK_MONOTONIC_RAW";
|
||||
case CLOCK_REALTIME_COARSE:
|
||||
return "CLOCK_REALTIME_COARSE";
|
||||
case CLOCK_MONOTONIC_COARSE:
|
||||
return "CLOCK_MONOTONIC_COARSE";
|
||||
case CLOCK_BOOTTIME:
|
||||
return "CLOCK_BOOTTIME";
|
||||
case CLOCK_REALTIME_ALARM:
|
||||
return "CLOCK_REALTIME_ALARM";
|
||||
case CLOCK_BOOTTIME_ALARM:
|
||||
return "CLOCK_BOOTTIME_ALARM";
|
||||
case CLOCK_TAI:
|
||||
return "CLOCK_TAI";
|
||||
}
|
||||
return "UNKNOWN_CLOCKID";
|
||||
}
|
||||
|
||||
|
||||
long long timespec_sub(struct timespec a, struct timespec b)
|
||||
{
|
||||
long long ret = NSEC_PER_SEC * b.tv_sec + b.tv_nsec;
|
||||
|
|
@ -130,12 +98,12 @@ int main(void)
|
|||
alarmcount = 0;
|
||||
if (timer_create(alarm_clock_id, &se, &tm1) == -1) {
|
||||
printf("timer_create failed, %s unsupported?: %s\n",
|
||||
clockstring(alarm_clock_id), strerror(errno));
|
||||
clock_name(alarm_clock_id), strerror(errno));
|
||||
break;
|
||||
}
|
||||
|
||||
clock_gettime(alarm_clock_id, &start_time);
|
||||
printf("Start time (%s): %ld:%ld\n", clockstring(alarm_clock_id),
|
||||
printf("Start time (%s): %ld:%ld\n", clock_name(alarm_clock_id),
|
||||
start_time.tv_sec, start_time.tv_nsec);
|
||||
printf("Setting alarm for every %i seconds\n", SUSPEND_SECS);
|
||||
its1.it_value = start_time;
|
||||
|
|
|
|||
|
|
@ -28,44 +28,14 @@
|
|||
#include <sys/timex.h>
|
||||
#include <string.h>
|
||||
#include <signal.h>
|
||||
#include "clock-helpers.h"
|
||||
#include "kselftest.h"
|
||||
|
||||
#define NSEC_PER_SEC 1000000000LL
|
||||
|
||||
/* CLOCK_HWSPECIFIC == CLOCK_SGI_CYCLE (Deprecated) */
|
||||
#define CLOCK_HWSPECIFIC 10
|
||||
|
||||
#define CALLS_PER_LOOP 64
|
||||
|
||||
char *clockstring(int clockid)
|
||||
{
|
||||
switch (clockid) {
|
||||
case CLOCK_REALTIME:
|
||||
return "CLOCK_REALTIME";
|
||||
case CLOCK_MONOTONIC:
|
||||
return "CLOCK_MONOTONIC";
|
||||
case CLOCK_PROCESS_CPUTIME_ID:
|
||||
return "CLOCK_PROCESS_CPUTIME_ID";
|
||||
case CLOCK_THREAD_CPUTIME_ID:
|
||||
return "CLOCK_THREAD_CPUTIME_ID";
|
||||
case CLOCK_MONOTONIC_RAW:
|
||||
return "CLOCK_MONOTONIC_RAW";
|
||||
case CLOCK_REALTIME_COARSE:
|
||||
return "CLOCK_REALTIME_COARSE";
|
||||
case CLOCK_MONOTONIC_COARSE:
|
||||
return "CLOCK_MONOTONIC_COARSE";
|
||||
case CLOCK_BOOTTIME:
|
||||
return "CLOCK_BOOTTIME";
|
||||
case CLOCK_REALTIME_ALARM:
|
||||
return "CLOCK_REALTIME_ALARM";
|
||||
case CLOCK_BOOTTIME_ALARM:
|
||||
return "CLOCK_BOOTTIME_ALARM";
|
||||
case CLOCK_TAI:
|
||||
return "CLOCK_TAI";
|
||||
}
|
||||
return "UNKNOWN_CLOCKID";
|
||||
}
|
||||
|
||||
/* returns 1 if a <= b, 0 otherwise */
|
||||
static inline int in_order(struct timespec a, struct timespec b)
|
||||
{
|
||||
|
|
@ -172,15 +142,15 @@ int main(int argc, char *argv[])
|
|||
for (clockid = userclock; clockid < maxclocks; clockid++) {
|
||||
|
||||
if (clockid == CLOCK_HWSPECIFIC || clock_gettime(clockid, &ts)) {
|
||||
ksft_test_result_skip("%-31s\n", clockstring(clockid));
|
||||
ksft_test_result_skip("%-31s\n", clock_name(clockid));
|
||||
continue;
|
||||
}
|
||||
|
||||
if (consistency_test(clockid, runtime)) {
|
||||
ksft_test_result_fail("%-31s\n", clockstring(clockid));
|
||||
ksft_test_result_fail("%-31s\n", clock_name(clockid));
|
||||
ksft_exit_fail();
|
||||
} else {
|
||||
ksft_test_result_pass("%-31s\n", clockstring(clockid));
|
||||
ksft_test_result_pass("%-31s\n", clock_name(clockid));
|
||||
}
|
||||
}
|
||||
ksft_exit_pass();
|
||||
|
|
|
|||
|
|
@ -51,10 +51,9 @@
|
|||
#include <string.h>
|
||||
#include <signal.h>
|
||||
#include <unistd.h>
|
||||
#include "clock-helpers.h"
|
||||
#include "kselftest.h"
|
||||
|
||||
#define NSEC_PER_SEC 1000000000LL
|
||||
|
||||
#define CLOCK_TAI 11
|
||||
|
||||
time_t next_leap;
|
||||
|
|
|
|||
|
|
@ -29,10 +29,9 @@
|
|||
#include <signal.h>
|
||||
#include <errno.h>
|
||||
#include <mqueue.h>
|
||||
#include "clock-helpers.h"
|
||||
#include "kselftest.h"
|
||||
|
||||
#define NSEC_PER_SEC 1000000000LL
|
||||
|
||||
|
||||
#define TARGET_TIMEOUT 100000000 /* 100ms in nanoseconds */
|
||||
#define UNRESONABLE_LATENCY 40000000 /* 40ms in nanosecs */
|
||||
|
|
|
|||
|
|
@ -27,44 +27,14 @@
|
|||
#include <sys/timex.h>
|
||||
#include <string.h>
|
||||
#include <signal.h>
|
||||
#include "clock-helpers.h"
|
||||
#include "kselftest.h"
|
||||
|
||||
#define NSEC_PER_SEC 1000000000LL
|
||||
|
||||
/* CLOCK_HWSPECIFIC == CLOCK_SGI_CYCLE (Deprecated) */
|
||||
#define CLOCK_HWSPECIFIC 10
|
||||
|
||||
#define UNSUPPORTED 0xf00f
|
||||
|
||||
char *clockstring(int clockid)
|
||||
{
|
||||
switch (clockid) {
|
||||
case CLOCK_REALTIME:
|
||||
return "CLOCK_REALTIME";
|
||||
case CLOCK_MONOTONIC:
|
||||
return "CLOCK_MONOTONIC";
|
||||
case CLOCK_PROCESS_CPUTIME_ID:
|
||||
return "CLOCK_PROCESS_CPUTIME_ID";
|
||||
case CLOCK_THREAD_CPUTIME_ID:
|
||||
return "CLOCK_THREAD_CPUTIME_ID";
|
||||
case CLOCK_MONOTONIC_RAW:
|
||||
return "CLOCK_MONOTONIC_RAW";
|
||||
case CLOCK_REALTIME_COARSE:
|
||||
return "CLOCK_REALTIME_COARSE";
|
||||
case CLOCK_MONOTONIC_COARSE:
|
||||
return "CLOCK_MONOTONIC_COARSE";
|
||||
case CLOCK_BOOTTIME:
|
||||
return "CLOCK_BOOTTIME";
|
||||
case CLOCK_REALTIME_ALARM:
|
||||
return "CLOCK_REALTIME_ALARM";
|
||||
case CLOCK_BOOTTIME_ALARM:
|
||||
return "CLOCK_BOOTTIME_ALARM";
|
||||
case CLOCK_TAI:
|
||||
return "CLOCK_TAI";
|
||||
};
|
||||
return "UNKNOWN_CLOCKID";
|
||||
}
|
||||
|
||||
/* returns 1 if a <= b, 0 otherwise */
|
||||
static inline int in_order(struct timespec a, struct timespec b)
|
||||
{
|
||||
|
|
@ -182,7 +152,7 @@ int main(int argc, char **argv)
|
|||
if (clockid == CLOCK_PROCESS_CPUTIME_ID ||
|
||||
clockid == CLOCK_THREAD_CPUTIME_ID ||
|
||||
clockid == CLOCK_HWSPECIFIC) {
|
||||
ksft_test_result_skip("%-31s\n", clockstring(clockid));
|
||||
ksft_test_result_skip("%-31s\n", clock_name(clockid));
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
@ -192,21 +162,21 @@ int main(int argc, char **argv)
|
|||
while (length <= (NSEC_PER_SEC * 10)) {
|
||||
ret = nanosleep_test(clockid, length);
|
||||
if (ret == UNSUPPORTED) {
|
||||
ksft_test_result_skip("%-31s\n", clockstring(clockid));
|
||||
ksft_test_result_skip("%-31s\n", clock_name(clockid));
|
||||
goto next;
|
||||
}
|
||||
if (ret < 0) {
|
||||
ksft_test_result_fail("%-31s\n", clockstring(clockid));
|
||||
ksft_test_result_fail("%-31s\n", clock_name(clockid));
|
||||
ksft_exit_fail();
|
||||
}
|
||||
length *= 100;
|
||||
}
|
||||
ret = nanosleep_test_remaining(clockid);
|
||||
if (ret < 0) {
|
||||
ksft_test_result_fail("%-31s\n", clockstring(clockid));
|
||||
ksft_test_result_fail("%-31s\n", clock_name(clockid));
|
||||
ksft_exit_fail();
|
||||
}
|
||||
ksft_test_result_pass("%-31s\n", clockstring(clockid));
|
||||
ksft_test_result_pass("%-31s\n", clock_name(clockid));
|
||||
next:
|
||||
ret = 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,10 +24,9 @@
|
|||
#include <sys/timex.h>
|
||||
#include <string.h>
|
||||
#include <signal.h>
|
||||
#include "clock-helpers.h"
|
||||
#include "kselftest.h"
|
||||
|
||||
#define NSEC_PER_SEC 1000000000LL
|
||||
|
||||
#define UNRESONABLE_LATENCY 40000000 /* 40ms in nanosecs */
|
||||
|
||||
/* CLOCK_HWSPECIFIC == CLOCK_SGI_CYCLE (Deprecated) */
|
||||
|
|
@ -35,35 +34,6 @@
|
|||
|
||||
#define UNSUPPORTED 0xf00f
|
||||
|
||||
char *clockstring(int clockid)
|
||||
{
|
||||
switch (clockid) {
|
||||
case CLOCK_REALTIME:
|
||||
return "CLOCK_REALTIME";
|
||||
case CLOCK_MONOTONIC:
|
||||
return "CLOCK_MONOTONIC";
|
||||
case CLOCK_PROCESS_CPUTIME_ID:
|
||||
return "CLOCK_PROCESS_CPUTIME_ID";
|
||||
case CLOCK_THREAD_CPUTIME_ID:
|
||||
return "CLOCK_THREAD_CPUTIME_ID";
|
||||
case CLOCK_MONOTONIC_RAW:
|
||||
return "CLOCK_MONOTONIC_RAW";
|
||||
case CLOCK_REALTIME_COARSE:
|
||||
return "CLOCK_REALTIME_COARSE";
|
||||
case CLOCK_MONOTONIC_COARSE:
|
||||
return "CLOCK_MONOTONIC_COARSE";
|
||||
case CLOCK_BOOTTIME:
|
||||
return "CLOCK_BOOTTIME";
|
||||
case CLOCK_REALTIME_ALARM:
|
||||
return "CLOCK_REALTIME_ALARM";
|
||||
case CLOCK_BOOTTIME_ALARM:
|
||||
return "CLOCK_BOOTTIME_ALARM";
|
||||
case CLOCK_TAI:
|
||||
return "CLOCK_TAI";
|
||||
};
|
||||
return "UNKNOWN_CLOCKID";
|
||||
}
|
||||
|
||||
struct timespec timespec_add(struct timespec ts, unsigned long long ns)
|
||||
{
|
||||
ts.tv_nsec += ns;
|
||||
|
|
@ -156,10 +126,10 @@ int main(int argc, char **argv)
|
|||
}
|
||||
|
||||
if (ret == UNSUPPORTED) {
|
||||
ksft_test_result_skip("%s\n", clockstring(clockid));
|
||||
ksft_test_result_skip("%s\n", clock_name(clockid));
|
||||
} else {
|
||||
ksft_test_result(ret >= 0, "%s\n",
|
||||
clockstring(clockid));
|
||||
clock_name(clockid));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -19,11 +19,9 @@
|
|||
#include <pthread.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
#include "clock-helpers.h"
|
||||
#include "kselftest.h"
|
||||
|
||||
#define NSEC_PER_SEC 1000000000LL
|
||||
#define USEC_PER_SEC 1000000LL
|
||||
|
||||
#define DELAY 2
|
||||
|
||||
static void __fatal_error(const char *test, const char *name, const char *what)
|
||||
|
|
@ -143,8 +141,9 @@ static void check_itimer(int which, const char *name)
|
|||
ksft_test_result(check_diff(start, end) == 0, "%s\n", name);
|
||||
}
|
||||
|
||||
static void check_timer_create(int which, const char *name)
|
||||
static void check_timer_create(int which)
|
||||
{
|
||||
const char *name = clock_name(which);
|
||||
struct timespec start, end;
|
||||
struct itimerspec val = {
|
||||
.it_value.tv_sec = DELAY,
|
||||
|
|
@ -457,8 +456,9 @@ static void check_delete(void)
|
|||
ksft_test_result(!tsig.signals, "check_delete\n");
|
||||
}
|
||||
|
||||
static void check_sigev_none(int which, const char *name)
|
||||
static void check_sigev_none(int which)
|
||||
{
|
||||
const char *name = clock_name(which);
|
||||
struct timespec start, now;
|
||||
struct itimerspec its;
|
||||
struct sigevent sev;
|
||||
|
|
@ -495,8 +495,9 @@ static void check_sigev_none(int which, const char *name)
|
|||
"check_sigev_none %s\n", name);
|
||||
}
|
||||
|
||||
static void check_gettime(int which, const char *name)
|
||||
static void check_gettime(int which)
|
||||
{
|
||||
const char *name = clock_name(which);
|
||||
struct itimerspec its, prev;
|
||||
struct timespec start, now;
|
||||
struct sigevent sev;
|
||||
|
|
@ -548,8 +549,9 @@ static void check_gettime(int which, const char *name)
|
|||
ksft_test_result(wraps > 1, "check_gettime %s\n", name);
|
||||
}
|
||||
|
||||
static void check_overrun(int which, const char *name)
|
||||
static void check_overrun(int which)
|
||||
{
|
||||
const char *name = clock_name(which);
|
||||
struct timespec start, now;
|
||||
struct tmrsig tsig = { };
|
||||
struct itimerspec its;
|
||||
|
|
@ -691,7 +693,7 @@ int main(int argc, char **argv)
|
|||
check_itimer(ITIMER_VIRTUAL, "ITIMER_VIRTUAL");
|
||||
check_itimer(ITIMER_PROF, "ITIMER_PROF");
|
||||
check_itimer(ITIMER_REAL, "ITIMER_REAL");
|
||||
check_timer_create(CLOCK_THREAD_CPUTIME_ID, "CLOCK_THREAD_CPUTIME_ID");
|
||||
check_timer_create(CLOCK_THREAD_CPUTIME_ID);
|
||||
|
||||
/*
|
||||
* It's unfortunately hard to reliably test a timer expiration
|
||||
|
|
@ -702,7 +704,7 @@ int main(int argc, char **argv)
|
|||
* to ensure true parallelism. So test only one thread until we
|
||||
* find a better solution.
|
||||
*/
|
||||
check_timer_create(CLOCK_PROCESS_CPUTIME_ID, "CLOCK_PROCESS_CPUTIME_ID");
|
||||
check_timer_create(CLOCK_PROCESS_CPUTIME_ID);
|
||||
check_timer_distribution();
|
||||
|
||||
if (run_sig_ign_tests) {
|
||||
|
|
@ -710,18 +712,18 @@ int main(int argc, char **argv)
|
|||
check_sig_ign(1);
|
||||
check_rearm();
|
||||
check_delete();
|
||||
check_sigev_none(CLOCK_MONOTONIC, "CLOCK_MONOTONIC");
|
||||
check_sigev_none(CLOCK_PROCESS_CPUTIME_ID, "CLOCK_PROCESS_CPUTIME_ID");
|
||||
check_gettime(CLOCK_MONOTONIC, "CLOCK_MONOTONIC");
|
||||
check_gettime(CLOCK_PROCESS_CPUTIME_ID, "CLOCK_PROCESS_CPUTIME_ID");
|
||||
check_gettime(CLOCK_THREAD_CPUTIME_ID, "CLOCK_THREAD_CPUTIME_ID");
|
||||
check_sigev_none(CLOCK_MONOTONIC);
|
||||
check_sigev_none(CLOCK_PROCESS_CPUTIME_ID);
|
||||
check_gettime(CLOCK_MONOTONIC);
|
||||
check_gettime(CLOCK_PROCESS_CPUTIME_ID);
|
||||
check_gettime(CLOCK_THREAD_CPUTIME_ID);
|
||||
} else {
|
||||
ksft_print_msg("Skipping SIG_IGN tests on kernel < 6.13\n");
|
||||
}
|
||||
|
||||
check_overrun(CLOCK_MONOTONIC, "CLOCK_MONOTONIC");
|
||||
check_overrun(CLOCK_PROCESS_CPUTIME_ID, "CLOCK_PROCESS_CPUTIME_ID");
|
||||
check_overrun(CLOCK_THREAD_CPUTIME_ID, "CLOCK_THREAD_CPUTIME_ID");
|
||||
check_overrun(CLOCK_MONOTONIC);
|
||||
check_overrun(CLOCK_PROCESS_CPUTIME_ID);
|
||||
check_overrun(CLOCK_THREAD_CPUTIME_ID);
|
||||
|
||||
ksft_finished();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,10 +25,9 @@
|
|||
#include <sys/time.h>
|
||||
#include <sys/timex.h>
|
||||
#include <time.h>
|
||||
#include "clock-helpers.h"
|
||||
#include "kselftest.h"
|
||||
|
||||
#define NSEC_PER_SEC 1000000000LL
|
||||
|
||||
#define shift_right(x, s) ({ \
|
||||
__typeof__(x) __x = (x); \
|
||||
__typeof__(s) __s = (s); \
|
||||
|
|
|
|||
|
|
@ -27,10 +27,9 @@
|
|||
#include <unistd.h>
|
||||
#include <time.h>
|
||||
#include <sys/time.h>
|
||||
#include "clock-helpers.h"
|
||||
#include "kselftest.h"
|
||||
|
||||
#define NSEC_PER_SEC 1000000000LL
|
||||
|
||||
#define KTIME_MAX ((long long)~((unsigned long long)1 << 63))
|
||||
#define KTIME_SEC_MAX (KTIME_MAX / NSEC_PER_SEC)
|
||||
|
||||
|
|
|
|||
|
|
@ -28,10 +28,9 @@
|
|||
#include <signal.h>
|
||||
#include <stdlib.h>
|
||||
#include <pthread.h>
|
||||
#include "clock-helpers.h"
|
||||
#include "kselftest.h"
|
||||
|
||||
#define NSEC_PER_SEC 1000000000LL
|
||||
|
||||
/* CLOCK_HWSPECIFIC == CLOCK_SGI_CYCLE (Deprecated) */
|
||||
#define CLOCK_HWSPECIFIC 10
|
||||
|
||||
|
|
@ -44,36 +43,6 @@ struct timespec start_time;
|
|||
long long max_latency_ns;
|
||||
int timer_fired_early;
|
||||
|
||||
char *clockstring(int clockid)
|
||||
{
|
||||
switch (clockid) {
|
||||
case CLOCK_REALTIME:
|
||||
return "CLOCK_REALTIME";
|
||||
case CLOCK_MONOTONIC:
|
||||
return "CLOCK_MONOTONIC";
|
||||
case CLOCK_PROCESS_CPUTIME_ID:
|
||||
return "CLOCK_PROCESS_CPUTIME_ID";
|
||||
case CLOCK_THREAD_CPUTIME_ID:
|
||||
return "CLOCK_THREAD_CPUTIME_ID";
|
||||
case CLOCK_MONOTONIC_RAW:
|
||||
return "CLOCK_MONOTONIC_RAW";
|
||||
case CLOCK_REALTIME_COARSE:
|
||||
return "CLOCK_REALTIME_COARSE";
|
||||
case CLOCK_MONOTONIC_COARSE:
|
||||
return "CLOCK_MONOTONIC_COARSE";
|
||||
case CLOCK_BOOTTIME:
|
||||
return "CLOCK_BOOTTIME";
|
||||
case CLOCK_REALTIME_ALARM:
|
||||
return "CLOCK_REALTIME_ALARM";
|
||||
case CLOCK_BOOTTIME_ALARM:
|
||||
return "CLOCK_BOOTTIME_ALARM";
|
||||
case CLOCK_TAI:
|
||||
return "CLOCK_TAI";
|
||||
}
|
||||
return "UNKNOWN_CLOCKID";
|
||||
}
|
||||
|
||||
|
||||
long long timespec_sub(struct timespec a, struct timespec b)
|
||||
{
|
||||
long long ret = NSEC_PER_SEC * b.tv_sec + b.tv_nsec;
|
||||
|
|
@ -104,7 +73,7 @@ void sigalarm(int signo)
|
|||
void describe_timer(int flags, int interval)
|
||||
{
|
||||
printf("%-22s %s %s ",
|
||||
clockstring(clock_id),
|
||||
clock_name(clock_id),
|
||||
flags ? "ABSTIME":"RELTIME",
|
||||
interval ? "PERIODIC":"ONE-SHOT");
|
||||
}
|
||||
|
|
@ -130,12 +99,12 @@ int setup_timer(int clock_id, int flags, int interval, timer_t *tm1)
|
|||
if ((clock_id == CLOCK_REALTIME_ALARM) ||
|
||||
(clock_id == CLOCK_BOOTTIME_ALARM)) {
|
||||
printf("%-22s %s missing CAP_WAKE_ALARM? : [UNSUPPORTED]\n",
|
||||
clockstring(clock_id),
|
||||
clock_name(clock_id),
|
||||
flags ? "ABSTIME":"RELTIME");
|
||||
/* Indicate timer isn't set, so caller doesn't wait */
|
||||
return 1;
|
||||
}
|
||||
printf("%s - timer_create() failed\n", clockstring(clock_id));
|
||||
printf("%s - timer_create() failed\n", clock_name(clock_id));
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
|
@ -152,7 +121,7 @@ int setup_timer(int clock_id, int flags, int interval, timer_t *tm1)
|
|||
|
||||
err = timer_settime(*tm1, flags, &its1, &its2);
|
||||
if (err) {
|
||||
printf("%s - timer_settime() failed\n", clockstring(clock_id));
|
||||
printf("%s - timer_settime() failed\n", clock_name(clock_id));
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -29,11 +29,9 @@
|
|||
#include <string.h>
|
||||
#include <signal.h>
|
||||
#include <unistd.h>
|
||||
#include "clock-helpers.h"
|
||||
#include "kselftest.h"
|
||||
|
||||
#define NSEC_PER_SEC 1000000000LL
|
||||
#define USEC_PER_SEC 1000000LL
|
||||
|
||||
#define ADJ_SETOFFSET 0x0100
|
||||
|
||||
#include <sys/syscall.h>
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user