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;
|
||||
}
|
||||
}
|
||||
|
||||
@ -146,7 +146,7 @@ void do_mode_interactive(void) {
|
||||
}
|
||||
|
||||
void main(void) {
|
||||
PID = processctl(-1, PCTL_GETPID, 0, 0, 0);
|
||||
PID = proc_getpid();
|
||||
|
||||
set_config();
|
||||
|
||||
|
||||
@ -111,7 +111,7 @@ bool rt_do(Token *tks) {
|
||||
args1[ARRLEN(prepended_args)] = umalloc(PROC_ARG_MAX);
|
||||
string_strcpy(args1[ARRLEN(prepended_args)], s);
|
||||
|
||||
int32_t app = processctl(-1, PCTL_SPAWN, (uint64_t)"base:/bin/tb", (uint64_t)args1, ARRLEN(prepended_args)+1);
|
||||
int32_t app = proc_spawn("base:/bin/tb", args1, ARRLEN(prepended_args)+1);
|
||||
if (app < 0) {
|
||||
ok = false;
|
||||
goto done;
|
||||
@ -123,9 +123,9 @@ bool rt_do(Token *tks) {
|
||||
ipc_pipemake(10);
|
||||
ipc_pipeconnect(app, 0, PID, 10);
|
||||
|
||||
processctl(app, PCTL_RUN, 0, 0, 0);
|
||||
proc_run(app);
|
||||
|
||||
while (processctl(app, PCTL_POLLSTATE, 0, 0, 0) != 4) {
|
||||
while (proc_pollstate(app) != 4) {
|
||||
int32_t r;
|
||||
char buf[100];
|
||||
string_memset(buf, 0, sizeof(buf));
|
||||
|
||||
Reference in New Issue
Block a user