[pve-devel] [PATCH pve-common] Tools: add unshare system call

Wolfgang Bumiller w.bumiller at proxmox.com
Thu Sep 17 12:50:03 CEST 2015


Including the important CLONE_* constants.
---
 src/PVE/Tools.pm | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/src/PVE/Tools.pm b/src/PVE/Tools.pm
index 26f0080..1a342ee 100644
--- a/src/PVE/Tools.pm
+++ b/src/PVE/Tools.pm
@@ -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;
-- 
2.1.4




More information about the pve-devel mailing list