Hook for passing env pointer to main function

The new 'genode_envp' variable declared in '_main.cc' allows libc
plugins to supplying custom environment pointers to the main function.
This is needed by 3rd-party software such as GNU make, which expects the
environment pointer as third argument of the main function.
This commit is contained in:
Norman Feske
2012-05-18 19:30:19 +02:00
parent 6f12659369
commit 97cd7ca022
2 changed files with 7 additions and 2 deletions

View File

@ -31,7 +31,7 @@
using namespace Genode;
extern int main(int argc, char **argv);
extern int main(int argc, char **argv, char **envp);
extern void init_exception_handling(); /* implemented in base/cxx */
enum { ATEXIT_SIZE = 256 };
@ -212,6 +212,7 @@ static char *argv[1] = { argv0 };
*/
char **genode_argv = argv;
int genode_argc = 1;
char **genode_envp = 0;
/**
@ -250,7 +251,7 @@ extern "C" int _main()
/* now, it is save to call printf */
/* call real main function */
int ret = main(genode_argc, genode_argv);
int ret = main(genode_argc, genode_argv, genode_envp);
genode_exit(ret);