]> git.ipfire.org Git - thirdparty/public-inbox.git/commitdiff
inotify: don't load Linux::Inotify2 if pure Perl is usable
authorEric Wong <e@80x24.org>
Tue, 23 Jul 2024 22:07:00 +0000 (22:07 +0000)
committerEric Wong <e@80x24.org>
Wed, 24 Jul 2024 20:54:08 +0000 (20:54 +0000)
No need to bring systems closer to the vm.max_map_count limit
with more .so objects loaded.

lib/PublicInbox/Inotify.pm

index c4f1ae842f23000865d8066e55120dd6a5bbd6f1..5553c6436cd55317f8ec8f9c3d2aed7f24250188 100644 (file)
@@ -1,7 +1,7 @@
 # Copyright (C) all contributors <meta@public-inbox.org>
 # License: AGPL-3.0+ <https://www.gnu.org/licenses/agpl-3.0.txt>
 
-# 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 $@;