Move daemon utilities from base to core

Move utilities that are exclusively used by the daemon (core module)
from base to core:
- fork_dont_care, fork_no_orphan, new_daemon_thread, init_argv0,
  set_nice_name, and switch_mnt_ns into utils.cpp
- exec_command* functions and exec_t into scripting.cpp as static
  functions, as scripting is their sole consumer

Also remove the unused exec_command_sync overload.

Assisted-by: Gemini 3.8 Flash
This commit is contained in:
topjohnwu
2026-10-02 17:17:48 -07:00
parent 93708e5e73
commit b76d674a60
12 changed files with 183 additions and 188 deletions
+9 -2
View File
@@ -1,9 +1,7 @@
#pragma once
#include <sys/socket.h>
#include <string>
#include <atomic>
#include <functional>
#include <base.hpp>
@@ -33,6 +31,15 @@ struct ModuleInfo;
const char *get_magisk_tmp();
void unlock_blocks();
bool check_key_combo();
int fork_dont_care();
int fork_no_orphan();
int switch_mnt_ns(int pid);
void init_argv0(int argc, char **argv);
void set_nice_name(Utf8CStr name);
using thread_entry = void *(*)(void *);
extern "C" int new_daemon_thread(thread_entry entry, void *arg = nullptr);
template<typename T> requires(std::is_trivially_copyable_v<T>)
T read_any(int fd) {
T val;