From a36980b20c91e879fbd20ceb4b2dd1b7adca30f6 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Tue, 23 Jul 2024 22:07:00 +0000 Subject: [PATCH] inotify: don't load Linux::Inotify2 if pure Perl is usable No need to bring systems closer to the vm.max_map_count limit with more .so objects loaded. --- lib/PublicInbox/Inotify.pm | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/PublicInbox/Inotify.pm b/lib/PublicInbox/Inotify.pm index c4f1ae842..5553c6436 100644 --- a/lib/PublicInbox/Inotify.pm +++ b/lib/PublicInbox/Inotify.pm @@ -1,7 +1,7 @@ # Copyright (C) all contributors # License: AGPL-3.0+ -# wrap Linux::Inotify2 XS module, support pure Perl via `syscall' someday +# loads either pure Perl inotify support or wrap Linux::Inotify2 XS module package PublicInbox::Inotify; use v5.12; our @ISA; @@ -11,13 +11,14 @@ BEGIN { # prefer pure Perl since it works out-of-the-box eval "require $m"; next if $@; $isa = $m; + last; } if ($isa) { push @ISA, $isa; my $buf = ''; for (qw(IN_MOVED_TO IN_CREATE IN_DELETE IN_DELETE_SELF IN_MOVE_SELF IN_MOVED_FROM IN_MODIFY)) { - $buf .= "*$_ = \\&PublicInbox::Inotify3::$_;\n"; + $buf .= "*$_ = \\&${isa}::$_;\n"; } eval $buf; die $@ if $@; -- 2.47.2