summaryrefslogtreecommitdiff
path: root/ext/node/ops
diff options
context:
space:
mode:
Diffstat (limited to 'ext/node/ops')
-rw-r--r--ext/node/ops/os.rs17
1 files changed, 2 insertions, 15 deletions
diff --git a/ext/node/ops/os.rs b/ext/node/ops/os.rs
index 44ff0a3a7..7dc1a7684 100644
--- a/ext/node/ops/os.rs
+++ b/ext/node/ops/os.rs
@@ -60,17 +60,6 @@ mod priority {
use libc::id_t;
use libc::PRIO_PROCESS;
- #[cfg(any(
- target_os = "macos",
- target_os = "freebsd",
- target_os = "openbsd"
- ))]
- #[allow(non_camel_case_types)]
- type priority_t = i32;
- #[cfg(target_os = "linux")]
- #[allow(non_camel_case_types)]
- type priority_t = u32;
-
const PRIORITY_HIGH: i32 = -14;
// Ref: https://github.com/libuv/libuv/blob/55376b044b74db40772e8a6e24d67a8673998e02/src/unix/core.c#L1533-L1547
@@ -78,7 +67,7 @@ mod priority {
set_errno(Errno(0));
match (
// SAFETY: libc::getpriority is unsafe
- unsafe { libc::getpriority(PRIO_PROCESS as priority_t, pid as id_t) },
+ unsafe { libc::getpriority(PRIO_PROCESS, pid as id_t) },
errno(),
) {
(-1, Errno(0)) => Ok(PRIORITY_HIGH),
@@ -89,9 +78,7 @@ mod priority {
pub fn set_priority(pid: u32, priority: i32) -> Result<(), AnyError> {
// SAFETY: libc::setpriority is unsafe
- match unsafe {
- libc::setpriority(PRIO_PROCESS as priority_t, pid as id_t, priority)
- } {
+ match unsafe { libc::setpriority(PRIO_PROCESS, pid as id_t, priority) } {
-1 => Err(std::io::Error::last_os_error().into()),
_ => Ok(()),
}