1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132
#[cfg(not(target_os = "espidf"))]
use crate::process::{Pid, Uid};
use crate::{backend, io};
/// `nice(inc)`—Adjust the scheduling priority of the current process.
///
/// # References
/// - [POSIX]
/// - [Linux]
///
/// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/nice.html
/// [Linux]: https://man7.org/linux/man-pages/man2/nice.2.html
#[inline]
pub fn nice(inc: i32) -> io::Result<i32> {
backend::process::syscalls::nice(inc)
}
/// `getpriority(PRIO_USER, uid)`—Get the scheduling priority of the given
/// user.
///
/// # References
/// - [POSIX]
/// - [Linux]
/// - [Apple]
///
/// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/getpriority.html
/// [Linux]: https://man7.org/linux/man-pages/man2/getpriority.2.html
/// [Apple]: https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man2/setpriority.2.html
#[cfg(not(target_os = "espidf"))]
#[inline]
#[doc(alias = "getpriority")]
pub fn getpriority_user(uid: Uid) -> io::Result<i32> {
backend::process::syscalls::getpriority_user(uid)
}
/// `getpriority(PRIO_PGRP, gid)`—Get the scheduling priority of the given
/// process group.
///
/// A `pgid` of `None` means the process group of the calling process.
///
/// # References
/// - [POSIX]
/// - [Linux]
/// - [Apple]
///
/// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/getpriority.html
/// [Linux]: https://man7.org/linux/man-pages/man2/getpriority.2.html
/// [Apple]: https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man2/setpriority.2.html
#[cfg(not(target_os = "espidf"))]
#[inline]
#[doc(alias = "getpriority")]
pub fn getpriority_pgrp(pgid: Option<Pid>) -> io::Result<i32> {
backend::process::syscalls::getpriority_pgrp(pgid)
}
/// `getpriority(PRIO_PROCESS, pid)`—Get the scheduling priority of the given
/// process.
///
/// A `pid` of `None` means the calling process.
///
/// # References
/// - [POSIX]
/// - [Linux]
/// - [Apple]
///
/// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/getpriority.html
/// [Linux]: https://man7.org/linux/man-pages/man2/getpriority.2.html
/// [Apple]: https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man2/setpriority.2.html
#[cfg(not(target_os = "espidf"))]
#[inline]
#[doc(alias = "getpriority")]
pub fn getpriority_process(pid: Option<Pid>) -> io::Result<i32> {
backend::process::syscalls::getpriority_process(pid)
}
/// `setpriority(PRIO_USER, uid)`—Get the scheduling priority of the given
/// user.
///
/// # References
/// - [POSIX]
/// - [Linux]
/// - [Apple]
///
/// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/setpriority.html
/// [Linux]: https://man7.org/linux/man-pages/man2/setpriority.2.html
/// [Apple]: https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man2/setpriority.2.html
#[cfg(not(target_os = "espidf"))]
#[inline]
#[doc(alias = "setpriority")]
pub fn setpriority_user(uid: Uid, priority: i32) -> io::Result<()> {
backend::process::syscalls::setpriority_user(uid, priority)
}
/// `setpriority(PRIO_PGRP, pgid)`—Get the scheduling priority of the given
/// process group.
///
/// A `pgid` of `None` means the process group of the calling process.
///
/// # References
/// - [POSIX]
/// - [Linux]
/// - [Apple]
///
/// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/setpriority.html
/// [Linux]: https://man7.org/linux/man-pages/man2/setpriority.2.html
/// [Apple]: https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man2/setpriority.2.html
#[cfg(not(target_os = "espidf"))]
#[inline]
#[doc(alias = "setpriority")]
pub fn setpriority_pgrp(pgid: Option<Pid>, priority: i32) -> io::Result<()> {
backend::process::syscalls::setpriority_pgrp(pgid, priority)
}
/// `setpriority(PRIO_PROCESS, pid)`—Get the scheduling priority of the given
/// process.
///
/// A `pid` of `None` means the calling process.
///
/// # References
/// - [POSIX]
/// - [Linux]
/// - [Apple]
///
/// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/setpriority.html
/// [Linux]: https://man7.org/linux/man-pages/man2/setpriority.2.html
/// [Apple]: https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man2/setpriority.2.html
#[cfg(not(target_os = "espidf"))]
#[inline]
#[doc(alias = "setpriority")]
pub fn setpriority_process(pid: Option<Pid>, priority: i32) -> io::Result<()> {
backend::process::syscalls::setpriority_process(pid, priority)
}