Skip to content

Commit

Permalink
Fixing build errors due to crates updates.
Browse files Browse the repository at this point in the history
  • Loading branch information
Jeff Kim committed Feb 24, 2024
1 parent 3019066 commit a546466
Show file tree
Hide file tree
Showing 8 changed files with 75 additions and 71 deletions.
100 changes: 52 additions & 48 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion example-hello/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ sync = ["rsbinder/sync", "rsbinder-aidl/sync"]
async = ["rsbinder/async", "rsbinder-aidl/async"]

[dependencies]
lazy_static = "1"
lazy_static = "1.4"
rsbinder = { version = "0.2.0", path = "../rsbinder", default-features = false }
env_logger = "0.11"
async-trait = "0.1"
Expand Down
14 changes: 7 additions & 7 deletions rsbinder-aidl/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@ sync = []
async = []

[dependencies]
pest = "2"
pest_derive = "2"
convert_case = "0"
lazy_static = "1"
serde = { version = "1", features = ["derive"] }
tera = "1"
pest = "2.7"
pest_derive = "2.7"
convert_case = "0.6"
lazy_static = "1.4"
serde = { version = "1.0", features = ["derive"] }
tera = "1.19"

[dev-dependencies]
similar = "2"
similar = "2.4"
6 changes: 3 additions & 3 deletions rsbinder-tests/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ publish = false
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
lazy_static = "1"
lazy_static = "1.4"
rsbinder = { version = "0.2.0", path = "../rsbinder" }
tokio = { version = "1", features = ["full"] }
tokio = { version = "1.36", features = ["full"] }
env_logger = "0.11"
nix = "0"
nix = "0.28"
async-trait = "0.1"

[build-dependencies]
Expand Down
4 changes: 2 additions & 2 deletions rsbinder-tests/src/test_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ use android::aidl::versioned::tests::{
use android::aidl::tests::vintf::{
VintfExtendableParcelable::VintfExtendableParcelable, VintfParcelable::VintfParcelable,
};
use std::fs::File;
use std::{fs::File, os::fd::IntoRawFd};
use std::io::{Read, Write};
use std::os::unix::io::FromRawFd;
use std::sync::{Arc, Mutex};
Expand Down Expand Up @@ -326,7 +326,7 @@ fn build_pipe() -> (File, File) {
// and pass them after checking if the function returned
// without an error, so the descriptors should be valid
// by that point
unsafe { (File::from_raw_fd(fds.0), File::from_raw_fd(fds.1)) }
unsafe { (File::from_raw_fd(fds.0.into_raw_fd()), File::from_raw_fd(fds.1.into_raw_fd())) }
}

/// Helper function that constructs a `File` from a `ParcelFileDescriptor`.
Expand Down
4 changes: 2 additions & 2 deletions rsbinder-tools/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ readme = "README.md"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
lazy_static = "1"
lazy_static = "1.4"
rsbinder = { version = "0.2.0", path = "../rsbinder" }
log = "0.4"
env_logger = "0.11"
nix = "0"
nix = "0.28"
anstyle = "1.0"
6 changes: 3 additions & 3 deletions rsbinder/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@ tokio = ["async", "tokio/full"]
async = ["rsbinder-aidl/async", "async-trait"]

[dependencies]
nix = { version = "0", features = ["ioctl", "mount", "fs", "feature", "mman", "process"] }
nix = { version = "0.28", features = ["ioctl", "mount", "fs", "feature", "mman", "process"] }
log = "0.4"
pretty_hex = { version = "0", package = "pretty-hex" }
pretty_hex = { version = "0.4", package = "pretty-hex" }
downcast-rs = "1.2"
async-trait = { version = "0.1", optional = true }
lazy_static = "1"
lazy_static = "1.4"
tokio = { version = "1.35", optional = true, default-features = false }

[build-dependencies]
Expand Down
10 changes: 5 additions & 5 deletions rsbinder/src/process_state.rs
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};
Expand Down Expand Up @@ -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 {}
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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;
}
}

0 comments on commit a546466

Please sign in to comment.