]> xenbits.xensource.com Git - unikraft/libs/newlib.git/commitdiff
Use Unikraft __getreent() when scheduling is enabled
authorCostin Lupu <costin.lupu@cs.pub.ro>
Fri, 22 Mar 2019 14:11:07 +0000 (16:11 +0200)
committerFlorian Schmidt <florian.schmidt@neclab.eu>
Fri, 22 Mar 2019 15:59:34 +0000 (16:59 +0100)
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@cs.pub.ro>
Reviewed-by: Florian Schmidt <florian.schmidt@neclab.eu>
Makefile.uk
include/time.h

index 5db32b2fa94f6aebec85bee9e61f25a4dd1bfe28..5635f44a7d5e1e76e8148566e834d5c146ed47f5 100644 (file)
@@ -312,12 +312,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
index b51b2dd0538f88d52ef08481ad185ed4dbeac970..dd2eef2835ccc85c64555c7db58eaaff705403db 100644 (file)
 /* 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 */