From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: X-Spam-Status: No, score=-4.2 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.6 Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id 388B91F44D; Mon, 8 Apr 2024 09:48:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=80x24.org; s=selector1; t=1712569723; bh=zrSwDwR4BJjpjzNgDHYbeAv/fSfScxZzsk1KSwNwjr0=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=t2U3BKMl+SwmfwUcYGhL3pofSSNmSpW1IIm/Q4QET9tDXDtKHfDVDMptlUXCFmO4N Fj2lIXgZaE7Iv4DZOl4jMFMbajKBZOHZrNy+aMIa1nKKAK73bxBn7dQzHMhvl6DX8f CUDxx2dQ1mh6QeBuXVCXT5Yeggzt6Ipi4Uh4mw2E= Date: Mon, 8 Apr 2024 09:48:43 +0000 From: Eric Wong To: Gaelan Steele Cc: meta@public-inbox.org Subject: [RFT] syscall: set default constants for Inline::C platforms Message-ID: <20240408094843.M120440@dcvr> References: <20240129212319.98910-1-e@80x24.org> <20240129212319.98910-3-e@80x24.org> <0C20FAD1-1983-4C38-BB6C-03D9DEFC0D58@icloud.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <0C20FAD1-1983-4C38-BB6C-03D9DEFC0D58@icloud.com> List-Id: Gaelan Steele wrote: > Unfortunately this patch broke public-inbox on Darwin: > > Bareword "SIZEOF_cmsghdr" not allowed while "strict subs" in use at /tmp/public-inbox/lib/PublicInbox/Syscall.pm line 456. > BEGIN not safe after errors--compilation aborted at /tmp/public-inbox/lib/PublicInbox/Syscall.pm line 460. > Compilation failed in require at /tmp/public-inbox/lib/PublicInbox/DS.pm line 31. > BEGIN failed--compilation aborted at /tmp/public-inbox/lib/PublicInbox/DS.pm line 32. > Compilation failed in require at /tmp/public-inbox/lib/PublicInbox/Daemon.pm line 17. > BEGIN failed--compilation aborted at /tmp/public-inbox/lib/PublicInbox/Daemon.pm line 17. > Compilation failed in require at /tmp/public-inbox/script/public-inbox-httpd line 7. > BEGIN failed--compilation aborted at /tmp/public-inbox/script/public-inbox-httpd line 7. > > I’m not enough of a Perl person to fully untangle this. As > best I can tell, the intent is that non-Linux/BSD OSes should > still work with Inline::C, but this doesn’t work in practice > due to a bug? Right. Patch below should fix it, test feedback appreciated. > It may also be possible to use the BSD approach on Darwin - > Darwin ascribes to the BSD school of thought where libc is the > only Officially Stable interface, but if you can get away with > it on the real BSDs maybe you can get away with it on fake BSD > too. NetBSD and FreeBSD both document the underlying syscall numbers remain stable (but not the name => number mapping). OpenBSD has no stable numbering, but goes as far as to patch Perl to route the `syscall' perlop through their libc to avoid breaking Perl scripts. I have no idea if Darwin maintains any stability guarantees at all like the above OSes, so Inline::C may be safer, here. -------8<------- Subject: [PATCH] syscall: set default constants for Inline::C platforms This ought to fix compile errors on platforms we don't explicitly support. Reported-by: Gaelan Steele --- lib/PublicInbox/Syscall.pm | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/PublicInbox/Syscall.pm b/lib/PublicInbox/Syscall.pm index 829cfa3c..99af5bf5 100644 --- a/lib/PublicInbox/Syscall.pm +++ b/lib/PublicInbox/Syscall.pm @@ -317,6 +317,10 @@ BEGIN { ) } $PACK{CMSG_ALIGN_size} = SIZEOF_size_t; + $PACK{SIZEOF_cmsghdr} //= 0; + $PACK{TMPL_cmsg_len} //= undef; + $PACK{CMSG_DATA_off} //= undef; + $PACK{TMPL_msghdr} //= undef; } # SFD_CLOEXEC is arch-dependent, so IN_CLOEXEC may be, too