From 721788943d9385b16521c91ab3121dbd8f7b4ff3 Mon Sep 17 00:00:00 2001 From: Luke Date: Wed, 9 Sep 2020 08:35:02 +0100 Subject: [PATCH] Kernel: Implement _SC_OPEN_MAX --- Kernel/Syscalls/sysconf.cpp | 2 ++ Kernel/UnixTypes.h | 1 + Libraries/LibC/unistd.h | 2 ++ 3 files changed, 5 insertions(+) diff --git a/Kernel/Syscalls/sysconf.cpp b/Kernel/Syscalls/sysconf.cpp index 5c25b414632..243d39ea55c 100644 --- a/Kernel/Syscalls/sysconf.cpp +++ b/Kernel/Syscalls/sysconf.cpp @@ -37,6 +37,8 @@ long Process::sys$sysconf(int name) return Processor::processor_count(); case _SC_PAGESIZE: return PAGE_SIZE; + case _SC_OPEN_MAX: + return max_open_file_descriptors(); default: return -EINVAL; } diff --git a/Kernel/UnixTypes.h b/Kernel/UnixTypes.h index f056d483049..2d50eb65c6b 100644 --- a/Kernel/UnixTypes.h +++ b/Kernel/UnixTypes.h @@ -60,6 +60,7 @@ enum { _SC_NPROCESSORS_CONF, _SC_NPROCESSORS_ONLN, _SC_PAGESIZE, + _SC_OPEN_MAX }; #define PERF_EVENT_MALLOC 1 diff --git a/Libraries/LibC/unistd.h b/Libraries/LibC/unistd.h index 0faa5f43970..8d1e2bd6a07 100644 --- a/Libraries/LibC/unistd.h +++ b/Libraries/LibC/unistd.h @@ -174,11 +174,13 @@ enum { _SC_NPROCESSORS_CONF, _SC_NPROCESSORS_ONLN, _SC_PAGESIZE, + _SC_OPEN_MAX, }; #define _SC_NPROCESSORS_CONF _SC_NPROCESSORS_CONF #define _SC_NPROCESSORS_ONLN _SC_NPROCESSORS_ONLN #define _SC_PAGESIZE _SC_PAGESIZE +#define _SC_OPEN_MAX _SC_OPEN_MAX long sysconf(int name);