LibCore: Implement Core::System::hardware_concurrency()

This commit is contained in:
Shannon Booth 2024-04-05 20:43:45 +02:00 committed by Andreas Kling
commit 9c9a378455
Notes: sideshowbarker 2024-07-16 20:12:13 +09:00
2 changed files with 7 additions and 0 deletions

View file

@ -1739,6 +1739,11 @@ ErrorOr<void> posix_fallocate(int fd, off_t offset, off_t length)
// the distinction between these libraries moot.
static constexpr StringView INTERNAL_DEFAULT_PATH_SV = "/usr/local/sbin:/usr/local/bin:/usr/bin:/bin"sv;
unsigned hardware_concurrency()
{
return sysconf(_SC_NPROCESSORS_ONLN);
}
ErrorOr<String> resolve_executable_from_environment(StringView filename, int flags)
{
if (filename.is_empty())

View file

@ -276,6 +276,8 @@ ErrorOr<AddressInfoVector> getaddrinfo(char const* nodename, char const* servnam
ErrorOr<void> posix_fallocate(int fd, off_t offset, off_t length);
#endif
unsigned hardware_concurrency();
ErrorOr<String> resolve_executable_from_environment(StringView filename, int flags = 0);
ErrorOr<ByteString> current_executable_path();