summaryrefslogtreecommitdiffstats
path: root/vendor/rustix/src/process/priority.rs
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:02:58 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:02:58 +0000
commit698f8c2f01ea549d77d7dc3338a12e04c11057b9 (patch)
tree173a775858bd501c378080a10dca74132f05bc50 /vendor/rustix/src/process/priority.rs
parentInitial commit. (diff)
downloadrustc-698f8c2f01ea549d77d7dc3338a12e04c11057b9.tar.xz
rustc-698f8c2f01ea549d77d7dc3338a12e04c11057b9.zip
Adding upstream version 1.64.0+dfsg1.upstream/1.64.0+dfsg1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'vendor/rustix/src/process/priority.rs')
-rw-r--r--vendor/rustix/src/process/priority.rs131
1 files changed, 131 insertions, 0 deletions
diff --git a/vendor/rustix/src/process/priority.rs b/vendor/rustix/src/process/priority.rs
new file mode 100644
index 000000000..ae43a0b75
--- /dev/null
+++ b/vendor/rustix/src/process/priority.rs
@@ -0,0 +1,131 @@
+use crate::process::{Pid, Uid};
+use crate::{imp, io};
+
+/// `nice()`—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> {
+ imp::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 = "redox"))]
+#[inline]
+#[doc(alias = "getpriority")]
+pub fn getpriority_user(uid: Uid) -> io::Result<i32> {
+ imp::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 = "redox"))]
+#[inline]
+#[doc(alias = "getpriority")]
+pub fn getpriority_pgrp(pgid: Option<Pid>) -> io::Result<i32> {
+ imp::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 = "redox"))]
+#[inline]
+#[doc(alias = "getpriority")]
+pub fn getpriority_process(pid: Option<Pid>) -> io::Result<i32> {
+ imp::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 = "redox"))]
+#[inline]
+#[doc(alias = "setpriority")]
+pub fn setpriority_user(uid: Uid, priority: i32) -> io::Result<()> {
+ imp::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 = "redox"))]
+#[inline]
+#[doc(alias = "setpriority")]
+pub fn setpriority_pgrp(pgid: Option<Pid>, priority: i32) -> io::Result<()> {
+ imp::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 = "redox"))]
+#[inline]
+#[doc(alias = "setpriority")]
+pub fn setpriority_process(pid: Option<Pid>, priority: i32) -> io::Result<()> {
+ imp::process::syscalls::setpriority_process(pid, priority)
+}