summaryrefslogtreecommitdiffstats
path: root/lib/Sbuild/Utility.pm
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Sbuild/Utility.pm')
-rw-r--r--lib/Sbuild/Utility.pm12
1 files changed, 11 insertions, 1 deletions
diff --git a/lib/Sbuild/Utility.pm b/lib/Sbuild/Utility.pm
index 5a59b28..9cdfff1 100644
--- a/lib/Sbuild/Utility.pm
+++ b/lib/Sbuild/Utility.pm
@@ -56,7 +56,7 @@ BEGIN {
@EXPORT = qw(setup cleanup shutdown check_url download get_unshare_cmd
read_subuid_subgid CLONE_NEWNS CLONE_NEWUTS CLONE_NEWIPC CLONE_NEWUSER
- CLONE_NEWPID CLONE_NEWNET test_unshare get_tar_compress_options);
+ CLONE_NEWPID CLONE_NEWNET PER_LINUX32 test_unshare get_tar_compress_options);
$SIG{'INT'} = \&shutdown;
$SIG{'TERM'} = \&shutdown;
@@ -379,6 +379,11 @@ use constant {
CLONE_NEWNET => 0x40000000,
};
+# from personality.h
+use constant {
+ PER_LINUX32 => 0x0008,
+};
+
sub get_unshare_cmd($) {
my $options = shift;
@@ -515,6 +520,11 @@ if (\$cpid != 0) {
EOF
}
+ if ($options->{'LINUX32'}) {
+ my $personality = PER_LINUX32;
+ $command .= "syscall &SYS_personality, $personality;";
+ }
+
$command .= 'exec { $ARGV[0] } @ARGV or die "exec() failed: $!";';
# remove code comments
$command =~ s/^\s*#.*$//gm;