[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Minios-devel] [UNIKRAFT PATCH v2 2/2] lib/uksysinfo: Implement sysconf check for _SC_NPROCESSORS_ONLN



From: Vlad-Andrei BĂDOIU (78692) <vlad_andrei.badoiu@xxxxxxxxxxxxxxx>

The sysconf function should return the number of active processors when
_SC_NPROCESSORS_ONLN is passed. Since we do not have SMP on Unikraft we return 1
when _SC_NPROCESSORS_ONLN is passed as argument to the function.

Signed-off-by: Vlad-Andrei Badoiu <vlad_andrei.badoiu@xxxxxxxxxxxxxxx>
---
 lib/uksysinfo/sysinfo.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/lib/uksysinfo/sysinfo.c b/lib/uksysinfo/sysinfo.c
index 4c133493..3bff4e6f 100644
--- a/lib/uksysinfo/sysinfo.c
+++ b/lib/uksysinfo/sysinfo.c
@@ -34,6 +34,7 @@
 
 #include <stddef.h>
 #include <limits.h>
+#include <unistd.h>
 #include <sys/utsname.h>
 #include <uk/essentials.h>
 
@@ -47,8 +48,11 @@ long pathconf(const char *path __unused, int name __unused)
        return 0;
 }
 
-long sysconf(int name __unused)
+long sysconf(int name)
 {
+       if (name == _SC_NPROCESSORS_ONLN)
+               return 1;
+
        return 0;
 }
 
-- 
2.21.0

_______________________________________________
Minios-devel mailing list
Minios-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/minios-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.