#define _GNU_SOURCE #include #include #include #include #include #include #include #include struct args { char body[1024]; char ptr[0]; }; static i = 0; static int ns_exec(void *_arg) { pid_t pid; int status; struct args *args = malloc(sizeof(struct args)); if (args == NULL) { printf("Can't allocate memory\n"); return 1; } if (i++ > 4000) return 0; pid = clone(ns_exec, args->ptr, CLONE_NEWPID | CLONE_VM | SIGCHLD, NULL); if (pid == -1) { printf("clone() failed: %m\n"); return 1; } while (1) sleep(1000); return 0; } int main(int argc, char **argv) { ns_exec(NULL); return 0; }