mirror of
https://github.com/topjohnwu/Magisk.git
synced 2025-10-27 15:20:58 +00:00
Cleanup unused bindings
This commit is contained in:
@@ -21,10 +21,6 @@ DIR *xopendir(const char *name);
|
||||
DIR *xfdopendir(int fd);
|
||||
dirent *xreaddir(DIR *dirp);
|
||||
pid_t xsetsid();
|
||||
int xsocket(int domain, int type, int protocol);
|
||||
int xbind(int sockfd, const struct sockaddr *addr, socklen_t addrlen);
|
||||
int xlisten(int sockfd, int backlog);
|
||||
int xaccept4(int sockfd, struct sockaddr *addr, socklen_t *addrlen, int flags);
|
||||
int xstat(const char *pathname, struct stat *buf);
|
||||
int xfstat(int fd, struct stat *buf);
|
||||
int xdup2(int oldfd, int newfd);
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
use crate::cxx_extern::readlinkat;
|
||||
use crate::{Directory, LibcReturn, ResultExt, Utf8CStr, cstr, slice_from_ptr, slice_from_ptr_mut};
|
||||
use libc::{c_char, c_uint, c_ulong, c_void, dev_t, mode_t, off_t, sockaddr, socklen_t};
|
||||
use libc::{c_char, c_uint, c_ulong, c_void, dev_t, mode_t, off_t};
|
||||
use std::ffi::CStr;
|
||||
use std::fs::File;
|
||||
use std::io::{Read, Write};
|
||||
@@ -201,51 +201,6 @@ extern "C" fn xsetsid() -> i32 {
|
||||
}
|
||||
}
|
||||
|
||||
#[unsafe(no_mangle)]
|
||||
extern "C" fn xsocket(domain: i32, ty: i32, protocol: i32) -> RawFd {
|
||||
unsafe {
|
||||
libc::socket(domain, ty, protocol)
|
||||
.into_os_result("socket", None, None)
|
||||
.log()
|
||||
.unwrap_or(-1)
|
||||
}
|
||||
}
|
||||
|
||||
#[unsafe(no_mangle)]
|
||||
unsafe extern "C" fn xbind(socket: i32, address: *const sockaddr, len: socklen_t) -> i32 {
|
||||
unsafe {
|
||||
libc::bind(socket, address, len)
|
||||
.into_os_result("bind", None, None)
|
||||
.log()
|
||||
.unwrap_or(-1)
|
||||
}
|
||||
}
|
||||
|
||||
#[unsafe(no_mangle)]
|
||||
extern "C" fn xlisten(socket: i32, backlog: i32) -> i32 {
|
||||
unsafe {
|
||||
libc::listen(socket, backlog)
|
||||
.into_os_result("listen", None, None)
|
||||
.log()
|
||||
.unwrap_or(-1)
|
||||
}
|
||||
}
|
||||
|
||||
#[unsafe(no_mangle)]
|
||||
unsafe extern "C" fn xaccept4(
|
||||
sockfd: RawFd,
|
||||
addr: *mut sockaddr,
|
||||
len: *mut socklen_t,
|
||||
flg: i32,
|
||||
) -> RawFd {
|
||||
unsafe {
|
||||
libc::accept4(sockfd, addr, len, flg)
|
||||
.into_os_result("accept4", None, None)
|
||||
.log()
|
||||
.unwrap_or(-1)
|
||||
}
|
||||
}
|
||||
|
||||
#[unsafe(no_mangle)]
|
||||
unsafe extern "C" fn xstat(path: *const c_char, buf: *mut libc::stat) -> i32 {
|
||||
unsafe {
|
||||
|
||||
@@ -13,9 +13,9 @@ use daemon::{MagiskD, connect_daemon_for_cxx};
|
||||
use derive::Decodable;
|
||||
use logging::{android_logging, zygisk_close_logd, zygisk_get_logd, zygisk_logging};
|
||||
use magisk::magisk_main;
|
||||
use mount::{find_preinit_device, revert_unmount};
|
||||
use mount::revert_unmount;
|
||||
use resetprop::{get_prop, resetprop_main};
|
||||
use selinux::{lgetfilecon, lsetfilecon, restorecon, setfilecon};
|
||||
use selinux::{lgetfilecon, setfilecon};
|
||||
use socket::{recv_fd, recv_fds, send_fd};
|
||||
use std::fs::File;
|
||||
use std::mem::ManuallyDrop;
|
||||
@@ -187,7 +187,6 @@ pub mod ffi {
|
||||
fn zygisk_logging();
|
||||
fn zygisk_close_logd();
|
||||
fn zygisk_get_logd() -> i32;
|
||||
fn find_preinit_device() -> String;
|
||||
fn revert_unmount(pid: i32);
|
||||
fn zygisk_should_load_module(flags: u32) -> bool;
|
||||
fn send_fd(socket: i32, fd: i32) -> bool;
|
||||
@@ -196,10 +195,8 @@ pub mod ffi {
|
||||
fn write_to_fd(self: &SuRequest, fd: i32);
|
||||
fn pump_tty(ptmx: i32, pump_stdin: bool);
|
||||
fn get_pty_num(fd: i32) -> i32;
|
||||
fn restorecon();
|
||||
fn lgetfilecon(path: Utf8CStrRef, con: &mut [u8]) -> bool;
|
||||
fn setfilecon(path: Utf8CStrRef, con: Utf8CStrRef) -> bool;
|
||||
fn lsetfilecon(path: Utf8CStrRef, con: Utf8CStrRef) -> bool;
|
||||
|
||||
fn get_prop(name: Utf8CStrRef) -> String;
|
||||
unsafe fn resetprop_main(argc: i32, argv: *mut *mut c_char) -> i32;
|
||||
|
||||
@@ -104,7 +104,3 @@ pub(crate) fn lgetfilecon(path: &Utf8CStr, con: &mut [u8]) -> bool {
|
||||
pub(crate) fn setfilecon(path: &Utf8CStr, con: &Utf8CStr) -> bool {
|
||||
path.follow_link().set_secontext(con).is_ok()
|
||||
}
|
||||
|
||||
pub(crate) fn lsetfilecon(path: &Utf8CStr, con: &Utf8CStr) -> bool {
|
||||
path.set_secontext(con).is_ok()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user