You've already forked ZygiskNext
mirror of
https://github.com/Dr-TSNG/ZygiskNext.git
synced 2025-08-27 23:46:34 +00:00
separate error info and normal info of daemons
This commit is contained in:
@@ -13,6 +13,8 @@ enum Command {
|
||||
ZYGOTE32_INJECTED = 5,
|
||||
DAEMON64_SET_INFO = 6,
|
||||
DAEMON32_SET_INFO = 7,
|
||||
DAEMON64_SET_ERROR_INFO = 8,
|
||||
DAEMON32_SET_ERROR_INFO = 9,
|
||||
};
|
||||
|
||||
void send_control_command(Command cmd);
|
||||
|
||||
@@ -121,6 +121,7 @@ struct Status {
|
||||
bool daemon_running = false;
|
||||
pid_t daemon_pid = -1;
|
||||
std::string daemon_info;
|
||||
std::string daemon_error_info;
|
||||
};
|
||||
|
||||
static Status status64;
|
||||
@@ -246,6 +247,18 @@ struct SocketHandler : public EventHandler {
|
||||
status32.daemon_info = std::string(msg.data);
|
||||
updateStatus();
|
||||
break;
|
||||
case DAEMON64_SET_ERROR_INFO:
|
||||
LOGD("received daemon64 error info %s", msg.data);
|
||||
status64.daemon_running = false;
|
||||
status64.daemon_error_info = std::string(msg.data);
|
||||
updateStatus();
|
||||
break;
|
||||
case DAEMON32_SET_ERROR_INFO:
|
||||
LOGD("received daemon32 error info %s", msg.data);
|
||||
status32.daemon_running = false;
|
||||
status32.daemon_error_info = std::string(msg.data);
|
||||
updateStatus();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -385,8 +398,8 @@ public:
|
||||
auto status_str = parse_status(status); \
|
||||
LOGW("daemon" #abi "pid %d exited: %s", pid, status_str.c_str()); \
|
||||
status##abi.daemon_running = false; \
|
||||
if (status##abi.daemon_info.empty()) { \
|
||||
status##abi.daemon_info = status_str; \
|
||||
if (status##abi.daemon_error_info.empty()) { \
|
||||
status##abi.daemon_error_info = status_str; \
|
||||
} \
|
||||
updateStatus(); \
|
||||
continue; \
|
||||
@@ -506,14 +519,20 @@ static void updateStatus() {
|
||||
else if (status##suffix.zygote_injected) status_text += "😋injected,"; \
|
||||
else status_text += "❌not injected,"; \
|
||||
status_text += " daemon" #suffix ":"; \
|
||||
if (status##suffix.daemon_running) status_text += "😋running"; \
|
||||
else { \
|
||||
if (status##suffix.daemon_running) { \
|
||||
status_text += "😋running"; \
|
||||
if (!status##suffix.daemon_info.empty()) { \
|
||||
status_text += "("; \
|
||||
status_text += status##suffix.daemon_info; \
|
||||
status_text += ")"; \
|
||||
} \
|
||||
} else { \
|
||||
status_text += "❌crashed"; \
|
||||
} \
|
||||
if (!status##suffix.daemon_info.empty()) { \
|
||||
status_text += "("; \
|
||||
status_text += status##suffix.daemon_info; \
|
||||
status_text += ")"; \
|
||||
if (!status##suffix.daemon_error_info.empty()) { \
|
||||
status_text += "("; \
|
||||
status_text += status##suffix.daemon_error_info; \
|
||||
status_text += ")"; \
|
||||
} \
|
||||
} \
|
||||
}
|
||||
WRITE_STATUS_ABI(64)
|
||||
|
||||
@@ -27,6 +27,7 @@ pub const PATH_PT_BIN32: &str = "bin/zygisk-ptracer32";
|
||||
pub const PATH_PT_BIN64: &str = "bin/zygisk-ptracer64";
|
||||
pub const ZYGOTE_INJECTED: i32 = lp_select!(5, 4);
|
||||
pub const DAEMON_SET_INFO: i32 = lp_select!(7, 6);
|
||||
pub const DAEMON_SET_ERROR_INFO: i32 = lp_select!(9, 8);
|
||||
|
||||
pub const MAX_RESTART_COUNT: i32 = 5;
|
||||
|
||||
|
||||
@@ -42,14 +42,15 @@ pub fn main() -> Result<()> {
|
||||
|
||||
{
|
||||
let mut msg = Vec::<u8>::new();
|
||||
msg.extend_from_slice(&constants::DAEMON_SET_INFO.to_le_bytes());
|
||||
let info = match root_impl::get_impl() {
|
||||
root_impl::RootImpl::KernelSU | root_impl::RootImpl::Magisk => {
|
||||
msg.extend_from_slice(&constants::DAEMON_SET_INFO.to_le_bytes());
|
||||
let module_names: Vec<_> = modules.iter()
|
||||
.map(|m| m.name.as_str()).collect();
|
||||
format!("Root: {:?},module({}): {}", root_impl::get_impl(), modules.len(), module_names.join(","))
|
||||
}
|
||||
_ => {
|
||||
msg.extend_from_slice(&constants::DAEMON_SET_ERROR_INFO.to_le_bytes());
|
||||
format!("Invalid root implementation: {:?}", root_impl::get_impl())
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user