Skip to content

Commit e1b07eb

Browse files
committed
Auto merge of #2332 - GuillaumeGomez:bsd-items, r=JohnTitor
Add more items in apple targets
2 parents a1d6298 + 3667e65 commit e1b07eb

File tree

3 files changed

+49
-0
lines changed

3 files changed

+49
-0
lines changed

libc-test/build.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -321,6 +321,8 @@ fn test_apple(target: &str) {
321321
// FIXME: the array size has been changed since macOS 10.15 ([8] -> [7]).
322322
("statfs", "f_reserved") => true,
323323
("__darwin_arm_neon_state64", "__v") => true,
324+
// MAXPATHLEN is too big for auto-derive traits on arrays.
325+
("vnode_info_path", "vip_path") => true,
324326
_ => false,
325327
}
326328
});

src/unix/bsd/apple/mod.rs

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -678,6 +678,49 @@ s! {
678678
pub sched_priority: ::c_int,
679679
__opaque: [::c_char; 4],
680680
}
681+
682+
pub struct vinfo_stat {
683+
pub vst_dev: u32,
684+
pub vst_mode: u16,
685+
pub vst_nlink: u16,
686+
pub vst_ino: u64,
687+
pub vst_uid: ::uid_t,
688+
pub vst_gid: ::gid_t,
689+
pub vst_atime: i64,
690+
pub vst_atimensec: i64,
691+
pub vst_mtime: i64,
692+
pub vst_mtimensec: i64,
693+
pub vst_ctime: i64,
694+
pub vst_ctimensec: i64,
695+
pub vst_birthtime: i64,
696+
pub vst_birthtimensec: i64,
697+
pub vst_size: ::off_t,
698+
pub vst_blocks: i64,
699+
pub vst_blksize: i32,
700+
pub vst_flags: u32,
701+
pub vst_gen: u32,
702+
pub vst_rdev: u32,
703+
pub vst_qspare: [i64; 2],
704+
}
705+
706+
pub struct vnode_info {
707+
pub vi_stat: vinfo_stat,
708+
pub vi_type: ::c_int,
709+
pub vi_pad: ::c_int,
710+
pub vi_fsid: ::fsid_t,
711+
}
712+
713+
pub struct vnode_info_path {
714+
pub vip_vi: vnode_info,
715+
// Normally it's `vip_path: [::c_char; MAXPATHLEN]` but because libc supports an old rustc
716+
// version, we go around this limitation like this.
717+
pub vip_path: [[::c_char; 32]; 32],
718+
}
719+
720+
pub struct proc_vnodepathinfo {
721+
pub pvi_cdir: vnode_info_path,
722+
pub pvi_rdir: vnode_info_path,
723+
}
681724
}
682725

683726
s_no_extra_traits! {
@@ -3530,8 +3573,11 @@ pub const RTAX_MAX: ::c_int = 8;
35303573
pub const KERN_PROCARGS2: ::c_int = 49;
35313574

35323575
pub const PROC_PIDTASKALLINFO: ::c_int = 2;
3576+
pub const PROC_PIDTBSDINFO: ::c_int = 3;
35333577
pub const PROC_PIDTASKINFO: ::c_int = 4;
35343578
pub const PROC_PIDTHREADINFO: ::c_int = 5;
3579+
pub const PROC_PIDVNODEPATHINFO: ::c_int = 9;
3580+
pub const PROC_PIDPATHINFO_MAXSIZE: ::c_int = 4096;
35353581
pub const MAXCOMLEN: usize = 16;
35363582
pub const MAXTHREADNAMESIZE: usize = 64;
35373583

src/unix/bsd/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -253,6 +253,7 @@ pub const FIOSETOWN: ::c_ulong = 0x8004667c;
253253
pub const FIOGETOWN: ::c_ulong = 0x4004667b;
254254

255255
pub const PATH_MAX: ::c_int = 1024;
256+
pub const MAXPATHLEN: ::c_int = PATH_MAX;
256257

257258
pub const IOV_MAX: ::c_int = 1024;
258259

0 commit comments

Comments
 (0)