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

[Minios-devel] [UNIKRAFT PATCH 1/1] lib/uksysinfo: Introduce uksysinfo library



Library to provide access to info about system parameters. Only
fpathconf, sysconf, confstr and pathconf are implemented for now.

Signed-off-by: Vlad-Andrei Badoiu <vlad_andrei.badoiu@xxxxxxxxxxxxxxx>
---
 lib/Config.uk               |  1 +
 lib/Makefile.uk             |  1 +
 lib/uksysinfo/Config.uk     |  3 ++
 lib/uksysinfo/Makefile.uk   |  3 ++
 lib/uksysinfo/exportsyms.uk |  4 +++
 lib/uksysinfo/sysinfo.c     | 56 +++++++++++++++++++++++++++++++++++++
 6 files changed, 68 insertions(+)
 create mode 100644 lib/uksysinfo/Config.uk
 create mode 100644 lib/uksysinfo/Makefile.uk
 create mode 100644 lib/uksysinfo/exportsyms.uk
 create mode 100644 lib/uksysinfo/sysinfo.c

diff --git a/lib/Config.uk b/lib/Config.uk
index 553d4c6b..822c624f 100644
--- a/lib/Config.uk
+++ b/lib/Config.uk
@@ -31,6 +31,7 @@ source "lib/ukboot/Config.uk"
 source "lib/ukdebug/Config.uk"
 source "lib/ukargparse/Config.uk"
 source "lib/ukunistd/Config.uk"
+source "lib/uksysinfo/Config.uk"
 source "lib/uktimeconv/Config.uk"
 source "lib/nolibc/Config.uk"
 source "lib/ukalloc/Config.uk"
diff --git a/lib/Makefile.uk b/lib/Makefile.uk
index 54a957de..d06837f1 100644
--- a/lib/Makefile.uk
+++ b/lib/Makefile.uk
@@ -7,6 +7,7 @@
 $(eval $(call _import_lib,$(CONFIG_UK_BASE)/lib/ukboot))
 $(eval $(call _import_lib,$(CONFIG_UK_BASE)/lib/ukswrand))
 $(eval $(call _import_lib,$(CONFIG_UK_BASE)/lib/ukunistd))
+$(eval $(call _import_lib,$(CONFIG_UK_BASE)/lib/uksysinfo))
 $(eval $(call _import_lib,$(CONFIG_UK_BASE)/lib/ukdebug))
 $(eval $(call _import_lib,$(CONFIG_UK_BASE)/lib/ukargparse))
 $(eval $(call _import_lib,$(CONFIG_UK_BASE)/lib/uktimeconv))
diff --git a/lib/uksysinfo/Config.uk b/lib/uksysinfo/Config.uk
new file mode 100644
index 00000000..03d60739
--- /dev/null
+++ b/lib/uksysinfo/Config.uk
@@ -0,0 +1,3 @@
+menuconfig UKSYSINFO
+       bool "uksysinfo: info about system parameters"
+       default n
diff --git a/lib/uksysinfo/Makefile.uk b/lib/uksysinfo/Makefile.uk
new file mode 100644
index 00000000..707c69f4
--- /dev/null
+++ b/lib/uksysinfo/Makefile.uk
@@ -0,0 +1,3 @@
+$(eval $(call addlib_s,uksysinfo,$(CONFIG_UKSYSINFO)))
+
+UKSYSINFO_SRCS-$(CONFIG_UKSYSINFO) += $(UKSYSINFO_BASE)/sysinfo.c
diff --git a/lib/uksysinfo/exportsyms.uk b/lib/uksysinfo/exportsyms.uk
new file mode 100644
index 00000000..af962c8b
--- /dev/null
+++ b/lib/uksysinfo/exportsyms.uk
@@ -0,0 +1,4 @@
+fpathconf
+sysconf
+confstr
+pathconf
diff --git a/lib/uksysinfo/sysinfo.c b/lib/uksysinfo/sysinfo.c
new file mode 100644
index 00000000..d9d00c70
--- /dev/null
+++ b/lib/uksysinfo/sysinfo.c
@@ -0,0 +1,56 @@
+/* SPDX-License-Identifier: BSD-3-Clause */
+/*
+ * Authors: Badoiu Vlad-Andrei <vlad_andrei.badoiu@xxxxxxxxxxxxxxx>
+ *
+ * Copyright (c) 2019, University Politehnica of Bucharest. All rights 
reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the copyright holder nor the names of its
+ *    contributors may be used to endorse or promote products derived from
+ *    this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ * THIS HEADER MAY NOT BE EXTRACTED OR MODIFIED IN ANY WAY.
+ */
+
+#include <stddef.h>
+#include <uk/essentials.h>
+
+long fpathconf(int fd __unused, int name __unused)
+{
+        return 0;
+}
+
+long pathconf(const char *path __unused, int name __unused)
+{
+        return 0;
+}
+
+long sysconf(int name __unused)
+{
+        return 0;
+}
+
+size_t confstr(int name __unused, char *buf __unused, size_t len __unused)
+{
+        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®.