]> git.proxmox.com Git - mirror_lxc.git/blobdiff - src/tests/lxc_raw_clone.c
github: Update for main branch
[mirror_lxc.git] / src / tests / lxc_raw_clone.c
index 77902314112911f4652d8a7272de3ee3a160abca..1225d023d6b081c08f4acb05bb9fdbde1e2bec46 100644 (file)
@@ -21,8 +21,8 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
-#define _GNU_SOURCE
-#define __STDC_FORMAT_MACROS
+#include "config.h"
+
 #include <errno.h>
 #include <fcntl.h>
 #include <inttypes.h>
 #include <sys/stat.h>
 #include <sys/types.h>
 
+#include "cgroups/cgroup_utils.h"
 #include "lxctest.h"
 #include "namespace.h"
+#include "process_utils.h"
 #include "utils.h"
 
 int main(int argc, char *argv[])
@@ -47,42 +49,42 @@ int main(int argc, char *argv[])
        pid_t pid;
        int flags = 0;
 
-       pid = lxc_raw_clone(CLONE_PARENT_SETTID);
+       pid = lxc_raw_clone(CLONE_PARENT_SETTID, NULL);
        if (pid >= 0 || pid != -EINVAL) {
                lxc_error("%s\n", "Calling lxc_raw_clone(CLONE_PARENT_SETTID) "
                                  "should not be possible");
                exit(EXIT_FAILURE);
        }
 
-       pid = lxc_raw_clone(CLONE_CHILD_SETTID);
+       pid = lxc_raw_clone(CLONE_CHILD_SETTID, NULL);
        if (pid >= 0 || pid != -EINVAL) {
                lxc_error("%s\n", "Calling lxc_raw_clone(CLONE_CHILD_SETTID) "
                                  "should not be possible");
                exit(EXIT_FAILURE);
        }
 
-       pid = lxc_raw_clone(CLONE_CHILD_CLEARTID);
+       pid = lxc_raw_clone(CLONE_CHILD_CLEARTID, NULL);
        if (pid >= 0 || pid != -EINVAL) {
                lxc_error("%s\n", "Calling lxc_raw_clone(CLONE_CHILD_CLEARTID) "
                                  "should not be possible");
                exit(EXIT_FAILURE);
        }
 
-       pid = lxc_raw_clone(CLONE_SETTLS);
+       pid = lxc_raw_clone(CLONE_SETTLS, NULL);
        if (pid >= 0 || pid != -EINVAL) {
                lxc_error("%s\n", "Calling lxc_raw_clone(CLONE_SETTLS) should "
                                  "not be possible");
                exit(EXIT_FAILURE);
        }
 
-       pid = lxc_raw_clone(CLONE_VM);
+       pid = lxc_raw_clone(CLONE_VM, NULL);
        if (pid >= 0 || pid != -EINVAL) {
                lxc_error("%s\n", "Calling lxc_raw_clone(CLONE_VM) should "
                          "not be possible");
                exit(EXIT_FAILURE);
        }
 
-       pid = lxc_raw_clone(0);
+       pid = lxc_raw_clone(0, NULL);
        if (pid < 0) {
                lxc_error("%s\n", "Failed to call lxc_raw_clone(0)");
                exit(EXIT_FAILURE);
@@ -99,7 +101,7 @@ int main(int argc, char *argv[])
                exit(EXIT_FAILURE);
        }
 
-       pid = lxc_raw_clone(0);
+       pid = lxc_raw_clone(0, NULL);
        if (pid < 0) {
                lxc_error("%s\n", "Failed to call lxc_raw_clone(0)");
                exit(EXIT_FAILURE);
@@ -125,7 +127,8 @@ int main(int argc, char *argv[])
        flags |= CLONE_NEWIPC;
        flags |= CLONE_NEWPID;
        flags |= CLONE_NEWUTS;
-       pid = lxc_raw_clone(flags);
+
+       pid = lxc_raw_clone(flags, NULL);
        if (pid < 0) {
                lxc_error("%s\n", "Failed to call lxc_raw_clone(CLONE_NEWUSER "
                                  "| CLONE_NEWCGROUP | CLONE_NEWNS | "
@@ -145,7 +148,7 @@ int main(int argc, char *argv[])
                exit(EXIT_FAILURE);
        }
 
-       pid = lxc_raw_clone(flags);
+       pid = lxc_raw_clone(flags, NULL);
        if (pid < 0) {
                lxc_error("%s\n", "Failed to call lxc_raw_clone(CLONE_NEWUSER "
                                  "| CLONE_NEWCGROUP | CLONE_NEWNS | "
@@ -166,13 +169,12 @@ int main(int argc, char *argv[])
                exit(EXIT_FAILURE);
        }
 
-       pid = lxc_raw_clone(CLONE_VFORK);
+       pid = lxc_raw_clone(CLONE_VFORK, NULL);
        if (pid < 0) {
                lxc_error("%s\n", "Failed to call lxc_raw_clone(CLONE_VFORK);");
                exit(EXIT_FAILURE);
        }
 
-
        if (pid == 0) {
                lxc_error("%s\n", "Child will exit(EXIT_SUCCESS)");
                exit(EXIT_SUCCESS);
@@ -184,13 +186,12 @@ int main(int argc, char *argv[])
                exit(EXIT_FAILURE);
        }
 
-       pid = lxc_raw_clone(CLONE_VFORK);
+       pid = lxc_raw_clone(CLONE_VFORK, NULL);
        if (pid < 0) {
                lxc_error("%s\n", "Failed to call lxc_raw_clone(CLONE_VFORK);");
                exit(EXIT_FAILURE);
        }
 
-
        if (pid == 0) {
                lxc_error("%s\n", "Child will exit(EXIT_FAILURE)");
                exit(EXIT_FAILURE);
@@ -202,13 +203,12 @@ int main(int argc, char *argv[])
                exit(EXIT_FAILURE);
        }
 
-       pid = lxc_raw_clone(CLONE_FILES);
+       pid = lxc_raw_clone(CLONE_FILES, NULL);
        if (pid < 0) {
                lxc_error("%s\n", "Failed to call lxc_raw_clone(CLONE_FILES);");
                exit(EXIT_FAILURE);
        }
 
-
        if (pid == 0) {
                lxc_error("%s\n", "Child will exit(EXIT_SUCCESS)");
                exit(EXIT_SUCCESS);
@@ -220,13 +220,12 @@ int main(int argc, char *argv[])
                exit(EXIT_FAILURE);
        }
 
-       pid = lxc_raw_clone(CLONE_FILES);
+       pid = lxc_raw_clone(CLONE_FILES, NULL);
        if (pid < 0) {
                lxc_error("%s\n", "Failed to call lxc_raw_clone(CLONE_FILES);");
                exit(EXIT_FAILURE);
        }
 
-
        if (pid == 0) {
                lxc_error("%s\n", "Child will exit(EXIT_FAILURE)");
                exit(EXIT_FAILURE);