Handle current working directory in Noux

This commit is contained in:
Norman Feske 2012-03-16 18:22:06 +01:00
parent d460820cf6
commit 207abe647b
2 changed files with 7 additions and 2 deletions

View File

@ -257,6 +257,7 @@ namespace Noux {
Vfs *vfs, Vfs *vfs,
Args const &args, Args const &args,
char const *env, char const *env,
char const *pwd,
Cap_session *cap_session, Cap_session *cap_session,
Service_registry &parent_services, Service_registry &parent_services,
Rpc_entrypoint &resources_ep, Rpc_entrypoint &resources_ep,
@ -289,6 +290,7 @@ namespace Noux {
_child(_binary_ds, _resources.ram.cap(), _resources.cpu.cap(), _child(_binary_ds, _resources.ram.cap(), _resources.cpu.cap(),
_resources.rm.cap(), &_entrypoint, &_child_policy) _resources.rm.cap(), &_entrypoint, &_child_policy)
{ {
_env.pwd(pwd);
_args.dump(); _args.dump();
} }

View File

@ -154,7 +154,7 @@ bool Noux::Child::syscall(Noux::Session::Syscall sc)
case SYSCALL_EXECVE: case SYSCALL_EXECVE:
{ {
char const *env = "PWD=\"/\""; char const *env = "";
char const *filename = _sysio->execve_in.filename; char const *filename = _sysio->execve_in.filename;
Child *child = new Child(filename, Child *child = new Child(filename,
parent(), parent(),
@ -164,6 +164,7 @@ bool Noux::Child::syscall(Noux::Session::Syscall sc)
Args(_sysio->execve_in.args, Args(_sysio->execve_in.args,
sizeof(_sysio->execve_in.args)), sizeof(_sysio->execve_in.args)),
env, /* XXX */ env, /* XXX */
_env.pwd(),
_cap_session, _cap_session,
_parent_services, _parent_services,
_resources.ep, _resources.ep,
@ -288,7 +289,7 @@ bool Noux::Child::syscall(Noux::Session::Syscall sc)
Genode::addr_t parent_cap_addr = _sysio->fork_in.parent_cap_addr; Genode::addr_t parent_cap_addr = _sysio->fork_in.parent_cap_addr;
int new_pid = pid_allocator()->alloc(); int new_pid = pid_allocator()->alloc();
char const *env = "PWD=\"/\""; char const *env = "";
/* /*
* XXX To ease debugging, it would be useful to generate a * XXX To ease debugging, it would be useful to generate a
@ -302,6 +303,7 @@ bool Noux::Child::syscall(Noux::Session::Syscall sc)
_vfs, _vfs,
_args, _args,
env, /* XXX */ env, /* XXX */
_env.pwd(),
_cap_session, _cap_session,
_parent_services, _parent_services,
_resources.ep, _resources.ep,
@ -524,6 +526,7 @@ int main(int argc, char **argv)
&vfs, &vfs,
args_of_init_process(), args_of_init_process(),
env_string_of_init_process(), env_string_of_init_process(),
"/",
&cap, &cap,
parent_services, parent_services,
resources_ep, resources_ep,