Skip to content

Commit 9ab890d

Browse files
Add more freebsd items
1 parent 5b308d9 commit 9ab890d

File tree

5 files changed

+532
-14
lines changed

5 files changed

+532
-14
lines changed

src/unix/bsd/apple/mod.rs

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ pub type host_flavor_t = integer_t;
5252
pub type host_info64_t = *mut integer_t;
5353
pub type processor_flavor_t = ::c_int;
5454
pub type thread_flavor_t = natural_t;
55-
pub type thread_inspect_t = mach_port_t;
55+
pub type thread_inspect_t = ::mach_port_t;
5656
pub type policy_t = ::c_int;
5757
pub type mach_vm_address_t = u64;
5858
pub type mach_vm_offset_t = u64;
@@ -90,7 +90,7 @@ pub type thread_identifier_info_data_t = thread_identifier_info;
9090
pub type thread_extended_info_t = *mut thread_extended_info;
9191
pub type thread_extended_info_data_t = thread_extended_info;
9292

93-
pub type thread_t = mach_port_t;
93+
pub type thread_t = ::mach_port_t;
9494
pub type thread_policy_flavor_t = natural_t;
9595
pub type thread_policy_t = *mut integer_t;
9696
pub type thread_latency_qos_t = integer_t;
@@ -117,7 +117,7 @@ pub type vm_statistics_data_t = vm_statistics;
117117
pub type vm_statistics64_t = *mut vm_statistics64;
118118
pub type vm_statistics64_data_t = vm_statistics64;
119119

120-
pub type task_t = mach_port_t;
120+
pub type task_t = ::mach_port_t;
121121

122122
pub type sysdir_search_path_enumeration_state = ::c_uint;
123123

@@ -5270,11 +5270,14 @@ extern "C" {
52705270
out_processor_infoCnt: *mut mach_msg_type_number_t,
52715271
) -> ::kern_return_t;
52725272

5273-
pub static mut mach_task_self_: mach_port_t;
5274-
pub fn task_for_pid(host: mach_port_t, pid: ::pid_t, task: *mut mach_port_t)
5275-
-> ::kern_return_t;
5273+
pub static mut mach_task_self_: ::mach_port_t;
5274+
pub fn task_for_pid(
5275+
host: ::mach_port_t,
5276+
pid: ::pid_t,
5277+
task: *mut ::mach_port_t,
5278+
) -> ::kern_return_t;
52765279
pub fn task_info(
5277-
host: mach_port_t,
5280+
host: ::mach_port_t,
52785281
flavor: task_flavor_t,
52795282
task_info_out: task_info_t,
52805283
task_info_count: *mut mach_msg_type_number_t,
@@ -5299,7 +5302,7 @@ extern "C" {
52995302
pub static vm_page_size: vm_size_t;
53005303
}
53015304

5302-
pub unsafe fn mach_task_self() -> mach_port_t {
5305+
pub unsafe fn mach_task_self() -> ::mach_port_t {
53035306
mach_task_self_
53045307
}
53055308

src/unix/bsd/freebsdlike/freebsd/freebsd11/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,7 @@ cfg_if! {
191191

192192
pub const ELAST: ::c_int = 96;
193193
pub const RAND_MAX: ::c_int = 0x7fff_fffd;
194+
pub const KI_NSPARE_PTR: usize = 6;
194195

195196
extern "C" {
196197
// Return type ::c_int was removed in FreeBSD 12

src/unix/bsd/freebsdlike/freebsd/freebsd12/mod.rs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,16 @@ s! {
2626
pub udata: *mut ::c_void,
2727
pub ext: [u64; 4],
2828
}
29+
30+
pub struct kvm_page {
31+
pub version: ::c_uint,
32+
pub paddr: ::c_ulong,
33+
pub kmap_vaddr: ::c_ulong,
34+
pub dmap_vaddr: ::c_ulong,
35+
pub prot: ::vm_prot_t,
36+
pub offset: ::u_long,
37+
pub len: ::size_t,
38+
}
2939
}
3040

3141
s_no_extra_traits! {
@@ -212,6 +222,10 @@ pub const SO_DOMAIN: ::c_int = 0x1019;
212222
pub const EINTEGRITY: ::c_int = 97;
213223
pub const ELAST: ::c_int = 97;
214224

225+
/// max length of devicename
226+
pub const SPECNAMELEN: ::c_int = 63;
227+
pub const KI_NSPARE_PTR: usize = 6;
228+
215229
extern "C" {
216230
pub fn setgrent();
217231
pub fn mprotect(addr: *mut ::c_void, len: ::size_t, prot: ::c_int) -> ::c_int;

src/unix/bsd/freebsdlike/freebsd/freebsd13/mod.rs

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ pub type nlink_t = u64;
44
pub type dev_t = u64;
55
pub type ino_t = ::c_ulong;
66
pub type shmatt_t = ::c_uint;
7+
pub type kpaddr_t = u64;
8+
pub type kssize_t = i64;
79

810
s! {
911
pub struct shmid_ds {
@@ -37,6 +39,16 @@ s! {
3739
pub sc_ngroups: ::c_int,
3840
pub sc_groups: [::gid_t; 1],
3941
}
42+
43+
pub struct kvm_page {
44+
pub kp_version: ::u_int,
45+
pub kp_paddr: ::kpaddr_t,
46+
pub kp_kmap_vaddr: ::kvaddr_t,
47+
pub kp_dmap_vaddr: ::kvaddr_t,
48+
pub kp_prot: ::vm_prot_t,
49+
pub kp_offset: ::off_t,
50+
pub kp_len: ::size_t,
51+
}
4052
}
4153

4254
s_no_extra_traits! {
@@ -228,6 +240,12 @@ pub const PROC_PROCCTL_MD_MIN: ::c_int = 0x10000000;
228240
pub const LOCAL_CREDS_PERSISTENT: ::c_int = 3;
229241
pub const SCM_CREDS2: ::c_int = 0x08;
230242

243+
pub const KF_TYPE_EVENTFD: ::c_int = 13;
244+
245+
/// max length of devicename
246+
pub const SPECNAMELEN: ::c_int = 255;
247+
pub const KI_NSPARE_PTR: usize = 5;
248+
231249
f! {
232250
pub fn SOCKCRED2SIZE(ngrps: usize) -> usize {
233251
let ngrps = if ngrps > 0 {
@@ -269,6 +287,11 @@ extern "C" {
269287
pub fn timingsafe_memcmp(a: *const ::c_void, b: *const ::c_void, len: ::size_t) -> ::c_int;
270288
}
271289

290+
#[link(name = "kvm")]
291+
extern "C" {
292+
pub fn kvm_kerndisp(kd: *mut ::kvm_t) -> ::kssize_t;
293+
}
294+
272295
cfg_if! {
273296
if #[cfg(any(target_arch = "x86_64",
274297
target_arch = "aarch64"))] {

0 commit comments

Comments
 (0)