This diff patches out mono's use of syscall(SYS_fork), which is the
only instance of syscall(2) in use. Upstream has this behind:
#elif !defined(HOST_DARWIN) && defined(SYS_fork)
This diff changes that to #elif defined(__linux__)... and as a
consequence, fork(2) is simply used.
With this patched, none of the mono binaries I looked at (mono,
mono-sgen, monodis) or shared objects have any reference to syscall(2)
anymore.
ok?
Index: Makefile
===================================================================
RCS file: /cvs/ports/lang/mono/Makefile,v
retrieving revision 1.156
diff -u -p -r1.156 Makefile
--- Makefile 26 Sep 2023 12:02:02 -0000 1.156
+++ Makefile 28 Oct 2023 01:45:11 -0000
@@ -6,7 +6,7 @@ COMMENT= cross platform, open source .NE
V= 6.12.0.199
DISTNAME= mono-${V}
-REVISION= 1
+REVISION= 2
CATEGORIES= lang devel
Index: patches/patch-mono_mini_mini-posix_c
===================================================================
RCS file: patches/patch-mono_mini_mini-posix_c
diff -N patches/patch-mono_mini_mini-posix_c
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ patches/patch-mono_mini_mini-posix_c 28 Oct 2023 01:45:12 -0000
@@ -0,0 +1,14 @@
+It is *ONLY* Linux that does special shit in fork(2)
+
+Index: mono/mini/mini-posix.c
+--- mono/mini/mini-posix.c.orig
++++ mono/mini/mini-posix.c
+@@ -940,7 +940,7 @@ fork_crash_safe (void)
+ #if defined(HOST_ANDROID)
+ /* SYS_fork is defined to be __NR_fork which is not defined in some ndk
versions */
+ g_assert_not_reached ();
+-#elif !defined(HOST_DARWIN) && defined(SYS_fork)
++#elif defined(__linux__) && defined(SYS_fork)
+ pid = (pid_t) syscall (SYS_fork);
+ #elif HAVE_FORK
+ pid = (pid_t) fork ();