]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
selftests: timers: improve timer_create failure message
authorGianfranco Trad <gianf.trad@gmail.com>
Thu, 29 Aug 2024 15:37:25 +0000 (17:37 +0200)
committerShuah Khan <skhan@linuxfoundation.org>
Mon, 14 Oct 2024 22:15:12 +0000 (16:15 -0600)
improve timer_create failure message with strerror() function
to give more information to the user.

Signed-off-by: Gianfranco Trad <gianf.trad@gmail.com>
Acked-by: John Stultz <jstultz@google.com>
Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
tools/testing/selftests/timers/alarmtimer-suspend.c

index 62da2a3f949ecc5a03ba28803a8406d1dfddfce6..9877158a085315fdb0ae560e2274a0f267585cad 100644 (file)
@@ -29,6 +29,7 @@
 #include <stdlib.h>
 #include <pthread.h>
 #include <include/vdso/time64.h>
+#include <errno.h>
 #include "../kselftest.h"
 
 #define CLOCK_REALTIME                 0
@@ -142,8 +143,8 @@ int main(void)
 
                alarmcount = 0;
                if (timer_create(alarm_clock_id, &se, &tm1) == -1) {
-                       printf("timer_create failed, %s unsupported?\n",
-                                       clockstring(alarm_clock_id));
+                       printf("timer_create failed, %s unsupported?: %s\n",
+                                       clockstring(alarm_clock_id), strerror(errno));
                        break;
                }