On Fri, Jul 25, 2014 at 1:40 PM, <[1]sf...@users.sourceforge.net> wrote:
Sean Lynch: > Now program_invocation_name is missing: Thank you for testing. But which version is your musl library? I confirmed that musl libc has program_invocation_name when I was writing the patch. Now I read the history and found it was added more than a year ago (musl v0.9.10.) b4ea638 2013-04-06 add support for program_invocation[_short]_name Assuming your version is older than musl v0.9.10, it looks hard to support by simple "#if muls_version > brabra", since the version in musl libc is defined as "#define VERSION 1.1.3" For the case such like this, I believe autoconf is the best tool. But I don't know what autoconf rule can detect the installed musl lib. Do you have any idea? Hmm, I wonder autoconf would handle the version of aufs module... No, it would be hard. I will keep current git-branch versioning for aufs version. I'm using 1.0.3 because that's what's in the AUR (Arch linux). It turns out the definition for program_inforation(_short)?_name is wrapped in #ifdef _GNU_SOURCE. Adding #define _GNU_SOURCE just before #include <errno.h> in au_util.h makes it compile. I've attached an updated version of your patch that will compile with "make HOSTCC=musl-gcc CPPFLAGS=-I<path_to_kernel_headers>". Thanks! References 1. mailto:sf...@users.sourceforge.net
diff --git a/au_util.h b/au_util.h index e453629..66b8490 100644 --- a/au_util.h +++ b/au_util.h @@ -19,8 +19,31 @@ #ifndef __AUFS_UTIL_H__ #define __AUFS_UTIL_H__ +#define _GNU_SOURCE #include <errno.h> + +#ifdef __GNU_LIBRARY__ #include <error.h> +#else +/* musl lib has 'program_invocation_name', but doesn't have error_at_line() */ +#include <stdarg.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +static inline void error_at_line(int status, int errnum, const char *filename, + unsigned int linenum, const char *format, ...) +{ + va_list ap; + va_start(ap, format); + fprintf(stderr, "%s:%s:%d: ", + program_invocation_name, filename, linenum); + vfprintf(stderr, format, ap); + fprintf(stderr, ": %s\n", errnum ? strerror(errnum) : ""); + va_end(ap); + if (status) + exit(status); +} +#endif /* __GNU_LIBRARY__ */ #define AuVersion "aufs-util for aufs3.9 and later"
------------------------------------------------------------------------------ Want fast and easy access to all the code in your enterprise? Index and search up to 200,000 lines of code with a free copy of Black Duck Code Sight - the same software that powers the world's largest code search on Ohloh, the Black Duck Open Hub! Try it now. http://p.sf.net/sfu/bds