git: 4d505c3343bb - main - devel/compdbgen: Fix build on FreeBSD 13

From: Joseph Mingrone <jrm_at_FreeBSD.org>
Date: Sun, 14 Sep 2025 21:08:22 UTC
The branch main has been updated by jrm:

URL: https://cgit.FreeBSD.org/ports/commit/?id=4d505c3343bb209496f5313b0f01b88cd7299f40

commit 4d505c3343bb209496f5313b0f01b88cd7299f40
Author:     Joseph Mingrone <jrm@FreeBSD.org>
AuthorDate: 2025-09-14 21:05:59 +0000
Commit:     Joseph Mingrone <jrm@FreeBSD.org>
CommitDate: 2025-09-14 21:05:59 +0000

    devel/compdbgen: Fix build on FreeBSD 13
    
    The syscallarg_t type was added to FreeBSD in b1ad6a9000c3, which is not
    present in any FreeBSD 13 release.  Use register_t in place of
    syscallarg_t when building on FreeBSD 13.
    
    Sponsored by:   The FreeBSD Foundation
---
 devel/compdbgen/Makefile                     |  6 +++++
 devel/compdbgen/files/extra-patch-mainloop.c | 35 ++++++++++++++++++++++++++++
 2 files changed, 41 insertions(+)

diff --git a/devel/compdbgen/Makefile b/devel/compdbgen/Makefile
index 9d4717eedd7e..fad3099fd807 100644
--- a/devel/compdbgen/Makefile
+++ b/devel/compdbgen/Makefile
@@ -22,4 +22,10 @@ do-build:
 do-install:
 		${INSTALL_PROGRAM} ${WRKSRC}/${PORTNAME} ${STAGEDIR}${PREFIX}/bin
 
+.include <bsd.port.options.mk>
+
+.if ${OPSYS} == FreeBSD && ${OSVERSION} < 1400000
+EXTRA_PATCHES=	${PATCHDIR}/extra-patch-mainloop.c
+.endif
+
 .include <bsd.port.mk>
diff --git a/devel/compdbgen/files/extra-patch-mainloop.c b/devel/compdbgen/files/extra-patch-mainloop.c
new file mode 100644
index 000000000000..33a01eecebac
--- /dev/null
+++ b/devel/compdbgen/files/extra-patch-mainloop.c
@@ -0,0 +1,35 @@
+--- mainloop.c.orig	2025-09-11 04:56:11 UTC
++++ mainloop.c
+@@ -433,20 +433,32 @@ static void enter_syscall(struct glbctx *info, struct 
+   static int json_item_cnt = 0;
+   struct syscall *sc;
+   u_int i, narg;
++#if defined(__FreeBSD_version) && __FreeBSD_version < 1400000
++  register_t *args;
++#else
+   syscallarg_t *args;
++#endif
+ 
+   /* ignore other syscall except execve */
+   if (pl->pl_syscall_code != SYS_execve) {
+     return;
+   }
+ 
++#if defined(__FreeBSD_version) && __FreeBSD_version < 1400000
++  args = calloc(pl->pl_syscall_narg, sizeof(register_t));
++#else
+   args = calloc(pl->pl_syscall_narg, sizeof(syscallarg_t));
++#endif
+   if (args == NULL) {
+     err(1, "malloc syscall args failed\n");
+   }
+ 
+   if (ptrace(PT_GET_SC_ARGS, t->tid, (caddr_t)args,
++#if defined(__FreeBSD_version) && __FreeBSD_version < 1400000
++             sizeof(register_t) * pl->pl_syscall_narg) != 0) {
++#else
+              sizeof(syscallarg_t) * pl->pl_syscall_narg) != 0) {
++#endif
+     goto _EXIT;
+   }
+