From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: X-Spam-Status: No, score=-3.8 required=3.0 tests=ALL_TRUSTED,AWL,BAYES_00, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id C83A91FAFA for ; Mon, 28 Nov 2022 05:32:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=80x24.org; s=selector1; t=1669613554; bh=0IBzXn4gAx/DaruKEi4TujJaspsQGGKV4Qz6ojglIp8=; h=From:To:Subject:Date:In-Reply-To:References:From; b=LEkm7E+zbv+5C9b0k6uKDux3CFE/JICPrGaKyjQG4Gj/Atm98sbaBeDrPC9SAGG36 rPF+43SRvUk5N9ESCO4t+IXB26IRpu6T5+gSeSghHUtGpqPP+xSkVp2nMyVDSqS+ch vhXyjPrsqDYVpJcrq4PT99erHmHSRE10aID8PIz8= From: Eric Wong To: meta@public-inbox.org Subject: [PATCH 11/95] switch inotify/kevent stuff to v5.12 Date: Mon, 28 Nov 2022 05:31:08 +0000 Message-Id: <20221128053232.291618-12-e@80x24.org> In-Reply-To: <20221128053232.291618-1-e@80x24.org> References: <20221128053232.291618-1-e@80x24.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: Another tiny step towards an eventual startup time improvements by avoiding strict.pm --- lib/PublicInbox/DSKQXS.pm | 5 ++--- lib/PublicInbox/DirIdle.pm | 4 ++-- lib/PublicInbox/FakeInotify.pm | 13 ++++++------- lib/PublicInbox/In2Tie.pm | 4 ++-- lib/PublicInbox/InboxIdle.pm | 2 +- lib/PublicInbox/KQNotify.pm | 12 +++++------- 6 files changed, 18 insertions(+), 22 deletions(-) diff --git a/lib/PublicInbox/DSKQXS.pm b/lib/PublicInbox/DSKQXS.pm index 7141b131..cb035bd5 100644 --- a/lib/PublicInbox/DSKQXS.pm +++ b/lib/PublicInbox/DSKQXS.pm @@ -1,4 +1,4 @@ -# Copyright (C) 2019-2021 all contributors +# Copyright (C) all contributors # Licensed the same as Danga::Socket (and Perl5) # License: GPL-1.0+ or Artistic-1.0-Perl # @@ -11,8 +11,7 @@ # # It also implements signalfd(2) emulation via "tie". package PublicInbox::DSKQXS; -use strict; -use warnings; +use v5.12; use parent qw(Exporter); use Symbol qw(gensym); use IO::KQueue; diff --git a/lib/PublicInbox/DirIdle.pm b/lib/PublicInbox/DirIdle.pm index 9206da9c..55c3982f 100644 --- a/lib/PublicInbox/DirIdle.pm +++ b/lib/PublicInbox/DirIdle.pm @@ -1,9 +1,9 @@ -# Copyright (C) 2020-2021 all contributors +# Copyright (C) all contributors # License: AGPL-3.0+ # Used by public-inbox-watch for Maildir (and possibly MH in the future) package PublicInbox::DirIdle; -use strict; +use v5.12; use parent 'PublicInbox::DS'; use PublicInbox::Syscall qw(EPOLLIN); use PublicInbox::In2Tie; diff --git a/lib/PublicInbox/FakeInotify.pm b/lib/PublicInbox/FakeInotify.pm index 6d269601..45b80f50 100644 --- a/lib/PublicInbox/FakeInotify.pm +++ b/lib/PublicInbox/FakeInotify.pm @@ -1,11 +1,10 @@ -# Copyright (C) 2020-2021 all contributors +# Copyright (C) all contributors # License: AGPL-3.0+ # for systems lacking Linux::Inotify2 or IO::KQueue, just emulates # enough of Linux::Inotify2 package PublicInbox::FakeInotify; -use strict; -use v5.10.1; +use v5.12; use parent qw(Exporter); use Time::HiRes qw(stat); use PublicInbox::DS qw(add_timer); @@ -119,7 +118,7 @@ sub poll_once { } package PublicInbox::FakeInotify::Watch; -use strict; +use v5.12; sub cancel { my ($self) = @_; @@ -132,7 +131,7 @@ sub name { } package PublicInbox::FakeInotify::Event; -use strict; +use v5.12; sub fullname { ${$_[0]} } @@ -141,14 +140,14 @@ sub IN_MOVED_FROM { 0 } sub IN_DELETE_SELF { 0 } package PublicInbox::FakeInotify::GoneEvent; -use strict; +use v5.12; our @ISA = qw(PublicInbox::FakeInotify::Event); sub IN_DELETE { 1 } sub IN_MOVED_FROM { 0 } package PublicInbox::FakeInotify::SelfGoneEvent; -use strict; +use v5.12; our @ISA = qw(PublicInbox::FakeInotify::GoneEvent); sub IN_DELETE_SELF { 1 } diff --git a/lib/PublicInbox/In2Tie.pm b/lib/PublicInbox/In2Tie.pm index ffe26a44..3689432b 100644 --- a/lib/PublicInbox/In2Tie.pm +++ b/lib/PublicInbox/In2Tie.pm @@ -1,10 +1,10 @@ -# Copyright (C) 2020-2021 all contributors +# Copyright (C) all contributors # License: AGPL-3.0+ # used to ensure PublicInbox::DS can call fileno() as a function # on Linux::Inotify2 objects package PublicInbox::In2Tie; -use strict; +use v5.12; use Symbol qw(gensym); sub io { diff --git a/lib/PublicInbox/InboxIdle.pm b/lib/PublicInbox/InboxIdle.pm index 005e2636..f0d8a972 100644 --- a/lib/PublicInbox/InboxIdle.pm +++ b/lib/PublicInbox/InboxIdle.pm @@ -5,7 +5,7 @@ # inot: Linux::Inotify2-like object # pathmap => { inboxdir => [ ibx, watch1, watch2, watch3... ] } mapping package PublicInbox::InboxIdle; -use strict; +use v5.12; use parent qw(PublicInbox::DS); use PublicInbox::Syscall qw(EPOLLIN); my $IN_MODIFY = 0x02; # match Linux inotify diff --git a/lib/PublicInbox/KQNotify.pm b/lib/PublicInbox/KQNotify.pm index 7efb8b60..381711fa 100644 --- a/lib/PublicInbox/KQNotify.pm +++ b/lib/PublicInbox/KQNotify.pm @@ -1,11 +1,10 @@ -# Copyright (C) 2020-2021 all contributors +# Copyright (C) all contributors # License: AGPL-3.0+ # implements the small subset of Linux::Inotify2 functionality we use # using IO::KQueue on *BSD systems. package PublicInbox::KQNotify; -use strict; -use v5.10.1; +use v5.12; use IO::KQueue; use PublicInbox::DSKQXS; # wraps IO::KQueue for fork-safe DESTROY use PublicInbox::FakeInotify qw(fill_dirlist on_dir_change); @@ -29,8 +28,7 @@ sub watch { 'PublicInbox::KQNotify::Watchdir'; } else { open($fh, '<', $path) or return; - $watch = bless [ $fh, $path ], - 'PublicInbox::KQNotify::Watch'; + $watch = bless [ $fh, $path ], 'PublicInbox::KQNotify::Watch'; } my $ident = fileno($fh); $self->{dskq}->{kq}->EV_SET($ident, # ident (fd) @@ -100,14 +98,14 @@ sub read { } package PublicInbox::KQNotify::Watch; -use strict; +use v5.12; sub name { $_[0]->[1] } sub cancel { close $_[0]->[0] or die "close: $!" } package PublicInbox::KQNotify::Watchdir; -use strict; +use v5.12; sub name { $_[0]->[1] }