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

[Minios-devel] [UNIKRAFT/NEWLIB PATCH v2 4/6] Yet another try to fix the __rtems__ shenanigans



Originally, we defined __rtems__ in sys/stat.h because we wanted it to
provide st_{a,c,m}tim in struct stat. That lead to some unintended side
effects, so we reduced the scope to only that header file by
conditional-defining-and-undefining. It turns out even that has
unintended side effects regarding the definition of sigaddset etc.

Considering that we're not really the RTEMS OS, let's try this the other
way round and provide a patch instead that unconditionally gives us
st_{a,c,m}tim, and to not touch __rtems__ definitions.

Signed-off-by: Florian Schmidt <florian.schmidt@xxxxxxxxx>
Reviewed-by: Felipe Huici <felipe.huici@xxxxxxxxx>
---
 include/sys/stat.h                            | 13 -----
 include/time.h                                | 29 ----------
 ...003-sys-stat.h-provide-st_-a-c-m-tim.patch | 55 +++++++++++++++++++
 3 files changed, 55 insertions(+), 42 deletions(-)
 create mode 100644 patches/0003-sys-stat.h-provide-st_-a-c-m-tim.patch

diff --git a/include/sys/stat.h b/include/sys/stat.h
index 07a9fab..8b43716 100644
--- a/include/sys/stat.h
+++ b/include/sys/stat.h
@@ -1,21 +1,8 @@
 #ifndef _NEWLIB_GLUE_SYS_STAT_H_
 #define _NEWLIB_GLUE_SYS_STAT_H_
 
-/* define __rtems__ only if not previously defined */
-#ifndef __rtems__
-/* A definition only for this header */
-#define __undef_rtems___NEWLIB_GLUE_SYS_STAT_H_
-#define __rtems__
-#endif
-
 #include_next <sys/stat.h>
 
-/* cleanup __rtems__ */
-#ifdef __undef_rtems___NEWLIB_GLUE_SYS_STAT_H_
-#undef __rtems__
-#undef __undef_rtems___NEWLIB_GLUE_SYS_STAT_H_
-#endif
-
 #define UTIME_NOW  0x3fffffff
 #define UTIME_OMIT 0x3ffffffe
 
diff --git a/include/time.h b/include/time.h
index 2718515..5361876 100644
--- a/include/time.h
+++ b/include/time.h
@@ -41,36 +41,7 @@
  * such as nanosleep
  */
 #define _POSIX_TIMERS 1
-
-/* define __rtems__ only if not previously defined */
-#ifndef __rtems__
-/* A definition only for this header */
-#define __undef_rtems__NEWLIBGLUE_TIME_H
-#define __rtems__
-
-/*
- * __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__ */
-
 #define _POSIX_MONOTONIC_CLOCK 1
 #include_next <time.h>
 
-/* cleanup __rtems__ */
-#ifdef __undef_rtems__NEWLIBGLUE_TIME_H
-#undef __rtems__
-#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 */
diff --git a/patches/0003-sys-stat.h-provide-st_-a-c-m-tim.patch 
b/patches/0003-sys-stat.h-provide-st_-a-c-m-tim.patch
new file mode 100644
index 0000000..e8c8047
--- /dev/null
+++ b/patches/0003-sys-stat.h-provide-st_-a-c-m-tim.patch
@@ -0,0 +1,55 @@
+From ec3f6adeefbd5f707e84eee74c0da1f691bad4eb Mon Sep 17 00:00:00 2001
+From: Florian Schmidt <florian.schmidt@xxxxxxxxx>
+Date: Wed, 17 Apr 2019 15:05:20 +0200
+Subject: [PATCH] sys/stat.h: provide st_{a,c,m}tim;
+
+Signed-off-by: Florian Schmidt <florian.schmidt@xxxxxxxxx>
+---
+ newlib/libc/include/sys/stat.h | 21 ---------------------
+ 1 file changed, 21 deletions(-)
+
+diff --git a/newlib/libc/include/sys/stat.h b/newlib/libc/include/sys/stat.h
+index eee98db64..0d2b9c9de 100644
+--- a/newlib/libc/include/sys/stat.h
++++ b/newlib/libc/include/sys/stat.h
+@@ -34,37 +34,16 @@ struct     stat
+   gid_t               st_gid;
+   dev_t               st_rdev;
+   off_t               st_size;
+-#if defined(__rtems__)
+   struct timespec st_atim;
+   struct timespec st_mtim;
+   struct timespec st_ctim;
+   blksize_t     st_blksize;
+   blkcnt_t    st_blocks;
+-#else
+-  /* SysV/sco doesn't have the rest... But Solaris, eabi does.  */
+-#if defined(__svr4__) && !defined(__PPC__) && !defined(__sun__)
+-  time_t      st_atime;
+-  time_t      st_mtime;
+-  time_t      st_ctime;
+-#else
+-  time_t      st_atime;
+-  long                st_spare1;
+-  time_t      st_mtime;
+-  long                st_spare2;
+-  time_t      st_ctime;
+-  long                st_spare3;
+-  blksize_t   st_blksize;
+-  blkcnt_t    st_blocks;
+-  long        st_spare4[2];
+-#endif
+-#endif
+ };
+ 
+-#if defined(__rtems__)
+ #define st_atime st_atim.tv_sec
+ #define st_ctime st_ctim.tv_sec
+ #define st_mtime st_mtim.tv_sec
+-#endif
+ 
+ #endif
+ 
+-- 
+2.21.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®.