plugin_services: scope the systemd and procfs collectors to Linux so the macOS slice is clean
AuthorPico <picobot@scorpioplayer.com>
Date2026-11-12 08:39:53
Commitb5c52c51
Parentsee801fe7
Changed files
src/plugin_services.c+8−4■■■■■
1 file+8−4
Diff
src/plugin_services.c+8−4■■■■■
index deadf80..7451e97 100644
--- a/src/plugin_services.c
+++ b/src/plugin_services.c
@@ -388,8 +388,9 @@ static svc_t *svc_find(const char *name)
388388 /* ------------------------------------------------------------------ */
389389 /* Minimal JSON field extraction (for systemctl --output=json output) */
390390 /* ------------------------------------------------------------------ */
391-/* The JSON readers and the systemd/launchd parsers are POSIX-only: the
392- * Windows slice talks to the SCM directly and never parses text. */
391+/* The JSON readers and the text parsers are POSIX-only: the Windows slice
392+ * talks to the SCM directly and never parses text. The systemd half is Linux
393+ * only, because macOS has launchd and needs none of it. */
393394 #if !defined(_WIN32)
394395
395396 static int json_read_string_at(const char **pp, char *out, size_t outsz)
@@ -679,6 +680,7 @@ static void apply_show(const char *text)
679680 }
680681
681682 /* Containers with no init system: list /proc/<pid> long-running daemons. */
683+#if !defined(__APPLE__)
682684 static int collect_proc_daemons(void)
683685 {
684686 const char *root = getenv("SERVICES_MOCK_PROC_DIR");
@@ -825,7 +827,9 @@ static void collect_systemd(void)
825827 }
826828 }
827829
828-#endif /* !_WIN32 */
830+#endif /* !_WIN32 || !__APPLE__ */
831+
832+#endif /* !__APPLE__ */
829833
830834 /* ------------------------------------------------------------------ */
831835 /* Collection: launchd (macOS) */
@@ -1064,7 +1068,7 @@ static const char *init_name(void)
10641068 static void collect_all(void)
10651069 {
10661070 const char *allow = getenv("SERVICES_ALLOW_CONTROL");
1067-#if !defined(_WIN32)
1071+#if defined(__linux__)
10681072 const char *force = getenv("SERVICES_FORCE_INIT");
10691073 #endif
10701074
10711075
src/plugin_services.c+8−4■■■■■
index deadf80..7451e97 100644index deadf80..7451e97 100644
--- a/src/plugin_services.c--- a/src/plugin_services.c
+++ b/src/plugin_services.c+++ b/src/plugin_services.c
@@ -388,8 +388,9 @@ static svc_t *svc_find(const char *name)@@ -388,8 +388,9 @@ static svc_t *svc_find(const char *name)
388 /* ------------------------------------------------------------------ */388 /* ------------------------------------------------------------------ */
389 /* Minimal JSON field extraction (for systemctl --output=json output) */389 /* Minimal JSON field extraction (for systemctl --output=json output) */
390 /* ------------------------------------------------------------------ */390 /* ------------------------------------------------------------------ */
391-/* The JSON readers and the systemd/launchd parsers are POSIX-only: the391+/* The JSON readers and the text parsers are POSIX-only: the Windows slice
392- * Windows slice talks to the SCM directly and never parses text. */392+ * talks to the SCM directly and never parses text. The systemd half is Linux
393+ * only, because macOS has launchd and needs none of it. */
393 #if !defined(_WIN32)394 #if !defined(_WIN32)
394 395
395 static int json_read_string_at(const char **pp, char *out, size_t outsz)396 static int json_read_string_at(const char **pp, char *out, size_t outsz)
@@ -679,6 +680,7 @@ static void apply_show(const char *text)@@ -679,6 +680,7 @@ static void apply_show(const char *text)
679 }680 }
680 681
681 /* Containers with no init system: list /proc/<pid> long-running daemons. */682 /* Containers with no init system: list /proc/<pid> long-running daemons. */
683+#if !defined(__APPLE__)
682 static int collect_proc_daemons(void)684 static int collect_proc_daemons(void)
683 {685 {
684 const char *root = getenv("SERVICES_MOCK_PROC_DIR");686 const char *root = getenv("SERVICES_MOCK_PROC_DIR");
@@ -825,7 +827,9 @@ static void collect_systemd(void)@@ -825,7 +827,9 @@ static void collect_systemd(void)
825 }827 }
826 }828 }
827 829
828-#endif /* !_WIN32 */830+#endif /* !_WIN32 || !__APPLE__ */
831+
832+#endif /* !__APPLE__ */
829 833
830 /* ------------------------------------------------------------------ */834 /* ------------------------------------------------------------------ */
831 /* Collection: launchd (macOS) */835 /* Collection: launchd (macOS) */
@@ -1064,7 +1068,7 @@ static const char *init_name(void)@@ -1064,7 +1068,7 @@ static const char *init_name(void)
1064 static void collect_all(void)1068 static void collect_all(void)
1065 {1069 {
1066 const char *allow = getenv("SERVICES_ALLOW_CONTROL");1070 const char *allow = getenv("SERVICES_ALLOW_CONTROL");
1067-#if !defined(_WIN32)1071+#if defined(__linux__)
1068 const char *force = getenv("SERVICES_FORCE_INIT");1072 const char *force = getenv("SERVICES_FORCE_INIT");
1069 #endif1073 #endif
1070 1074
10711075