From 380c42c40562ba7fac28cbe29f221e2abd13e106 Mon Sep 17 00:00:00 2001 From: Jelle Raaijmakers Date: Wed, 22 Sep 2021 23:59:50 +0200 Subject: LibC: Add getpriority() and setpriority() stubs Expected behavior left as a FIXME is outlined here: https://pubs.opengroup.org/onlinepubs/7908799/xsh/getpriority.html --- Userland/Libraries/LibC/CMakeLists.txt | 1 + Userland/Libraries/LibC/priority.cpp | 23 +++++++++++++++++++++++ Userland/Libraries/LibC/sys/resource.h | 7 +++++++ 3 files changed, 31 insertions(+) create mode 100644 Userland/Libraries/LibC/priority.cpp (limited to 'Userland/Libraries') 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 +#include + +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 -- cgit v1.2.3