From: Eric Wong Date: Tue, 23 Jul 2024 22:07:00 +0000 (+0000) Subject: inotify: don't load Linux::Inotify2 if pure Perl is usable X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a36980b20c91e879fbd20ceb4b2dd1b7adca30f6;p=thirdparty%2Fpublic-inbox.git 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. --- 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 $@;