about summary refs log tree commit homepage
path: root/devel
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2024-01-29 21:23:19 +0000
committerEric Wong <e@80x24.org>2024-01-30 08:28:45 +0000
commit0a989e8abd36599abe13c36c2b30ab75232f9756 (patch)
tree96729179634660501350bf818dbf1bf5a1a70e9d /devel
parent8c911b8ea278ad36fcff0cee9a8ae3c061bae3ac (diff)
downloadpublic-inbox-0a989e8abd36599abe13c36c2b30ab75232f9756.tar.gz
While syscall symbols (e.g. SYS_*) have changed on us in FreeBSD
during the history of Sys::Syscall and this project and did bite
us in some cases; the actual numbers don't get recycled for new
syscalls.  We're also fortunate that sendmsg and recvmsg syscalls
and associated msghdr and cmsg structs predate the BSD forks and
are compatible across all the BSDs I've tried.

OpenBSD routes Perl `syscall' through libc; while NetBSD + FreeBSD
document procedures for maintaining backwards compatibility.
It looks like Dragonfly follows FreeBSD, here.

Tested on i386 OpenBSD, and amd64 {Free,Net,Open,Dragonfly}BSD

This enables *BSD users to use lei, -cindex and future SCM_RIGHTS-only
features without needing Inline::C.

[1] https://cvsweb.openbsd.org/src/gnu/usr.bin/perl/gen_syscall_emulator.pl
[2] https://www.netbsd.org/docs/internals/en/chap-processes.html#syscall_versioning
[3] https://wiki.freebsd.org/AddingSyscalls#Backward_compatibily
Diffstat (limited to 'devel')
-rwxr-xr-xdevel/sysdefs-list9
1 files changed, 7 insertions, 2 deletions
diff --git a/devel/sysdefs-list b/devel/sysdefs-list
index 61532cf2..ba51de6c 100755
--- a/devel/sysdefs-list
+++ b/devel/sysdefs-list
@@ -2,8 +2,6 @@
 # License: AGPL-3.0+ <http://www.gnu.org/licenses/agpl-3.0.txt>
 # 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
@@ -179,5 +177,12 @@ int main(void)
                 PR_NUM(cmsg_type);
         STRUCT_END;
 
+        {
+                struct cmsghdr cmsg;
+                uintptr_t cmsg_data_off;
+                cmsg_data_off = (uintptr_t)CMSG_DATA(&cmsg) - (uintptr_t)&cmsg;
+                D(cmsg_data_off);
+        }
+
         return 0;
 }