From 356f59c898c982d7cc45e067d79a329ab5ab8caa Mon Sep 17 00:00:00 2001 From: Sebastian Huber Date: Fri, 6 May 2016 12:16:19 +0200 Subject: [PATCH] kvprintf: Add support for %m --- freebsd/sys/kern/subr_prf.c | 8 ++++++++ testsuite/log01/test_main.c | 6 ++++++ 2 files changed, 14 insertions(+) diff --git a/freebsd/sys/kern/subr_prf.c b/freebsd/sys/kern/subr_prf.c index 56b3bfaf..8e627d1a 100644 --- a/freebsd/sys/kern/subr_prf.c +++ b/freebsd/sys/kern/subr_prf.c @@ -800,6 +800,11 @@ reswitch: switch (ch = (u_char)*fmt++) { else *(va_arg(ap, int *)) = retval; break; +#ifdef __rtems__ + case 'm': + p = strerror(errno); + goto handle_string; +#endif /* __rtems__ */ case 'o': base = 8; goto handle_nosign; @@ -819,6 +824,9 @@ reswitch: switch (ch = (u_char)*fmt++) { goto handle_nosign; case 's': p = va_arg(ap, char *); +#ifdef __rtems__ +handle_string: +#endif /* __rtems__ */ if (p == NULL) p = "(null)"; if (!dot) diff --git a/testsuite/log01/test_main.c b/testsuite/log01/test_main.c index 0b3db765..5c177359 100644 --- a/testsuite/log01/test_main.c +++ b/testsuite/log01/test_main.c @@ -36,6 +36,7 @@ #include #include +#include #include #include #include @@ -138,6 +139,11 @@ test_main(void) printf("out: %4D", "AAAA", ":"); check(ctx, "out: 41:41:41:41"); + errno = ENOMSG; + reset(ctx, LOG_PRINTF); + printf("%m"); + check(ctx, "No message of desired type"); + exit(0); }