LibC+Kernel: Start implementing sysconf

For now, only the non-standard _SC_NPROCESSORS_CONF and
_SC_NPROCESSORS_ONLN are implemented.

Use them to make ninja pick a better default -j value.
While here, make the ninja package script not fail if
no other port has been built yet.
This commit is contained in:
Nico Weber 2020-07-14 16:41:59 -04:00 committed by Andreas Kling
commit 4eb967b5eb
Notes: sideshowbarker 2024-07-19 04:49:35 +09:00
9 changed files with 34 additions and 14 deletions

View file

@ -5308,4 +5308,15 @@ int Process::sys$recvfd(int sockfd)
m_fds[new_fd].set(*received_descriptor_or_error.value(), 0);
return new_fd;
}
long Process::sys$sysconf(int name)
{
switch (name) {
case _SC_NPROCESSORS_CONF:
case _SC_NPROCESSORS_ONLN:
return Processor::processor_count();
default:
return -EINVAL;
}
}
}