summaryrefslogtreecommitdiff
path: root/Libraries/LibC
diff options
context:
space:
mode:
authorNico Weber <thakis@chromium.org>2020-07-14 16:41:59 -0400
committerAndreas Kling <kling@serenityos.org>2020-07-15 00:07:20 +0200
commit4eb967b5ebd5ca7a00049c7f958011e54b975040 (patch)
tree25da6871473ae3484cf3c1c894b287b8be42626c /Libraries/LibC
parent782cd93c012bcad8a96dfd67aeb782ef49d380f9 (diff)
downloadserenity-4eb967b5ebd5ca7a00049c7f958011e54b975040.zip
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.
Diffstat (limited to 'Libraries/LibC')
-rw-r--r--Libraries/LibC/unistd.cpp6
-rw-r--r--Libraries/LibC/unistd.h6
2 files changed, 12 insertions, 0 deletions
diff --git a/Libraries/LibC/unistd.cpp b/Libraries/LibC/unistd.cpp
index 80b05a16af..30929d47c1 100644
--- a/Libraries/LibC/unistd.cpp
+++ b/Libraries/LibC/unistd.cpp
@@ -722,4 +722,10 @@ char* getpass(const char* prompt)
dbg() << "FIXME: getpass(\"" << prompt << "\")";
ASSERT_NOT_REACHED();
}
+
+long sysconf(int name)
+{
+ int rc = syscall(SC_sysconf, name);
+ __RETURN_WITH_ERRNO(rc, rc, -1);
+}
}
diff --git a/Libraries/LibC/unistd.h b/Libraries/LibC/unistd.h
index 8a9687dc39..5836018975 100644
--- a/Libraries/LibC/unistd.h
+++ b/Libraries/LibC/unistd.h
@@ -172,4 +172,10 @@ enum {
#define _POSIX_PRIORITY_SCHEDULING
#define _POSIX_VDISABLE '\0'
+enum {
+ _SC_NPROCESSORS_CONF,
+ _SC_NPROCESSORS_ONLN,
+};
+long sysconf(int name);
+
__END_DECLS