* [PATCH 04/10] update devel/syscall-list to devel/sysdefs-list
2023-09-04 10:35 7% [PATCH 00/10] signal-handling and *BSD fixes Eric Wong
@ 2023-09-04 10:36 5% ` Eric Wong
0 siblings, 0 replies; 2+ results
From: Eric Wong @ 2023-09-04 10:36 UTC (permalink / raw)
To: meta
We use it to dump SIGWINCH and _SC_NPROCESSORS_ONLN, so
"sysdefs" is a more appropriate list for *BSD users.
---
MANIFEST | 2 +-
devel/{syscall-list => sysdefs-list} | 47 +++++++++++++++-------------
lib/PublicInbox/Syscall.pm | 7 +++--
3 files changed, 30 insertions(+), 26 deletions(-)
rename devel/{syscall-list => sysdefs-list} (60%)
diff --git a/MANIFEST b/MANIFEST
index 918ec2e1..5964794e 100644
--- a/MANIFEST
+++ b/MANIFEST
@@ -123,7 +123,7 @@ contrib/selinux/el7/publicinbox.fc
contrib/selinux/el7/publicinbox.te
devel/README
devel/longest-tests
-devel/syscall-list
+devel/sysdefs-list
examples/README
examples/README.unsubscribe
examples/cgit-commit-filter.lua
diff --git a/devel/syscall-list b/devel/sysdefs-list
similarity index 60%
rename from devel/syscall-list
rename to devel/sysdefs-list
index 0b36c0e2..9764cc29 100755
--- a/devel/syscall-list
+++ b/devel/sysdefs-list
@@ -1,31 +1,37 @@
# Copyright all contributors <meta@public-inbox.org>
# License: AGPL-3.0+ <http://www.gnu.org/licenses/agpl-3.0.txt>
-# Dump syscall numbers under Linux and any other kernel which
-# promises stable syscall numbers. This is to maintain
-# PublicInbox::Syscall
-# DO NOT USE this for *BSDs, none of the current BSD kernels
-# we know about promise stable syscall numbers, we'll use
-# Inline::C to support them.
+# Dump system-specific constant numbers this is to maintain
+# PublicInbox::Syscall and any other system-specific pieces.
+# DO NOT USE syscall numbers for *BSDs, none of the current BSD kernels
+# we know about promise stable syscall numbers (unlike Linux).
+# However, sysconf(3) constants are stable ABI on all safe to dump.
eval 'exec perl -S $0 ${1+"$@"}' # no shebang
if 0; # running under some shell
-use strict;
-use v5.10.1;
+use v5.12;
use File::Temp 0.19;
use POSIX qw(uname);
+use Config;
say '$machine='.(POSIX::uname())[-1];
-my $cc = $ENV{CC} // 'cc';
-my @cflags = split(/\s+/, $ENV{CFLAGS} // '-Wall');
+my $cc = $ENV{CC} // $Config{cc} // 'cc';
+my @cflags = split(/\s+/, $ENV{CFLAGS} // $Config{ccflags} // '-Wall');
my $str = do { local $/; <DATA> };
-my $tmp = File::Temp->newdir('syscall-list-XXXX', TMPDIR => 1);
-my $f = "$tmp/sc.c";
-my $x = "$tmp/sc";
+$str =~ s/^\s*MAYBE\s*(\w+)\s*$/
+#ifdef $1
+ D($1);
+#endif
+/sgxm;
+my $tmp = File::Temp->newdir('sysdefs-list-XXXX', TMPDIR => 1);
+my $f = "$tmp/sysdefs.c";
+my $x = "$tmp/sysdefs";
open my $fh, '>', $f or die "open $f $!";
print $fh $str or die "print $f $!";
close $fh or die "close $f $!";
-system($cc, '-o', $x, $f, @cflags) == 0 or die "cc failed \$?=$?";
+system($cc, '-o', $x, $f, @cflags) == 0 or die "$cc failed \$?=$?";
exec($x);
__DATA__
-#define _GNU_SOURCE
+#ifndef _GNU_SOURCE
+# define _GNU_SOURCE
+#endif
#include <signal.h>
#include <sys/syscall.h>
#include <sys/ioctl.h>
@@ -43,9 +49,7 @@ int main(void)
#ifdef __linux__
D(SYS_epoll_create1);
D(SYS_epoll_ctl);
-#ifdef SYS_epoll_wait
- D(SYS_epoll_wait);
-#endif
+ MAYBE SYS_epoll_wait
D(SYS_epoll_pwait);
D(SYS_signalfd4);
D(SYS_inotify_init1);
@@ -59,13 +63,12 @@ int main(void)
printf("FS_IOC_GETFLAGS=%#lx\nFS_IOC_SETFLAGS=%#lx\n",
(unsigned long)FS_IOC_GETFLAGS, (unsigned long)FS_IOC_SETFLAGS);
#endif
-
-#ifdef SYS_renameat2
- D(SYS_renameat2);
-#endif
+ MAYBE SYS_renameat2
#endif /* Linux, any other OSes with stable syscalls? */
printf("size_t=%zu off_t=%zu pid_t=%zu\n",
sizeof(size_t), sizeof(off_t), sizeof(pid_t));
D(SIGWINCH);
+ MAYBE _SC_NPROCESSORS_ONLN
+
return 0;
}
diff --git a/lib/PublicInbox/Syscall.pm b/lib/PublicInbox/Syscall.pm
index 841a2106..4609b32d 100644
--- a/lib/PublicInbox/Syscall.pm
+++ b/lib/PublicInbox/Syscall.pm
@@ -2,7 +2,7 @@
# specifically the Debian libsys-syscall-perl 0.25-6 version to
# fix upstream regressions in 0.25.
#
-# See devel/syscall-list in the public-inbox source tree for maintenance
+# See devel/sysdefs-list in the public-inbox source tree for maintenance
# <https://80x24.org/public-inbox.git>, and machines from the GCC Farm:
# <https://cfarm.tetaneutral.net/>
#
@@ -246,7 +246,7 @@ if ($^O eq "linux") {
warn <<EOM;
machine=$machine ptrsize=$Config{ptrsize} has no syscall definitions
git clone https://80x24.org/public-inbox.git and
-Send the output of ./devel/syscall-list to meta\@public-inbox.org
+Send the output of ./devel/sysdefs-list to meta\@public-inbox.org
EOM
}
if ($u64_mod_8) {
@@ -259,7 +259,8 @@ EOM
}
# use Inline::C for *BSD-only or general POSIX stuff.
# Linux guarantees stable syscall numbering, BSDs only offer a stable libc
-# use devel/syscall-list on Linux to detect new syscall numbers
+# use devel/sysdefs-list on Linux to detect new syscall numbers and
+# other system constants
############################################################################
# epoll functions
^ permalink raw reply related [relevance 5%]
* [PATCH 00/10] signal-handling and *BSD fixes
@ 2023-09-04 10:35 7% Eric Wong
2023-09-04 10:36 5% ` [PATCH 04/10] update devel/syscall-list to devel/sysdefs-list Eric Wong
0 siblings, 1 reply; 2+ results
From: Eric Wong @ 2023-09-04 10:35 UTC (permalink / raw)
To: meta
kevent EVFILT_SIGNAL behaves differently than Linux signalfd
in that we can't rely on it to handle signals that were sent
before the existence of the kevent filter. Thus, [5/10] opens
a window before entering the event.
This difference between OSes was noticed due to lei tests
quickly starting read-only daemons and terminating them before
signal handlers were setup properly from the lack of
SCM_RIGHTS support on *BSDs lacking Inline::C.
Nevertheless [9/10] improves test dependency management to
ensure read-only daemons don't start all when SCM_RIGHTS
support is unavailable.
Patch [10/10] was originally far more aggressive in that it
kept all signals blocked across execve, but that's probably
unrealistic for real-world scenarios
7/10 to add TTOU/TTIN support to xap_helper was actually
the first developed in this series.
Lots more brewing in the portability department...
Eric Wong (10):
ds: don't block important signals we don't use
t/sigfd: test EVFILT_SIGNAL vs signalfd differences
t/sigfd: better checks related to SIGWINCH
update devel/syscall-list to devel/sysdefs-list
daemon: workaround pre-EVFILT_SIGNAL signals
watch: ensure children can use signal handlers
xap_helper: support SIGTTIN+SIGTTOU worker adjustments
xap_helper.h: include signal.h for sig* functions
tests: add `+SCM_RIGHTS' as a require_mods target
test_common: start_script: set default signals
MANIFEST | 2 +-
devel/{syscall-list => sysdefs-list} | 47 ++---
lib/PublicInbox/DS.pm | 38 +++-
lib/PublicInbox/IPC.pm | 2 +-
lib/PublicInbox/Sigfd.pm | 3 +-
lib/PublicInbox/Syscall.pm | 7 +-
lib/PublicInbox/TestCommon.pm | 26 ++-
lib/PublicInbox/Watch.pm | 7 +-
lib/PublicInbox/XapHelper.pm | 103 +++++++---
lib/PublicInbox/xap_helper.h | 283 +++++++++++++++++++++++----
script/public-inbox-watch | 4 +-
t/lei-import-nntp.t | 4 +-
t/lei.t | 3 +-
t/sigfd.t | 28 ++-
t/xap_helper.t | 59 ++++--
15 files changed, 489 insertions(+), 127 deletions(-)
rename devel/{syscall-list => sysdefs-list} (60%)
^ permalink raw reply [relevance 7%]
Results 1-2 of 2 | reverse | options above
-- pct% links below jump to the message on this page, permalinks otherwise --
2023-09-04 10:35 7% [PATCH 00/10] signal-handling and *BSD fixes Eric Wong
2023-09-04 10:36 5% ` [PATCH 04/10] update devel/syscall-list to devel/sysdefs-list Eric Wong
Code repositories for project(s) associated with this public inbox
https://80x24.org/public-inbox.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).