* [PATCH v2 2/2] tools/nolibc: add err.h
2026-03-13 20:26 [PATCH v2 0/2] " Thomas Weißschuh
@ 2026-03-13 20:26 ` Thomas Weißschuh
0 siblings, 0 replies; 2+ messages in thread
From: Thomas Weißschuh @ 2026-03-13 20:26 UTC (permalink / raw)
To: Willy Tarreau, Shuah Khan
Cc: linux-kselftest, linux-kernel, Thomas Weißschuh
Add a few convenient helpers to print error and warning messages.
Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
Acked-by: Willy Tarreau <w@1wt.eu>
---
tools/include/nolibc/Makefile | 1 +
tools/include/nolibc/err.h | 91 +++++++++++++++++++++++++++++++++++++++++++
tools/include/nolibc/nolibc.h | 1 +
3 files changed, 93 insertions(+)
diff --git a/tools/include/nolibc/Makefile b/tools/include/nolibc/Makefile
index 1958dda98895..5d242312943f 100644
--- a/tools/include/nolibc/Makefile
+++ b/tools/include/nolibc/Makefile
@@ -30,6 +30,7 @@ all_files := \
ctype.h \
dirent.h \
elf.h \
+ err.h \
errno.h \
fcntl.h \
getopt.h \
diff --git a/tools/include/nolibc/err.h b/tools/include/nolibc/err.h
new file mode 100644
index 000000000000..2373c4999b71
--- /dev/null
+++ b/tools/include/nolibc/err.h
@@ -0,0 +1,91 @@
+/* SPDX-License-Identifier: LGPL-2.1 OR MIT */
+/*
+ * formatted error message for NOLIBC
+ * Copyright (C) 2026 Thomas Weißschuh <linux@weissschuh.net>
+ */
+
+/* make sure to include all global symbols */
+#include "nolibc.h"
+
+#ifndef _NOLIBC_ERR_H
+#define _NOLIBC_ERR_H
+
+#include "errno.h"
+#include "stdarg.h"
+#include "sys.h"
+
+static __attribute__((unused))
+void vwarn(const char *fmt, va_list args)
+{
+#ifndef NOLIBC_IGNORE_ERRNO
+ fprintf(stderr, "%s: ", program_invocation_short_name);
+#endif
+ vfprintf(stderr, fmt, args);
+ fprintf(stderr, ": %m\n");
+}
+
+static __attribute__((unused))
+void vwarnx(const char *fmt, va_list args)
+{
+#ifndef NOLIBC_IGNORE_ERRNO
+ fprintf(stderr, "%s: ", program_invocation_short_name);
+#endif
+ vfprintf(stderr, fmt, args);
+ fprintf(stderr, "\n");
+}
+
+static __attribute__((unused))
+void warn(const char *fmt, ...)
+{
+ va_list args;
+
+ va_start(args, fmt);
+ vwarn(fmt, args);
+ va_end(args);
+}
+
+static __attribute__((unused))
+void warnx(const char *fmt, ...)
+{
+ va_list args;
+
+ va_start(args, fmt);
+ vwarnx(fmt, args);
+ va_end(args);
+}
+
+static __attribute__((noreturn, unused))
+void verr(int eval, const char *fmt, va_list args)
+{
+ vwarn(fmt, args);
+ exit(eval);
+}
+
+static __attribute__((noreturn, unused))
+void verrx(int eval, const char *fmt, va_list args)
+{
+ warnx(fmt, args);
+ exit(eval);
+}
+
+static __attribute__((noreturn, unused))
+void err(int eval, const char *fmt, ...)
+{
+ va_list args;
+
+ va_start(args, fmt);
+ verr(eval, fmt, args);
+ va_end(args);
+}
+
+static __attribute__((noreturn, unused))
+void errx(int eval, const char *fmt, ...)
+{
+ va_list args;
+
+ va_start(args, fmt);
+ verrx(eval, fmt, args);
+ va_end(args);
+}
+
+#endif /* _NOLIBC_ERR_H */
diff --git a/tools/include/nolibc/nolibc.h b/tools/include/nolibc/nolibc.h
index d1d08b7f8599..fe8195483b6d 100644
--- a/tools/include/nolibc/nolibc.h
+++ b/tools/include/nolibc/nolibc.h
@@ -130,6 +130,7 @@
#include "getopt.h"
#include "poll.h"
#include "math.h"
+#include "err.h"
/* Used by programs to avoid std includes */
#define NOLIBC
--
2.53.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH v2 2/2] tools/nolibc: add err.h
@ 2026-08-18 4:45 kernel test robot
0 siblings, 0 replies; 2+ messages in thread
From: kernel test robot @ 2026-08-18 4:45 UTC (permalink / raw)
To: oe-kbuild; +Cc: lkp
::::::
:::::: Manual check reason: "low confidence bisect report"
::::::
BCC: lkp@intel.com
CC: oe-kbuild-all@lists.linux.dev
In-Reply-To: <20260313-nolibc-err-h-v2-2-f4481053b07a@weissschuh.net>
References: <20260313-nolibc-err-h-v2-2-f4481053b07a@weissschuh.net>
TO: "Thomas Weißschuh" <linux@weissschuh.net>
TO: Willy Tarreau <w@1wt.eu>
TO: Shuah Khan <skhan@linuxfoundation.org>
CC: linux-kselftest@vger.kernel.org
CC: linux-kernel@vger.kernel.org
CC: "Thomas Weißschuh" <linux@weissschuh.net>
Hi Thomas,
kernel test robot noticed the following build errors:
[auto build test ERROR on 745dadd6d3d984feafb96f27b60d74b29ade4957]
url: https://github.com/intel-lab-lkp/linux/commits/Thomas-Wei-schuh/tools-nolibc-add-support-for-program_invocation_-short_-name/20260814-021623
base: 745dadd6d3d984feafb96f27b60d74b29ade4957
patch link: https://lore.kernel.org/r/20260313-nolibc-err-h-v2-2-f4481053b07a%40weissschuh.net
patch subject: [PATCH v2 2/2] tools/nolibc: add err.h
:::::: branch date: 4 days ago
:::::: commit date: 4 days ago
config: arm64-allnoconfig-bpf (https://download.01.org/0day-ci/archive/20260818/202608180604.3dLenuJN-lkp@intel.com/config)
compiler: aarch64-linux-gnu-gcc (Debian 14.2.0-19) 14.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260818/202608180604.3dLenuJN-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/r/202608180604.3dLenuJN-lkp@intel.com/
All errors (new ones prefixed by >>):
nolibc-test.c: In function 'run_startup':
>> nolibc-test.c:750:9: error: unknown type name 'bool'
750 | bool proc = access("/proc", R_OK) == 0;
| ^~~~
nolibc-test.c:49:1: note: 'bool' is defined in header '<stdbool.h>'; this is probably fixable by adding '#include <stdbool.h>'
48 | #include "nolibc-test-linkage.h"
+++ |+#include <stdbool.h>
49 |
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-08-18 4:45 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-18 4:45 [PATCH v2 2/2] tools/nolibc: add err.h kernel test robot
-- strict thread matches above, loose matches on Subject: below --
2026-03-13 20:26 [PATCH v2 0/2] " Thomas Weißschuh
2026-03-13 20:26 ` [PATCH v2 2/2] " Thomas Weißschuh
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.