fix: inherit process environment and untrack libc objects
This commit is contained in:
@@ -32,7 +32,7 @@ void exit(int code); // Terminate process (nore
|
||||
void yield(); // Yield CPU to scheduler
|
||||
void sleep_ms(uint64_t ms); // Sleep for milliseconds
|
||||
int getpid(); // Get current process ID
|
||||
int spawn(const char* path, const char* args); // Spawn child process (-1 on error)
|
||||
int spawn(const char* path, const char* args); // Spawn child, inheriting environment
|
||||
int waitpid(int pid); // Wait for process to exit
|
||||
int kill(int pid); // Kill a process
|
||||
int proclist(ProcInfo* buf, int max); // List all processes (returns count)
|
||||
|
||||
@@ -208,6 +208,9 @@ namespace montauk::abi {
|
||||
|
||||
// Absolute path of the running executable (for argv[0]).
|
||||
static constexpr uint64_t SYS_GETEXECPATH = 151; // (index, flags) -> new front index; index=-1 queries support (1/0); flags bit0 = wait vsync
|
||||
static constexpr uint64_t SYS_GETENVIRON = 171;
|
||||
static constexpr uint64_t SYS_SETENVIRON = 172;
|
||||
static constexpr uint64_t SYS_SPAWN_ENV = 173;
|
||||
|
||||
// Path metadata (size, timestamps, mode). (const char* path, FileStat* out) -> 0, -1 on error/unsupported.
|
||||
static constexpr uint64_t SYS_STAT = 152;
|
||||
|
||||
@@ -73,6 +73,9 @@ extern "C" {
|
||||
#define MTK_SYS_MOUSESTATE 47
|
||||
#define MTK_SYS_SETMOUSEBOUNDS 48
|
||||
#define MTK_SYS_SPAWN_REDIR 49
|
||||
#define MTK_SYS_GETENVIRON 171
|
||||
#define MTK_SYS_SETENVIRON 172
|
||||
#define MTK_SYS_SPAWN_ENV 173
|
||||
#define MTK_SYS_CHILDIO_READ 50
|
||||
#define MTK_SYS_CHILDIO_WRITE 51
|
||||
#define MTK_SYS_CHILDIO_WRITEKEY 52
|
||||
|
||||
@@ -15,7 +15,7 @@ extern "C" {
|
||||
* Limitations (kernel spawn model):
|
||||
* - argv is joined into a single args string; arguments containing
|
||||
* spaces are rejected with EINVAL (no quoting in the kernel).
|
||||
* - envp is ignored (no environment transfer on spawn).
|
||||
* - envp is copied into the child; NULL inherits the current environment.
|
||||
* - file actions must be empty: stdio redirection needs kernel
|
||||
* support that does not exist yet, so any recorded action makes
|
||||
* posix_spawn fail with ENOTSUP rather than misbehave silently.
|
||||
|
||||
Reference in New Issue
Block a user