[pve-devel] [PATCH container] use Syscall module instead of raw syscall numbers

Thomas Lamprecht t.lamprecht at proxmox.com
Wed May 10 15:03:46 CEST 2017


Raw syscall numbers were not platform independent, so replace them
with the new PVE::Syscall module which gets the syscall numbers from
syscall.ph, which provides the platform local values.

we cannot directly use syscall.ph as it is no normal perl module and
so it's usage requires special handling

Signed-off-by: Thomas Lamprecht <t.lamprecht at proxmox.com>
---
 src/PVE/LXC.pm | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/PVE/LXC.pm b/src/PVE/LXC.pm
index b2f2c13..32b0318 100644
--- a/src/PVE/LXC.pm
+++ b/src/PVE/LXC.pm
@@ -22,6 +22,7 @@ use PVE::CpuSet;
 use PVE::Network;
 use PVE::AccessControl;
 use PVE::ProcFSTools;
+use PVE::Syscall;
 use PVE::LXC::Config;
 use Time::HiRes qw (gettimeofday);
 
@@ -1102,9 +1103,8 @@ sub __bindmount_verify {
 	die "failed to open mount point: $!\n" if !$destdh;
 	if ($ro) {
 	    my $dot = '.';
-	    # 269: faccessat()
 	    # no separate function because 99% of the time it's the wrong thing to use.
-	    if (syscall(269, fileno($destdh), $dot, &POSIX::W_OK, 0) != -1) {
+	    if (syscall(PVE::Syscall::faccessat, fileno($destdh), $dot, &POSIX::W_OK, 0) != -1) {
 		die "failed to mark bind mount read only\n";
 	    }
 	    die "read-only check failed: $!\n" if $! != EROFS;
-- 
2.11.0





More information about the pve-devel mailing list