Thursday, November 02, 2023

Re: bulk without syscall(2) results

Edd Barrett <edd@theunixzoo.co.uk> writes:

> On Thu, Nov 02, 2023 at 05:45:03AM +0100, Theo Buehler wrote:
>> Thanks. The patch makes sense and the warnings on syscall go away.
>> There's now a missing "#include <fcntl.h>" though:
>
> luametatex diff OK for me as long as we fix the implicit def also.

I couldn't resist the temptation to also remove duplication. If people
think this is OK, I'll also push it upstream into mimalloc.

From 7261d4a0ceb87aad060e2b93b0a3d984cf5b22a9 Mon Sep 17 00:00:00 2001
From: Greg Steuck <greg@nest.cx>
Date: Wed, 1 Nov 2023 18:36:57 -0700
Subject: [PATCH] print/luametatex: avoid direct syscall

---
print/luametatex/Makefile | 1 +
...ce_libraries_mimalloc_src_prim_unix_prim_c | 36 +++++++++++++++++++
2 files changed, 37 insertions(+)
create mode 100644 print/luametatex/patches/patch-source_libraries_mimalloc_src_prim_unix_prim_c

diff --git a/print/luametatex/Makefile b/print/luametatex/Makefile
index 7c1e346bd1a..0ba665893c4 100644
--- a/print/luametatex/Makefile
+++ b/print/luametatex/Makefile
@@ -1,6 +1,7 @@
COMMENT = TeX engine for ConTeXt

V = 2.10.08
+REVISION = 0
PKGNAME = luametatex-${V}

GH_ACCOUNT = contextgarden
diff --git a/print/luametatex/patches/patch-source_libraries_mimalloc_src_prim_unix_prim_c b/print/luametatex/patches/patch-source_libraries_mimalloc_src_prim_unix_prim_c
new file mode 100644
index 00000000000..2aa4e62b5ac
--- /dev/null
+++ b/print/luametatex/patches/patch-source_libraries_mimalloc_src_prim_unix_prim_c
@@ -0,0 +1,36 @@
+Use proper libc stubs instead of direct syscalls on OpenBSD
+
+Make #include fcntl.h unconditional to avoid implicit definitions.
+
+Index: source/libraries/mimalloc/src/prim/unix/prim.c
+--- source/libraries/mimalloc/src/prim/unix/prim.c.orig
++++ source/libraries/mimalloc/src/prim/unix/prim.c
+@@ -27,10 +27,10 @@ terms of the MIT license. A copy of the license can be
+
+ #include <sys/mman.h> // mmap
+ #include <unistd.h> // sysconf
++#include <fcntl.h> // open
+
+ #if defined(__linux__)
+ #include <features.h>
+- #include <fcntl.h>
+ #if defined(__GLIBC__)
+ #include <linux/mman.h> // linux mmap flags
+ #else
+@@ -50,7 +50,7 @@ terms of the MIT license. A copy of the license can be
+ #include <sys/sysctl.h>
+

No comments:

Post a Comment