mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 11:17:44 +00:00
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:
parent
782cd93c01
commit
4eb967b5eb
9 changed files with 34 additions and 14 deletions
|
@ -191,7 +191,8 @@ namespace Kernel {
|
|||
__ENUMERATE_SYSCALL(ptrace) \
|
||||
__ENUMERATE_SYSCALL(minherit) \
|
||||
__ENUMERATE_SYSCALL(sendfd) \
|
||||
__ENUMERATE_SYSCALL(recvfd)
|
||||
__ENUMERATE_SYSCALL(recvfd) \
|
||||
__ENUMERATE_SYSCALL(sysconf)
|
||||
|
||||
namespace Syscall {
|
||||
|
||||
|
|
|
@ -744,6 +744,8 @@ public:
|
|||
|
||||
static Processor& by_id(u32 cpu);
|
||||
|
||||
static size_t processor_count() { return processors().size(); }
|
||||
|
||||
template<typename Callback>
|
||||
static inline IterationDecision for_each(Callback callback)
|
||||
{
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -327,6 +327,7 @@ public:
|
|||
int sys$ptrace(const Syscall::SC_ptrace_params*);
|
||||
int sys$sendfd(int sockfd, int fd);
|
||||
int sys$recvfd(int sockfd);
|
||||
long sys$sysconf(int name);
|
||||
|
||||
template<bool sockname, typename Params>
|
||||
int get_sock_or_peer_name(const Params&);
|
||||
|
|
|
@ -55,6 +55,11 @@
|
|||
#define MS_RDONLY (1 << 4)
|
||||
#define MS_REMOUNT (1 << 5)
|
||||
|
||||
enum {
|
||||
_SC_NPROCESSORS_CONF,
|
||||
_SC_NPROCESSORS_ONLN,
|
||||
};
|
||||
|
||||
#define PERF_EVENT_MALLOC 1
|
||||
#define PERF_EVENT_FREE 2
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue