recyle resources of process which created by clone

Signed-off-by: Gao feng <omarapazanadi@gmail.com>
This commit is contained in:
Gao feng
2015-09-24 16:58:42 +08:00
parent d45be919cd
commit 684e85cc5e
2 changed files with 5 additions and 3 deletions
+3 -1
View File
@@ -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
View File
@@ -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");