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

[Minios-devel] [UNIKRAFT/NEWLIB PATCH v2] Fix __rtems__ usage in glue code headers


  • To: minios-devel@xxxxxxxxxxxxx
  • From: Costin Lupu <costin.lupu@xxxxxxxxx>
  • Date: Thu, 14 Mar 2019 11:41:00 +0200
  • Cc: Florian.Schmidt@xxxxxxxxx, simon.kuenzer@xxxxxxxxx, yuri.volchkov@xxxxxxxxx, sharan.santhanam@xxxxxxxxx
  • Delivery-date: Thu, 14 Mar 2019 09:41:14 +0000
  • Ironport-phdr: 9a23:u9qaGB8kdw2oFf9uRHKM819IXTAuvvDOBiVQ1KB22uIcTK2v8tzYMVDF4r011RmVBN2ds6sMotGVmpioYXYH75eFvSJKW713fDhBt/8rmRc9CtWOE0zxIa2iRSU7GMNfSA0tpCnjYgBaF8nkelLdvGC54yIMFRXjLwp1Ifn+FpLPg8it2O2+5oHfbx9UiDagfLh/MAi4oQLNu8cMnIBsMLwxyhzHontJf+RZ22ZlLk+Nkhj/+8m94odt/zxftPw9+cFAV776f7kjQrxDEDsmKWE169b1uhTFUACC+2ETUmQSkhpPHgjF8BT3VYr/vyfmquZw3jSRMMvrRr42RDui9b9mRh/2hikaOTA382bZh9dsgK5Huh+tuwZyz5LIbIyTKfFwfrndfdQfRWdZQMtRUDdBAp+9b4sJEuEPO/tYr5Hgp1ATqhaxGQ6sBPjzyj9JgH/6x6k60/k5EQHbxwEvA8kOvG7MrNXoL6geS/q1zK7RwDjFcvhY2i/95ZDVfh0uvP2AR7F9fMrLxUUxCQ/IjE+cpIL9Mz+I2ekBrnKX4ulgWO61lWIqpQ98riKyysojlIXEgJ8exEre+iVj2ok1IMW1SEt8YdG5DpRdrzqaN45qQsM6RGFopTo6xqUGuZGleCgKz4wqxwDaa/OdcoiI5gjvW/qKITtinHJlZamwiwyo8Uin0uH8V8+030hWriddj9XBuW0B2wbQ58WHUPdx4Fmt1DSV2w3d8u1EJFo7lavfK54v2L4wkZ8TvFzfES/xg0X2kK6WdkM+9uis9uTneqjmq4SAOI9vkA3+KrkuldelDeQiNQgCR3Kb9vik1L3/4U35R61Hjvg3kqnfsZDaIt8bqrekDABLzIYs9RK/Aiyi0NQZhnkHMElFdAiIjof3PVHCOvf4De2wg160ijdk2+jGPqH9ApXKNnXNkLPhfbFn605d0gUzy8pT6Y9IBbEBJfLzW1L+tMDDAx8/LQO73+LnB89m2Y8ER22PH7eTMLnOvl+Q+uIvP+6MaZcOuDb9Mfcl/eThjXkjlV8GZ6ap24cXaHCiEfRgOUqZZGHhgtEfHmgWugoxVvflhEecXj5Of3yyRb4z5iknCIK6CofOXputgL2E3Ce8GJ1afGNGCk2SHnfudoSLRe0MZTmUIsB/jjMEUaKuRJQ72R6wqQ/w06BnIfbM+i0EqZLj08B45u3OlREo9Dx4Fdqd02aJT25onmMIRDg23L5krEx71FiMzax4jOZDGtBJ+fxJT1RyCZmJyu18CtfpHw7MYNqNYFKnWcm9RyE8SJQ22dBdTVx6HoCJiQvf3iziJ6INivTfD5sv7qPamXzsP9tVwG2AzLQryUMhFJgcfVa6j7JyolCAT7XClF+Uwv6n
  • Ironport-sdr: MpkJHvcd+cm7Rcfw10Hm5BKnXVIXJ7UIcrwxVWF4ldW4wvts4z8gIYJXpO+Qf/ECyNNDNL0IDH 3hi7FDqLoVPQ==
  • List-id: Mini-os development list <minios-devel.lists.xenproject.org>

In order to use __rtems__ one has to define it in all affected headers.
Besides 'sys/stat.h', we also identified 'time.h'. Moreover, we define
__rtems__ only if it was not previously defined.

Signed-off-by: Costin Lupu <costin.lupu@xxxxxxxxx>
---
 include/sys/stat.h | 13 ++++++++++---
 include/time.h     | 14 ++++++++++++++
 2 files changed, 24 insertions(+), 3 deletions(-)

diff --git a/include/sys/stat.h b/include/sys/stat.h
index c87a29b..07a9fab 100644
--- a/include/sys/stat.h
+++ b/include/sys/stat.h
@@ -1,13 +1,20 @@
 #ifndef _NEWLIB_GLUE_SYS_STAT_H_
 #define _NEWLIB_GLUE_SYS_STAT_H_
 
-#ifdef __rtems__
-#error "Unexpected definition of __rtems__. Please revisit this header 
wrapper."
+/* 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
 
-#define __rtems__
 #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 e8201a0..b51b2dd 100644
--- a/include/time.h
+++ b/include/time.h
@@ -41,6 +41,20 @@
  * 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__
+#endif
+
 #include_next <time.h>
 
+/* cleanup __rtems__ */
+#ifdef __undef_rtems__NEWLIBGLUE_TIME_H
+#undef __rtems__
+#undef __undef_rtems__NEWLIBGLUE_TIME_H
+#endif
+
 #endif /* NEWLIBGLUE_TIME_H */
-- 
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®.