forked from hiking90/rsbinder
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixing build errors due to crates updates.
- Loading branch information
Jeff Kim
committed
Feb 24, 2024
1 parent
3019066
commit a546466
Showing
8 changed files
with
75 additions
and
71 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,8 @@ | ||
// Copyright 2022 Jeff Kim <[email protected]> | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
use std::os::raw::c_void; | ||
use std::ptr::NonNull; | ||
use std::sync::atomic::{AtomicBool, AtomicUsize, Ordering}; | ||
use std::collections::HashMap; | ||
use std::sync::{Arc, RwLock, OnceLock}; | ||
|
@@ -31,7 +33,7 @@ const DEFAULT_MAX_BINDER_THREADS: u32 = 15; | |
const DEFAULT_ENABLE_ONEWAY_SPAM_DETECTION: u32 = 1; | ||
|
||
struct MemoryMap { | ||
ptr: *mut std::ffi::c_void, | ||
ptr: NonNull<c_void>, | ||
size: usize, | ||
} | ||
unsafe impl Sync for MemoryMap {} | ||
|
@@ -93,7 +95,7 @@ impl ProcessState { | |
vm_size, | ||
nix::sys::mman::ProtFlags::PROT_READ, | ||
nix::sys::mman::MapFlags::MAP_PRIVATE | nix::sys::mman::MapFlags::MAP_NORESERVE, | ||
Some(&driver), | ||
&driver, | ||
0)?; | ||
|
||
(vm_start, vm_size) | ||
|
@@ -305,9 +307,7 @@ fn open_driver(driver: &Path, max_threads: u32) -> std::result::Result<File, Box | |
|
||
impl Drop for ProcessState { | ||
fn drop(self: &mut ProcessState) { | ||
let mut mmap = self.mmap.write().unwrap(); | ||
let mmap = self.mmap.write().unwrap(); | ||
unsafe { nix::sys::mman::munmap(mmap.ptr, mmap.size).unwrap(); } | ||
mmap.ptr = std::ptr::null_mut(); | ||
mmap.size = 0; | ||
} | ||
} |