mirror of
https://github.com/kvorschk/Magisk.git
synced 2026-12-04 19:10:47 -05:00
Expose xpipe2 as symbol
This commit is contained in:
@@ -8,7 +8,6 @@ use std::os::fd::{BorrowedFd, FromRawFd, RawFd};
|
||||
|
||||
use crate::ffi::{FnBoolStr, FnBoolStrStr};
|
||||
use crate::files::map_file_at;
|
||||
pub(crate) use crate::xwrap::*;
|
||||
use crate::{
|
||||
BufReadExt, ResultExt, Utf8CStr, clone_attr, cstr, fclone_attr, map_fd, map_file,
|
||||
slice_from_ptr,
|
||||
|
||||
@@ -47,6 +47,7 @@ int xmkdirs(const char *pathname, mode_t mode);
|
||||
ssize_t xsendfile(int out_fd, int in_fd, off_t *offset, size_t count);
|
||||
pid_t xfork();
|
||||
int xmknod(const char * pathname, mode_t mode, dev_t dev);
|
||||
int xpipe2(int fds[2], int flags);
|
||||
|
||||
// Utils
|
||||
|
||||
|
||||
@@ -61,7 +61,6 @@ mod ffi {
|
||||
fn parse_prop_file_rs(name: Utf8CStrRef, f: &FnBoolStrStr);
|
||||
#[cxx_name = "file_readline"]
|
||||
fn file_readline_for_cxx(fd: i32, f: &FnBoolStr);
|
||||
fn xpipe2(fds: &mut [i32; 2], flags: i32) -> i32;
|
||||
}
|
||||
|
||||
#[namespace = "rust"]
|
||||
@@ -74,4 +73,3 @@ mod ffi {
|
||||
fn map_fd_for_cxx(fd: i32, sz: usize, rw: bool) -> &'static mut [u8];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -103,9 +103,10 @@ unsafe extern "C" fn xxread(fd: RawFd, buf: *mut u8, bufsz: usize) -> isize {
|
||||
.map_or(-1, |_| data.len() as isize)
|
||||
}
|
||||
|
||||
pub(crate) fn xpipe2(fds: &mut [i32; 2], flags: i32) -> i32 {
|
||||
#[unsafe(no_mangle)]
|
||||
unsafe extern "C" fn xpipe2(fds: *mut i32, flags: i32) -> i32 {
|
||||
unsafe {
|
||||
libc::pipe2(fds.as_mut_ptr(), flags)
|
||||
libc::pipe2(fds, flags)
|
||||
.into_os_result("pipe2", None, None)
|
||||
.log()
|
||||
.unwrap_or(-1)
|
||||
|
||||
@@ -38,11 +38,11 @@ struct exec_t {
|
||||
};
|
||||
|
||||
static int exec_command(exec_t &exec) {
|
||||
auto pipefd = array<int, 2>{-1, -1};
|
||||
auto pipefd = array{-1, -1};
|
||||
int outfd = -1;
|
||||
|
||||
if (exec.fd == -1) {
|
||||
if (xpipe2(pipefd, O_CLOEXEC) == -1)
|
||||
if (xpipe2(pipefd.data(), O_CLOEXEC) == -1)
|
||||
return -1;
|
||||
outfd = pipefd[1];
|
||||
} else if (exec.fd >= 0) {
|
||||
|
||||
Reference in New Issue
Block a user