ladybird/Kernel/Syscalls/sysconf.cpp
Brian Gianforcaro 1682f0b760 Everything: Move to SPDX license identifiers in all files.
SPDX License Identifiers are a more compact / standardized
way of representing file license information.

See: https://spdx.dev/resources/use/#identifiers

This was done with the `ambr` search and replace tool.

 ambr --no-parent-ignore --key-from-file --rep-from-file key.txt rep.txt *
2021-04-22 11:22:27 +02:00

35 lines
792 B
C++

/*
* Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#include <Kernel/Arch/x86/CPU.h>
#include <Kernel/Process.h>
#include <Kernel/Time/TimeManagement.h>
#include <limits.h>
namespace Kernel {
KResultOr<long> Process::sys$sysconf(int name)
{
switch (name) {
case _SC_NPROCESSORS_CONF:
case _SC_NPROCESSORS_ONLN:
return Processor::processor_count();
case _SC_OPEN_MAX:
return max_open_file_descriptors();
case _SC_PAGESIZE:
return PAGE_SIZE;
case _SC_TTY_NAME_MAX:
return TTY_NAME_MAX;
case _SC_GETPW_R_SIZE_MAX:
return 4096; // idk
case _SC_CLK_TCK:
return TimeManagement::the().ticks_per_second();
default:
return EINVAL;
}
}
}