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

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



Library to provide access to POSIX operating system APIs. Only
getuid is implemented for now.

Signed-off-by: Felipe Huici <felipe.huici@xxxxxxxxx>
---
 lib/Config.uk              |  1 +
 lib/Makefile.uk            |  1 +
 lib/ukunistd/Config.uk     |  3 +++
 lib/ukunistd/Makefile.uk   |  3 +++
 lib/ukunistd/exportsyms.uk |  1 +
 lib/ukunistd/getuid.c      | 41 +++++++++++++++++++++++++++++++++++++++++
 6 files changed, 50 insertions(+)
 create mode 100644 lib/ukunistd/Config.uk
 create mode 100644 lib/ukunistd/Makefile.uk
 create mode 100644 lib/ukunistd/exportsyms.uk
 create mode 100644 lib/ukunistd/getuid.c

diff --git a/lib/Config.uk b/lib/Config.uk
index 7d86f76c..553d4c6b 100644
--- a/lib/Config.uk
+++ b/lib/Config.uk
@@ -30,6 +30,7 @@ config HAVE_NW_STACK
 source "lib/ukboot/Config.uk"
 source "lib/ukdebug/Config.uk"
 source "lib/ukargparse/Config.uk"
+source "lib/ukunistd/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 d66c7ee9..54a957de 100644
--- a/lib/Makefile.uk
+++ b/lib/Makefile.uk
@@ -6,6 +6,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/ukdebug))
 $(eval $(call _import_lib,$(CONFIG_UK_BASE)/lib/ukargparse))
 $(eval $(call _import_lib,$(CONFIG_UK_BASE)/lib/uktimeconv))
diff --git a/lib/ukunistd/Config.uk b/lib/ukunistd/Config.uk
new file mode 100644
index 00000000..be0c94e1
--- /dev/null
+++ b/lib/ukunistd/Config.uk
@@ -0,0 +1,3 @@
+menuconfig UKUNISTD
+       bool "ukunistd: POSIX operating system API"
+       default n
diff --git a/lib/ukunistd/Makefile.uk b/lib/ukunistd/Makefile.uk
new file mode 100644
index 00000000..c0e9b180
--- /dev/null
+++ b/lib/ukunistd/Makefile.uk
@@ -0,0 +1,3 @@
+$(eval $(call addlib_s,ukunistd,$(CONFIG_UKUNISTD)))
+
+UKUNISTD_SRCS-$(CONFIG_UKUNISTD) += $(UKUNISTD_BASE)/getuid.c
diff --git a/lib/ukunistd/exportsyms.uk b/lib/ukunistd/exportsyms.uk
new file mode 100644
index 00000000..11bdffc2
--- /dev/null
+++ b/lib/ukunistd/exportsyms.uk
@@ -0,0 +1 @@
+getuid
diff --git a/lib/ukunistd/getuid.c b/lib/ukunistd/getuid.c
new file mode 100644
index 00000000..d8ad7c86
--- /dev/null
+++ b/lib/ukunistd/getuid.c
@@ -0,0 +1,41 @@
+/* SPDX-License-Identifier: BSD-3-Clause */
+/*
+ * Authors: Felipe Huici <felipe.huici@xxxxxxxxx>
+ *          Simon Kuenzer <simon.kuenzer@xxxxxxxxx>
+ *
+ * Copyright (c) 2018, NEC Europe Ltd., NEC Corporation. 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 <unistd.h>
+#include <sys/types.h>
+
+uid_t getuid(void) {
+       return 0;
+}
-- 
2.11.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®.