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

Re: [Minios-devel] [UNIKRAFT/NEWLIB PATCH 15/16] Fix signal related issues



Hello Costin,

this patch looks good.

Thank you.


Reviewed-by: Charalampos Mainas <charalampos.mainas@xxxxxxxxx>




From: Costin Lupu <costin.lupu@xxxxxxxxx>
Sent: Thursday, August 22, 2019 12:10 PM
To: minios-devel@xxxxxxxxxxxxx
Cc: Felipe Huici; Charalampos Mainas
Subject: [UNIKRAFT/NEWLIB PATCH 15/16] Fix signal related issues
 
1. We enable _POSIX_REALTIME_SIGNALS preprocessing flag in order to use
siginfo_t definition.

2. We extend the siginfo_t definition with si_addr field by patching original
code. Further more, we use the same definition of struct sigaction as in the
case of RTEMS.

3. We have a circular inclusion cycle in the original code, where time.h
includes signal.h and viceversa. We fix this by using forward declaration in the
original code (again, by patching).

Signed-off-by: Costin Lupu <costin.lupu@xxxxxxxxx>
---
 Makefile.uk                                   |  6 ++-
 ...d-for-siginfo_t-and-use-__rtems__-de.patch | 47 +++++++++++++++++++
 ...aration-in-order-to-avoid-warnings-b.patch | 26 ++++++++++
 3 files changed, 78 insertions(+), 1 deletion(-)
 create mode 100644 patches/0006-Add-si_addr-field-for-siginfo_t-and-use-__rtems__-de.patch
 create mode 100644 patches/0007-Add-forward-declaration-in-order-to-avoid-warnings-b.patch

diff --git a/Makefile.uk b/Makefile.uk
index 75e074a..7e72da4 100644
--- a/Makefile.uk
+++ b/Makefile.uk
@@ -80,7 +80,11 @@ LIBNEWLIBM_CXXINCLUDES += -I$(LIBNEWLIB_LIBM)/common
 ################################################################################
 # Global flags
 ################################################################################
-LIBNEWLIBC_CFLAGS-y       += -DMISSING_SYSCALL_NAMES -DMALLOC_PROVIDED
+LIBNEWLIB_GLOBAL_FLAGS-y  += -DMISSING_SYSCALL_NAMES -DMALLOC_PROVIDED
+LIBNEWLIB_GLOBAL_FLAGS-y  += -D_POSIX_REALTIME_SIGNALS
+
+CFLAGS-y   += $(LIBNEWLIB_GLOBAL_FLAGS-y)
+CXXFLAGS-y += $(LIBNEWLIB_GLOBAL_FLAGS-y)
 
 # Suppress some warnings to make the build process look neater
 LIBNEWLIB_SUPPRESS_FLAGS-y += \
diff --git a/patches/0006-Add-si_addr-field-for-siginfo_t-and-use-__rtems__-de.patch b/patches/0006-Add-si_addr-field-for-siginfo_t-and-use-__rtems__-de.patch
new file mode 100644
index 0000000..5741fec
--- /dev/null
+++ b/patches/0006-Add-si_addr-field-for-siginfo_t-and-use-__rtems__-de.patch
@@ -0,0 +1,47 @@
+From 7d668a38739f734ed1edc6aab925baf9f19f5ca4 Mon Sep 17 00:00:00 2001
+From: Costin Lupu <costin.lup@xxxxxxxxx>
+Date: Fri, 16 Aug 2019 20:19:14 +0200
+Subject: [PATCH] Add si_addr field for siginfo_t and use __rtems__
+ declarations
+
+Signed-off-by: Costin Lupu <costin.lupu@xxxxxxxxx>
+---
+ newlib/libc/include/sys/signal.h | 19 ++++++++++++++++++-
+ 1 file changed, 18 insertions(+), 1 deletion(-)
+
+diff --git a/newlib/libc/include/sys/signal.h b/newlib/libc/include/sys/signal.h
+index ab35718..f87ed6c 100644
+--- a/newlib/libc/include/sys/signal.h
++++ b/newlib/libc/include/sys/signal.h
+@@ -69,10 +69,27 @@ typedef struct {
+   int          si_signo;    /* Signal number */
+   int          si_code;     /* Cause of the signal */
+   union sigval si_value;    /* Signal value */
++
++  union {
++  struct {
++    void *si_addr;
++    short si_addr_lsb;
++      union {
++        struct {
++          void *si_lower;
++          void *si_upper;
++        } __addr_bnd;
++        unsigned si_pkey;
++      } __first;
++    } __sigfault;
++  } __si_fields;
++
+ } siginfo_t;
++
++#define si_addr    __si_fields.__sigfault.si_addr
+ #endif /* defined(_POSIX_REALTIME_SIGNALS) || __POSIX_VISIBLE >= 199309 */
+
+-#if defined(__rtems__)
++#if defined(__rtems__) || defined(__Unikraft__)
+
+ /*  3.3.8 Synchronously Accept a Signal, P1003.1b-1993, p. 76 */
+
+--
+2.20.1
+
diff --git a/patches/0007-Add-forward-declaration-in-order-to-avoid-warnings-b.patch b/patches/0007-Add-forward-declaration-in-order-to-avoid-warnings-b.patch
new file mode 100644
index 0000000..bd20cfa
--- /dev/null
+++ b/patches/0007-Add-forward-declaration-in-order-to-avoid-warnings-b.patch
@@ -0,0 +1,26 @@
+From a73ec52fac6847dcb16a4aa458a11d33cf3cceb5 Mon Sep 17 00:00:00 2001
+From: Costin Lupu <costin.lup@xxxxxxxxx>
+Date: Sat, 17 Aug 2019 00:13:48 +0200
+Subject: [PATCH] Add forward declaration in order to avoid warnings because of
+ circular inclusion
+
+Signed-off-by: Costin Lupu <costin.lupu@xxxxxxxxx>
+---
+ newlib/libc/include/time.h | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/newlib/libc/include/time.h b/newlib/libc/include/time.h
+index 8806b98..32baed9 100644
+--- a/newlib/libc/include/time.h
++++ b/newlib/libc/include/time.h
+@@ -189,6 +189,7 @@ int _EXFUN(clock_getres,  (clockid_t clock_id, struct timespec *res));
+
+ /* Create a Per-Process Timer, P1003.1b-1993, p. 264 */
+
++struct sigevent;
+ int _EXFUN(timer_create,
+        (clockid_t clock_id,
+        struct sigevent *__restrict evp,
+--
+2.20.1
+
--
2.20.1

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