extern "C" {
#endif
+#include <features.h>
+
#include <bits/errno.h>
#ifdef __GNUC__
int *__errno_location(void);
#define errno (*__errno_location())
+#ifdef _GNU_SOURCE
+extern char *program_invocation_short_name, *program_invocation_name;
+#endif
+
#ifdef __cplusplus
}
#endif
#define AUX_CNT 38
extern size_t __hwcap, __sysinfo;
+extern char *__progname, *__progname_full;
-void __init_libc(char **envp)
+void __init_libc(char **envp, char *pn)
{
size_t i, *auxv, aux[AUX_CNT] = { 0 };
__environ = envp;
__hwcap = aux[AT_HWCAP];
__sysinfo = aux[AT_SYSINFO];
+ if (pn) {
+ __progname = __progname_full = pn;
+ for (i=0; pn[i]; i++) if (pn[i]=='/') __progname = pn+i+1;
+ }
+
__init_tls(aux);
__init_security(aux);
}
{
char **envp = argv+argc+1;
- __init_libc(envp);
+ __init_libc(envp, argv[0]);
libc.ldso_fini = ldso_fini;
libc.fini = fini;
size_t __hwcap;
size_t __sysinfo;
+char *__progname=0, *__progname_full=0;
+
+weak_alias(__progname, program_invocation_short_name);
+weak_alias(__progname_full, program_invocation_name);