This patch adds GNU libc extension variables __progname and __progname_full used by coreutils. These seem to come from BSD as 'BSD' paragraph explains - https://rosettacode.org/wiki/Program_name#C.
Signed-off-by: Waldemar Kozaczuk <[email protected]> --- core/app.cc | 6 ++++-- libc/libc.cc | 4 ++++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/core/app.cc b/core/app.cc index fbd033aa..0ec5fcc8 100644 --- a/core/app.cc +++ b/core/app.cc @@ -23,6 +23,8 @@ using namespace boost::range; extern int optind; +extern char* __progname; +extern char* __progname_full; // Java uses this global variable (supplied by Glibc) to figure out // aproximatively where the initial thread's stack end. @@ -338,8 +340,8 @@ void application::prepare_argv(elf::program *program) { // Prepare program_* variable used by the libc char *c_path = (char *)(_command.c_str()); - program_invocation_name = c_path; - program_invocation_short_name = basename(c_path); + __progname_full = program_invocation_name = c_path; + __progname = program_invocation_short_name = basename(c_path); // Allocate a continuous buffer for arguments: _argv_buf // First count the trailing zeroes diff --git a/libc/libc.cc b/libc/libc.cc index a9d4c48d..70fdb483 100644 --- a/libc/libc.cc +++ b/libc/libc.cc @@ -32,6 +32,10 @@ char *program_invocation_name; char *program_invocation_short_name; +// These two are used by GNU coreutils +char* __progname; +char* __progname_full; + int libc_error(int err) { errno = err; -- 2.20.1 -- You received this message because you are subscribed to the Google Groups "OSv Development" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
