[PATCH 2/6] cyclictest: Test the return value of timer_create()

Thomas Weißschuh (Schneider Electric) <[email protected]> Tue, 07 Apr 2026 08:48:42 +0200
Newsgroups org.kernel.vger.linux-rt-users
Message-ID <[email protected]>
The operating system may not support timers for the select clock.

Report these errors to the user.

Signed-off-by: Thomas Weißschuh (Schneider Electric) <[email protected]>
---
 src/cyclictest/cyclictest.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/cyclictest/cyclictest.c b/src/cyclictest/cyclictest.c
index 592cf9d9387d..0c30e767e685 100644
--- a/src/cyclictest/cyclictest.c
+++ b/src/cyclictest/cyclictest.c
@@ -671,7 +671,9 @@ static void *timerthread(void *param)
 		sigev.sigev_notify = SIGEV_THREAD_ID | SIGEV_SIGNAL;
 		sigev.sigev_signo = par->signal;
 		sigev.sigev_notify_thread_id = stat->tid;
-		timer_create(par->clock, &sigev, &timer);
+		if (timer_create(par->clock, &sigev, &timer))
+			fatal("timerthread%d: failed to create timer for clock %d, errno: %d\n",
+			      par->cpu, par->clock, errno);
 		tspec.it_interval = interval;
 	}
 

-- 
2.53.0