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

[Minios-devel] [UNIKRAFT PATCH 2/2] lib/uksysinfo: Add sysinfo stub



Add sysinfo stub, needed by lowjs build.

Signed-off-by: Felipe Huici <felipe.huici@xxxxxxxxx>
---
 lib/uksysinfo/exportsyms.uk         |  1 +
 lib/uksysinfo/include/sys/sysinfo.h | 62 +++++++++++++++++++++++++++++
 lib/uksysinfo/sysinfo.c             |  5 +++
 3 files changed, 68 insertions(+)
 create mode 100644 lib/uksysinfo/include/sys/sysinfo.h

diff --git a/lib/uksysinfo/exportsyms.uk b/lib/uksysinfo/exportsyms.uk
index 73e1fe99..d5131332 100644
--- a/lib/uksysinfo/exportsyms.uk
+++ b/lib/uksysinfo/exportsyms.uk
@@ -1,5 +1,6 @@
 fpathconf
 sysconf
+sysinfo
 confstr
 pathconf
 getpagesize
diff --git a/lib/uksysinfo/include/sys/sysinfo.h 
b/lib/uksysinfo/include/sys/sysinfo.h
new file mode 100644
index 00000000..2141f555
--- /dev/null
+++ b/lib/uksysinfo/include/sys/sysinfo.h
@@ -0,0 +1,62 @@
+/* SPDX-License-Identifier: MIT */
+/* ----------------------------------------------------------------------
+ * Copyright <C2><A9> 2005-2014 Rich Felker, et al.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ * ----------------------------------------------------------------------
+ */
+/* Taken from musl-1.1.19 */
+
+#ifndef _SYS_SYSINFO_H
+#define _SYS_SYSINFO_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define SI_LOAD_SHIFT 16
+
+struct sysinfo {
+       unsigned long uptime;
+       unsigned long loads[3];
+       unsigned long totalram;
+       unsigned long freeram;
+       unsigned long sharedram;
+       unsigned long bufferram;
+       unsigned long totalswap;
+       unsigned long freeswap;
+       unsigned short procs, pad;
+       unsigned long totalhigh;
+       unsigned long freehigh;
+       unsigned mem_unit;
+       char __reserved[256];
+};
+
+int sysinfo (struct sysinfo *);
+int get_nprocs_conf (void);
+int get_nprocs (void);
+long get_phys_pages (void);
+long get_avphys_pages (void);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/lib/uksysinfo/sysinfo.c b/lib/uksysinfo/sysinfo.c
index 6adcf221..ececdea1 100644
--- a/lib/uksysinfo/sysinfo.c
+++ b/lib/uksysinfo/sysinfo.c
@@ -57,6 +57,11 @@ static struct utsname utsname = {
 #endif
 };
 
+int sysinfo(struct sysinfo *info)
+{
+       return -1;
+}
+
 long fpathconf(int fd __unused, int name __unused)
 {
        return 0;
-- 
2.20.1


_______________________________________________
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®.