Split processctl() syscall into multiple smaller ones
This commit is contained in:
@ -206,20 +206,20 @@ bool interp_runstring(char *string, InterpResult **res, bool logcmds, bool inter
|
||||
string_memcpy(args1[i], argtk->str, MIN(string_len(argtk->str), PROC_ARG_MAX));
|
||||
}
|
||||
|
||||
int32_t app = processctl(-1, PCTL_SPAWN, (uint64_t)cmdtk->str, (uint64_t)args1, argslen1);
|
||||
int32_t app = proc_spawn(cmdtk->str, args1, argslen1);
|
||||
if (app < 0) {
|
||||
usprintf(RES.errmsg, "Could not run %s: %s\n", cmdtk->str, ERRSTRING(app));
|
||||
ok = false;
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
processctl(app, PCTL_RUN, 0, 0, 0);
|
||||
proc_run(app);
|
||||
|
||||
while(processctl(app, PCTL_POLLSTATE, 0, 0, 0) != 4) {
|
||||
while(proc_pollstate(app) != 4) {
|
||||
if (interactive) {
|
||||
int32_t key = devctl(&ps2kbdev, DEV_PS2KBDEV_READCH, (uint8_t *)PID, 0, 0);
|
||||
if (key > 0 && (uint8_t)key == C('S')) {
|
||||
processctl(app, PCTL_KILL, 0, 0, 0);
|
||||
proc_kill(app);
|
||||
goto cleanup;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user