use /debug_ramdisk

This commit is contained in:
5ec1cff
2024-01-02 18:03:17 +08:00
parent 28f77fa5e2
commit 5c8a67657c
13 changed files with 33 additions and 65 deletions

View File

@@ -32,9 +32,6 @@ struct Context {
pub fn main() -> Result<()> {
log::info!("Welcome to Zygisk Next ({}) !", constants::ZKSU_VERSION);
let magic_path = std::env::var("MAGIC")?;
let controller_path = format!("init_monitor{}", magic_path);
log::info!("socket path {}", controller_path);
let arch = get_arch()?;
log::debug!("Daemon architecture: {arch}");
@@ -57,7 +54,7 @@ pub fn main() -> Result<()> {
msg.extend_from_slice(&(info.len() as u32 + 1).to_le_bytes());
msg.extend_from_slice(info.as_bytes());
msg.extend_from_slice(&[0u8]);
utils::unix_datagram_sendto_abstract(controller_path.as_str(), msg.as_slice()).expect("failed to send info");
utils::unix_datagram_sendto(constants::CONTROLLER_SOCKET, msg.as_slice()).expect("failed to send info");
}
let context = Context {
@@ -74,7 +71,7 @@ pub fn main() -> Result<()> {
match action {
DaemonSocketAction::PingHeartbeat => {
let value = constants::ZYGOTE_INJECTED;
utils::unix_datagram_sendto_abstract(controller_path.as_str(), &value.to_le_bytes())?;
utils::unix_datagram_sendto(constants::CONTROLLER_SOCKET, &value.to_le_bytes())?;
}
DaemonSocketAction::ZygoteRestart => {
info!("Zygote restarted, clean up companions");
@@ -166,10 +163,7 @@ fn create_library_fd(so_path: &PathBuf) -> Result<OwnedFd> {
fn create_daemon_socket() -> Result<UnixListener> {
utils::set_socket_create_context("u:r:zygote:s0")?;
let magic_path = std::env::var("MAGIC_PATH")?;
let socket_path = magic_path + constants::PATH_CP_NAME;
log::debug!("Daemon socket: {}", socket_path);
let listener = utils::unix_listener_from_path(&socket_path)?;
let listener = utils::unix_listener_from_path(constants::PATH_CP_NAME)?;
Ok(listener)
}