From 62f9691e10e5e73be32b8aa9e79964cebbb6c704 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Luis=20Salvador=20Rufo?= Date: Wed, 17 Feb 2021 06:51:46 +0100 Subject: [PATCH] Support uClibc for the tests compilations MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit There are two issues that don't allow ZFS to be compiled using uClibc. `backtrace()`, and `program_invocation_short_name` as a `const`. This patch adds uClibc to the conditionals in the same way there are already for Glibc for `backtrace()`; and removes the external param `program_invocation_short_name` because its only used here for the whole project. Reviewed-by: Brian Behlendorf Signed-off-by: José Luis Salvador Rufo Closes #11600 --- cmd/ztest/ztest.c | 4 ++-- tests/zfs-tests/cmd/xattrtest/xattrtest.c | 6 ++---- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/cmd/ztest/ztest.c b/cmd/ztest/ztest.c index 5d946294b..484637997 100644 --- a/cmd/ztest/ztest.c +++ b/cmd/ztest/ztest.c @@ -132,7 +132,7 @@ #include #include #include -#ifdef __GLIBC__ +#if (__GLIBC__ && !__UCLIBC__) #include /* for backtrace() */ #endif @@ -556,7 +556,7 @@ dump_debug_buffer(void) static void sig_handler(int signo) { struct sigaction action; -#ifdef __GLIBC__ /* backtrace() is a GNU extension */ +#if (__GLIBC__ && !__UCLIBC__) /* backtrace() is a GNU extension */ int nptrs; void *buffer[BACKTRACE_SZ]; diff --git a/tests/zfs-tests/cmd/xattrtest/xattrtest.c b/tests/zfs-tests/cmd/xattrtest/xattrtest.c index 42c510ed0..8c4cb8895 100644 --- a/tests/zfs-tests/cmd/xattrtest/xattrtest.c +++ b/tests/zfs-tests/cmd/xattrtest/xattrtest.c @@ -44,11 +44,9 @@ #include #include -extern char *program_invocation_short_name; - #define ERROR(fmt, ...) \ - fprintf(stderr, "%s: %s:%d: %s: " fmt "\n", \ - program_invocation_short_name, __FILE__, __LINE__, \ + fprintf(stderr, "xattrtest: %s:%d: %s: " fmt "\n", \ + __FILE__, __LINE__, \ __func__, ## __VA_ARGS__); static const char shortopts[] = "hvycdn:f:x:s:p:t:e:rRko:";