diff options
author | Steve Lau <stevelauc@outlook.com> | 2023-05-06 16:36:01 +0800 |
---|---|---|
committer | Steve Lau <stevelauc@outlook.com> | 2023-05-06 16:36:01 +0800 |
commit | 044941617a2695ea0050f682a2d4a5e57a65799d (patch) | |
tree | 34af43f1290e752fe78805b943e0d3b1a896b47a /src/unix/solarish/mod.rs | |
parent | 79b7d3c7520a29c98f346285b1184091fd36fff2 (diff) | |
download | rust-libc-044941617a2695ea0050f682a2d4a5e57a65799d.tar.gz |
add major/minor on BSDs/illumos
Diffstat (limited to 'src/unix/solarish/mod.rs')
-rw-r--r-- | src/unix/solarish/mod.rs | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/unix/solarish/mod.rs b/src/unix/solarish/mod.rs index cc688331f4..48ab4dbb92 100644 --- a/src/unix/solarish/mod.rs +++ b/src/unix/solarish/mod.rs @@ -2584,6 +2584,8 @@ const _CMSG_HDR_ALIGNMENT: usize = 4; const _CMSG_DATA_ALIGNMENT: usize = ::mem::size_of::<::c_int>(); +const NEWDEV: ::c_int = 1; + const_fn! { {const} fn _CMSG_HDR_ALIGN(p: usize) -> usize { (p + _CMSG_HDR_ALIGNMENT - 1) & !(_CMSG_HDR_ALIGNMENT - 1) @@ -3198,6 +3200,10 @@ extern "C" { ) -> ::c_int; pub fn sync(); + + fn __major(version: ::c_int, devnum: ::dev_t) -> ::major_t; + fn __minor(version: ::c_int, devnum: ::dev_t) -> ::minor_t; + fn __makedev(version: ::c_int, majdev: ::major_t, mindev: ::minor_t) -> ::dev_t; } #[link(name = "sendfile")] @@ -3254,6 +3260,18 @@ extern "C" { pub fn lgrp_root(cookie: ::lgrp_cookie_t) -> ::lgrp_id_t; } +pub unsafe fn major(device: ::dev_t) -> ::major_t { + __major(NEWDEV, device) +} + +pub unsafe fn minor(device: ::dev_t) -> ::minor_t { + __minor(NEWDEV, device) +} + +pub unsafe fn makedev(maj: ::major_t, min: ::minor_t) -> ::dev_t { + __makedev(NEWDEV, maj, min) +} + mod compat; pub use self::compat::*; |