Tools: add unshare system call
authorWolfgang Bumiller <w.bumiller@proxmox.com>
Thu, 17 Sep 2015 10:50:03 +0000 (12:50 +0200)
committerDietmar Maurer <dietmar@proxmox.com>
Thu, 17 Sep 2015 11:20:15 +0000 (13:20 +0200)
Including the important CLONE_* constants.

src/PVE/Tools.pm

index 26f0080..1a342ee 100644 (file)
@@ -63,6 +63,13 @@ our $IPV6RE = "(?:" .
     "(?:(?:(?:(?:$IPV6H16:){0,5}$IPV6H16)?::" .            ")$IPV6H16)|" .
     "(?:(?:(?:(?:$IPV6H16:){0,6}$IPV6H16)?::" .                    ")))";
 
+use constant (CLONE_NEWNS   => 0x00020000,
+              CLONE_NEWUTS  => 0x04000000,
+              CLONE_NEWIPC  => 0x08000000,
+              CLONE_NEWUSER => 0x10000000,
+              CLONE_NEWPID  => 0x20000000,
+              CLONE_NEWNET  => 0x40000000);
+
 sub run_with_timeout {
     my ($timeout, $code, @param) = @_;
 
@@ -1153,4 +1160,9 @@ sub parse_host_and_port {
     return; # nothing
 }
 
+sub unshare {
+    my ($flags) = @_;
+    syscall 272, $flags;
+}
+
 1;