mirror of
https://github.com/clearlinux/hyperstart.git
synced 2026-08-25 16:56:01 +00:00
recyle resources of process which created by clone
Signed-off-by: Gao feng <omarapazanadi@gmail.com>
This commit is contained in:
+3
-1
@@ -9,6 +9,7 @@
|
||||
#include <sched.h>
|
||||
#include <errno.h>
|
||||
#include <string.h>
|
||||
#include <signal.h>
|
||||
#include <fcntl.h>
|
||||
#include <inttypes.h>
|
||||
#include "syscall.h"
|
||||
@@ -407,7 +408,8 @@ int hyper_exec_cmd(char *json, int length)
|
||||
}
|
||||
|
||||
arg.exec = exec;
|
||||
pid = clone(hyper_do_exec_cmd, stack + stacksize, CLONE_VM| CLONE_FILES, &arg);
|
||||
pid = clone(hyper_do_exec_cmd, stack + stacksize, CLONE_VM| CLONE_FILES| SIGCHLD, &arg);
|
||||
fprintf(stdout, "do_exec_cmd pid %d\n", pid);
|
||||
free(stack);
|
||||
if (pid < 0) {
|
||||
perror("clone hyper_do_exec_cmd failed");
|
||||
|
||||
+2
-2
@@ -468,7 +468,7 @@ int hyper_start_containers(struct hyper_pod *pod)
|
||||
goto out;
|
||||
}
|
||||
|
||||
pid = clone(hyper_do_start_containers, stack + stacksize, CLONE_VM| CLONE_FILES, &arg);
|
||||
pid = clone(hyper_do_start_containers, stack + stacksize, CLONE_VM| CLONE_FILES| SIGCHLD, &arg);
|
||||
free(stack);
|
||||
if (pid < 0) {
|
||||
perror("enter container pid ns failed");
|
||||
@@ -932,7 +932,7 @@ static int hyper_cmd_read_file(char *json, int length, uint32_t *datalen, uint8_
|
||||
arg.data = data;
|
||||
sprintf(arg.root, "/tmp/hyper/%s/root/%s/", c->id, c->rootfs);
|
||||
|
||||
pid = clone(hyper_do_cmd_read_file, stack + stacksize, CLONE_VM, &arg);
|
||||
pid = clone(hyper_do_cmd_read_file, stack + stacksize, CLONE_VM| SIGCHLD, &arg);
|
||||
free(stack);
|
||||
if (pid < 0) {
|
||||
perror("fail to fork writter process");
|
||||
|
||||
Reference in New Issue
Block a user