diff options
author | Jelle Raaijmakers <jelle@gmta.nl> | 2021-09-22 23:59:50 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-09-23 18:51:21 +0200 |
commit | 380c42c40562ba7fac28cbe29f221e2abd13e106 (patch) | |
tree | 05233b8a3d12f1ccb6402ef448b109fd05f52a90 /Userland/Libraries | |
parent | a6539cc031c8e7132cdaf8467ecef2310e3867a6 (diff) | |
download | serenity-380c42c40562ba7fac28cbe29f221e2abd13e106.zip |
LibC: Add getpriority() and setpriority() stubs
Expected behavior left as a FIXME is outlined here:
https://pubs.opengroup.org/onlinepubs/7908799/xsh/getpriority.html
Diffstat (limited to 'Userland/Libraries')
-rw-r--r-- | Userland/Libraries/LibC/CMakeLists.txt | 1 | ||||
-rw-r--r-- | Userland/Libraries/LibC/priority.cpp | 23 | ||||
-rw-r--r-- | Userland/Libraries/LibC/sys/resource.h | 7 |
3 files changed, 31 insertions, 0 deletions
diff --git a/Userland/Libraries/LibC/CMakeLists.txt b/Userland/Libraries/LibC/CMakeLists.txt index aab4d8aa9b..42d9704355 100644 --- a/Userland/Libraries/LibC/CMakeLists.txt +++ b/Userland/Libraries/LibC/CMakeLists.txt @@ -22,6 +22,7 @@ set(LIBC_SOURCES net.cpp netdb.cpp poll.cpp + priority.cpp pthread_forward.cpp pthread_integration.cpp pthread_tls.cpp diff --git a/Userland/Libraries/LibC/priority.cpp b/Userland/Libraries/LibC/priority.cpp new file mode 100644 index 0000000000..05b97c731a --- /dev/null +++ b/Userland/Libraries/LibC/priority.cpp @@ -0,0 +1,23 @@ +/* + * Copyright (c) 2021, the SerenityOS developers. + * + * SPDX-License-Identifier: BSD-2-Clause + */ + +#include <AK/Format.h> +#include <sys/resource.h> + +extern "C" { + +int getpriority([[maybe_unused]] int which, [[maybe_unused]] id_t who) +{ + dbgln("FIXME: Implement getpriority()"); + return -1; +} + +int setpriority([[maybe_unused]] int which, [[maybe_unused]] id_t who, [[maybe_unused]] int value) +{ + dbgln("FIXME: Implement setpriority()"); + return -1; +} +} diff --git a/Userland/Libraries/LibC/sys/resource.h b/Userland/Libraries/LibC/sys/resource.h index 488b0de6d6..7d3f265396 100644 --- a/Userland/Libraries/LibC/sys/resource.h +++ b/Userland/Libraries/LibC/sys/resource.h @@ -58,4 +58,11 @@ struct rlimit { int getrlimit(int, struct rlimit*); int setrlimit(int, struct rlimit const*); +#define PRIO_PROCESS 0 +#define PRIO_PGRP 1 +#define PRIO_USER 2 + +int getpriority(int, id_t); +int setpriority(int, id_t, int); + __END_DECLS |