fix: inherit process environment and untrack libc objects
This commit is contained in:
@@ -59,6 +59,10 @@
|
||||
The argument string is set by the parent when calling spawn().
|
||||
If no arguments were provided, the buffer will be empty.
|
||||
|
||||
A spawned child inherits a snapshot of its parent's environment. Libc
|
||||
exposes it through getenv(), setenv(), and environ. posix_spawn() can
|
||||
instead provide an explicit envp for the child.
|
||||
|
||||
.SH NOTES
|
||||
The _start() entry point receives no argc/argv. Use getargs()
|
||||
to retrieve the argument string passed by the parent process.
|
||||
|
||||
@@ -39,7 +39,8 @@
|
||||
int montauk::getpid();
|
||||
|
||||
.B SYS_SPAWN (20)
|
||||
Spawn a new process from an ELF binary on the VFS.
|
||||
Spawn a new process from an ELF binary on the VFS. The child inherits
|
||||
a snapshot of the caller's environment.
|
||||
int montauk::spawn(const char* path, const char* args = nullptr);
|
||||
|
||||
.B SYS_WAITPID (23)
|
||||
@@ -50,6 +51,11 @@
|
||||
Get the argument string passed to this process at spawn time.
|
||||
int montauk::getargs(char* buf, uint64_t maxLen);
|
||||
|
||||
.B SYS_GETENVIRON (171), SYS_SETENVIRON (172), SYS_SPAWN_ENV (173)
|
||||
Libc process-environment transport. Environment data is encoded as
|
||||
consecutive NAME=VALUE strings with a final empty string. Applications
|
||||
normally use getenv(3), setenv(3), environ, and posix_spawn(3).
|
||||
|
||||
.B SYS_PROCLIST (61)
|
||||
List running processes (pid, parent, state, name, heap usage,
|
||||
accumulated CPU time).
|
||||
|
||||
Reference in New Issue
Block a user