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

Re: [Minios-devel] [UNIKRAFT/NEWLIB PATCH] Use Unikraft __getreent() when scheduling is enabled



Hi Costin,

Thanks for the patch! I won't say it looks nice... that's an awful lot of def/undef going on. However, it does the job, and I can't think of a better way from the top of my head either, especially not one that covers different build scenarios. So I think this is a good solution considering the circumstances and restrictions, thanks for submitting. Glue code, alas.

Cheers,
Florian

Reviewed-by: Florian Schmidt <florian.schmidt@xxxxxxxxx>

On 3/22/19 3:11 PM, Costin Lupu wrote:
When scheduling is enabled, Unikraft provides the __getreent() function.

The current patch also fixes the compilation warnings that occur
because of __DYNAMIC_REENT__ redefinition when __rtems__ is defined.

Signed-off-by: Costin Lupu <costin.lupu@xxxxxxxxx>
---
  Makefile.uk    |  7 ++++++-
  include/time.h | 17 ++++++++++++++++-
  2 files changed, 22 insertions(+), 2 deletions(-)

diff --git a/Makefile.uk b/Makefile.uk
index 6a918b8..44bb13e 100644
--- a/Makefile.uk
+++ b/Makefile.uk
@@ -311,12 +311,17 @@ LIBNEWLIBC_SRCS-y += $(LIBNEWLIB_LIBC)/posix/regfree.c
  
################################################################################
  # Newlib/libc code -- reent
  
################################################################################
+ifeq ($(CONFIG_HAVE_SCHED),y)
+# if scheduling enabled, then Unikraft provides __getreent()
+LIBNEWLIBC_CFLAGS-y += -D__DYNAMIC_REENT__
+else
+LIBNEWLIBC_SRCS-y += $(LIBNEWLIB_LIBC)/reent/getreent.c
+endif
  LIBNEWLIBC_SRCS-y += $(LIBNEWLIB_LIBC)/reent/closer.c
  LIBNEWLIBC_SRCS-y += $(LIBNEWLIB_LIBC)/reent/reent.c
  LIBNEWLIBC_SRCS-y += $(LIBNEWLIB_LIBC)/reent/impure.c
  LIBNEWLIBC_SRCS-y += $(LIBNEWLIB_LIBC)/reent/fcntlr.c
  LIBNEWLIBC_SRCS-y += $(LIBNEWLIB_LIBC)/reent/fstatr.c
-LIBNEWLIBC_SRCS-y += $(LIBNEWLIB_LIBC)/reent/getreent.c
  LIBNEWLIBC_SRCS-y += $(LIBNEWLIB_LIBC)/reent/gettimeofdayr.c
  LIBNEWLIBC_SRCS-y += $(LIBNEWLIB_LIBC)/reent/isattyr.c
  LIBNEWLIBC_SRCS-y += $(LIBNEWLIB_LIBC)/reent/linkr.c
diff --git a/include/time.h b/include/time.h
index b51b2dd..dd2eef2 100644
--- a/include/time.h
+++ b/include/time.h
@@ -47,7 +47,17 @@
  /* A definition only for this header */
  #define __undef_rtems__NEWLIBGLUE_TIME_H
  #define __rtems__
-#endif
+
+/*
+ * __DYNAMIC_REENT__ is defined in sys/config.h if
+ * __rtems__ is defined; we undefine it in order to
+ * avoid warnings.
+ */
+#ifdef __DYNAMIC_REENT__
+#define __define_DYNAMIC_REENT__NEWLIBGLUE_TIME_H
+#undef __DYNAMIC_REENT__
+#endif /* __DYNAMIC_REENT__ */
+#endif /* __rtems__ */
#include_next <time.h> @@ -57,4 +67,9 @@
  #undef __undef_rtems__NEWLIBGLUE_TIME_H
  #endif
+#ifdef __define_DYNAMIC_REENT__NEWLIBGLUE_TIME_H
+#define __DYNAMIC_REENT__
+#undef __define_DYNAMIC_REENT__NEWLIBGLUE_TIME_H
+#endif
+
  #endif /* NEWLIBGLUE_TIME_H */


--
Dr. Florian Schmidt
フローリアン・シュミット
Research Scientist,
Systems and Machine Learning Group
NEC Laboratories Europe
Kurfürsten-Anlage 36, D-69115 Heidelberg
Tel.     +49 (0)6221 4342-265
Fax:     +49 (0)6221 4342-155
e-mail:  florian.schmidt@xxxxxxxxx
============================================================
Registered at Amtsgericht Mannheim, Germany, HRB728558

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