Implement process clone trampoline
All checks were successful
Build documentation / build-and-deploy (push) Successful in 2m10s
All checks were successful
Build documentation / build-and-deploy (push) Successful in 2m10s
This commit is contained in:
11
ce/interp.c
11
ce/interp.c
@@ -289,8 +289,8 @@ static void help (struct context* context) {
|
||||
cprintf (context, "quit\n");
|
||||
}
|
||||
|
||||
static void cmd_cancel_proc (void) {
|
||||
int pid = *(int*)argument_ptr ();
|
||||
static void cmd_cancel_proc (void* arg) {
|
||||
int pid = *(int*)arg;
|
||||
|
||||
char ch = 0;
|
||||
for (;;) {
|
||||
@@ -301,8 +301,6 @@ static void cmd_cancel_proc (void) {
|
||||
}
|
||||
|
||||
kill (pid);
|
||||
|
||||
quit ();
|
||||
}
|
||||
|
||||
static void execute_cmd (struct ast_cmd* cmd, struct context* context) {
|
||||
@@ -342,11 +340,12 @@ static void execute_cmd (struct ast_cmd* cmd, struct context* context) {
|
||||
return;
|
||||
}
|
||||
|
||||
int cancel_pid = process_spawn (&cmd_cancel_proc, &pid);
|
||||
struct process_data* cancel_pdata = process_spawn (&cmd_cancel_proc, &pid);
|
||||
|
||||
wait_for_pid (pid);
|
||||
|
||||
kill (cancel_pid);
|
||||
if (kill (cancel_pdata->pid) < 0)
|
||||
free (cancel_pdata);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user