Skip to content

Commit

Permalink
fix deprecated warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
gnzlbg committed Oct 27, 2018
1 parent 59a0a94 commit d31c809
Show file tree
Hide file tree
Showing 4 changed files with 98 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/task_info.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ pub type task_info_t = *mut integer_t;
note = "requires the unstable feature to avoid undefined behavior"
)
)]
#[cfg_attr(not(feature = "unstable"), allow(deprecated))]
#[derive(Copy, Clone, Debug, Default, Hash, PartialOrd, PartialEq, Eq, Ord)]
pub struct task_dyld_info {
pub all_image_info_addr: mach_vm_address_t,
Expand Down
13 changes: 12 additions & 1 deletion src/vm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,12 @@ use vm_behavior::vm_behavior_t;
use vm_inherit::vm_inherit_t;
use vm_prot::vm_prot_t;
use vm_purgable::vm_purgable_t;
use vm_region::*;
use vm_sync::vm_sync_t;
use vm_types::*;

#[cfg_attr(not(feature = "unstable"), allow(deprecated))]
use vm_region::*;

extern "C" {
pub fn mach_vm_allocate(
target: vm_task_entry_t,
Expand Down Expand Up @@ -52,6 +54,14 @@ extern "C" {
dataCnt: *mut mach_msg_type_number_t,
) -> kern_return_t;

#[cfg_attr(
not(feature = "unstable"),
deprecated(
since = "0.2.3",
note = "requires the `unstable` feature to avoid undefined behavior"
)
)]
#[cfg_attr(not(feature = "unstable"), allow(deprecated))]
pub fn mach_vm_read_list(
target_task: vm_task_entry_t,
data_list: mach_vm_read_entry_t,
Expand Down Expand Up @@ -216,6 +226,7 @@ mod tests {
}
}

#[cfg_attr(not(feature = "unstable"), allow(deprecated))]
#[test]
fn mach_vm_region_sanity() {
unsafe {
Expand Down
84 changes: 84 additions & 0 deletions src/vm_region.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,23 @@ pub type vm_region_recurse_info_t = *mut ::libc::c_int;
pub type vm_region_recurse_info_64_t = *mut ::libc::c_int;
pub type vm_region_flavor_t = ::libc::c_int;
pub type vm_region_info_data_t = [::libc::c_int; VM_REGION_INFO_MAX as usize];
#[cfg_attr(
not(feature = "unstable"),
deprecated(
since = "0.2.3",
note = "requires the `unstable` feature to avoid undefined behavior"
)
)]
#[cfg_attr(not(feature = "unstable"), allow(deprecated))]
pub type vm_region_basic_info_64_t = *mut vm_region_basic_info_64;
#[cfg_attr(
not(feature = "unstable"),
deprecated(
since = "0.2.3",
note = "requires the `unstable` feature to avoid undefined behavior"
)
)]
#[cfg_attr(not(feature = "unstable"), allow(deprecated))]
pub type vm_region_basic_info_data_64_t = vm_region_basic_info_64;
pub type vm_region_basic_info_t = *mut vm_region_basic_info;
pub type vm_region_basic_info_data_t = vm_region_basic_info;
Expand All @@ -28,14 +44,54 @@ pub type vm_region_top_info_t = *mut vm_region_top_info;
pub type vm_region_top_info_data_t = vm_region_top_info;
pub type vm_region_submap_info_t = *mut vm_region_submap_info;
pub type vm_region_submap_info_data_t = vm_region_submap_info;
#[cfg_attr(
not(feature = "unstable"),
deprecated(
since = "0.2.3",
note = "requires the `unstable` feature to avoid undefined behavior"
)
)]
#[cfg_attr(not(feature = "unstable"), allow(deprecated))]
pub type vm_region_submap_info_64_t = *mut vm_region_submap_info_64;
#[cfg_attr(
not(feature = "unstable"),
deprecated(
since = "0.2.3",
note = "requires the `unstable` feature to avoid undefined behavior"
)
)]
#[cfg_attr(not(feature = "unstable"), allow(deprecated))]
pub type vm_region_submap_info_data_64_t = vm_region_submap_info_64;
#[cfg_attr(
not(feature = "unstable"),
deprecated(
since = "0.2.3",
note = "requires the `unstable` feature to avoid undefined behavior"
)
)]
#[cfg_attr(not(feature = "unstable"), allow(deprecated))]
pub type vm_region_submap_short_info_64_t = *mut vm_region_submap_short_info_64;
#[cfg_attr(
not(feature = "unstable"),
deprecated(
since = "0.2.3",
note = "requires the `unstable` feature to avoid undefined behavior"
)
)]
#[cfg_attr(not(feature = "unstable"), allow(deprecated))]
pub type vm_region_submap_short_info_data_64_t = vm_region_submap_short_info_64;
pub type vm_page_info_t = *mut ::libc::c_int;
pub type vm_page_info_flavor_t = ::libc::c_int;
pub type vm_page_info_basic_t = *mut vm_page_info_basic;
pub type vm_page_info_basic_data_t = vm_page_info_basic;
#[cfg_attr(
not(feature = "unstable"),
deprecated(
since = "0.2.3",
note = "requires the `unstable` feature to avoid undefined behavior"
)
)]
#[cfg_attr(not(feature = "unstable"), allow(deprecated))]
pub type mach_vm_read_entry_t = [mach_vm_read_entry; VM_MAP_ENTRY_MAX as usize];

pub const VM_REGION_INFO_MAX: ::libc::c_int = (1 << 10);
Expand Down Expand Up @@ -65,6 +121,7 @@ pub const SM_SHARED_ALIASED: ::libc::c_uchar = 7;
note = "requires the unstable feature to avoid undefined behavior"
)
)]
#[cfg_attr(not(feature = "unstable"), allow(deprecated))]
#[derive(Copy, Clone, Debug, Default, Hash, PartialOrd, PartialEq, Eq, Ord)]
pub struct vm_region_basic_info_64 {
pub protection: vm_prot_t,
Expand All @@ -77,6 +134,14 @@ pub struct vm_region_basic_info_64 {
pub user_wired_count: ::libc::c_ushort,
}

#[cfg_attr(
not(feature = "unstable"),
deprecated(
since = "0.2.3",
note = "requires the `unstable` feature to avoid undefined behavior"
)
)]
#[cfg_attr(not(feature = "unstable"), allow(deprecated))]
impl vm_region_basic_info_64 {
pub fn count() -> mach_msg_type_number_t {
(mem::size_of::<Self>() / mem::size_of::<::libc::c_int>()) as mach_msg_type_number_t
Expand Down Expand Up @@ -177,6 +242,7 @@ impl vm_region_submap_info {
note = "requires the `unstable` feature to avoid undefined behavior"
)
)]
#[cfg_attr(not(feature = "unstable"), allow(deprecated))]
#[derive(Copy, Clone, Debug, Default, Hash, PartialOrd, PartialEq, Eq, Ord)]
pub struct vm_region_submap_info_64 {
pub protection: vm_prot_t,
Expand All @@ -199,6 +265,14 @@ pub struct vm_region_submap_info_64 {
pub pages_reusable: ::libc::c_uint,
}

#[cfg_attr(
not(feature = "unstable"),
deprecated(
since = "0.2.3",
note = "requires the `unstable` feature to avoid undefined behavior"
)
)]
#[cfg_attr(not(feature = "unstable"), allow(deprecated))]
impl vm_region_submap_info_64 {
pub fn count() -> mach_msg_type_number_t {
(mem::size_of::<Self>() / mem::size_of::<::libc::c_int>()) as mach_msg_type_number_t
Expand All @@ -214,6 +288,7 @@ impl vm_region_submap_info_64 {
note = "requires the `unstable` feature to avoid undefined behavior"
)
)]
#[cfg_attr(not(feature = "unstable"), allow(deprecated))]
#[derive(Copy, Clone, Debug, Default, Hash, PartialOrd, PartialEq, Eq, Ord)]
pub struct vm_region_submap_short_info_64 {
pub protection: vm_prot_t,
Expand All @@ -231,6 +306,14 @@ pub struct vm_region_submap_short_info_64 {
pub user_wired_count: ::libc::c_ushort,
}

#[cfg_attr(
not(feature = "unstable"),
deprecated(
since = "0.2.3",
note = "requires the `unstable` feature to avoid undefined behavior"
)
)]
#[cfg_attr(not(feature = "unstable"), allow(deprecated))]
impl vm_region_submap_short_info_64 {
pub fn count() -> mach_msg_type_number_t {
(mem::size_of::<Self>() / mem::size_of::<::libc::c_int>()) as mach_msg_type_number_t
Expand Down Expand Up @@ -263,6 +346,7 @@ impl vm_page_info_basic {
note = "requires the `unstable` feature to avoid undefined behavior"
)
)]
#[cfg_attr(not(feature = "unstable"), allow(deprecated))]
#[derive(Copy, Clone, Debug, Default, Hash, PartialOrd, PartialEq, Eq, Ord)]
pub struct mach_vm_read_entry {
pub address: mach_vm_address_t,
Expand Down
1 change: 1 addition & 0 deletions src/vm_statistics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ pub struct vm_statistics {
since = "0.2.3",
note = "`pmap_statistics` was removed after MacOSX 10.3.9"
)]
#[cfg_attr(feature = "deprecated", allow(deprecated))]
#[repr(C)]
#[derive(Copy, Clone, Debug, Default, Hash, PartialOrd, PartialEq, Eq, Ord)]
pub struct pmap_statistics {
Expand Down

0 comments on commit d31c809

Please sign in to comment.