Blame patches/busybox/nativekill.patch

f54502
diff -ru busybox-1.35.0.orig/procps/kill.c busybox-1.35.0/procps/kill.c
f54502
--- busybox-1.35.0.orig/procps/kill.c	2021-12-26 17:53:21.000000000 +0100
f54502
+++ busybox-1.35.0/procps/kill.c	2022-02-05 22:46:30.981801454 +0100
f54502
@@ -189,6 +189,29 @@
f54502
 	if (is_killall5 && arg[0] == 'o')
f54502
 		goto do_it_now;
f54502
 
f54502
+#if ENABLE_KILL && defined(__midipix__)
f54502
+	extern intptr_t __sys_dbg_kill(int pfd);
f54502
+	extern intptr_t __sys_dbg_attach(pid_t pid);
f54502
+
f54502
+	/* -n PID (native PID) */
f54502
+	if (arg[0] == 'n') {
f54502
+		arg = *++argv;
f54502
+		if(!arg) {
f54502
+			bb_error_msg("-n requires a PID argument");
f54502
+			return EXIT_FAILURE;
f54502
+		}
f54502
+		pid = bb_strtoi(arg, NULL, 10);
f54502
+		if (errno) {
f54502
+			bb_error_msg("invalid number '%s'", arg);
f54502
+			return EXIT_FAILURE;
f54502
+		} else if ((__sys_dbg_kill(__sys_dbg_attach(pid))) != 0) {
f54502
+			bb_perror_msg("can't kill native pid %d", (int)pid);
f54502
+			return EXIT_FAILURE;
f54502
+		}
f54502
+		return EXIT_SUCCESS;
f54502
+	}
f54502
+#endif
f54502
+
f54502
 	/* "--" separates options from args. Testcase: "kill -- -123" */
f54502
 	if (!is_killall5 && arg[0] == '-' && arg[1] == '\0')
f54502
 		goto do_it_sooner;