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

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


  • To: minios-devel@xxxxxxxxxxxxx
  • From: Costin Lupu <costin.lupu@xxxxxxxxx>
  • Date: Thu, 22 Aug 2019 13:10:55 +0300
  • Cc: felipe.huici@xxxxxxxxx, charalampos.mainas@xxxxxxxxx
  • Delivery-date: Thu, 22 Aug 2019 10:12:06 +0000
  • Ironport-phdr: 9a23:kAk48BMwKtXh/y16Xt0l6mtUPXoX/o7sNwtQ0KIMzox0IvTzrarrMEGX3/hxlliBBdydt6sezbOK7uu6AiQp2tWoiDg6aptCVhsI2409vjcLJ4q7M3D9N+PgdCcgHc5PBxdP9nC/NlVJSo6lPwWB6nK94iQPFRrhKAF7Ovr6GpLIj8Swyuu+54Dfbx9HiTagf79+Ngi6oArRu8UZn4dvJLs6xwfUrHdPZ+lY335jK0iJnxb76Mew/Zpj/DpVtvk86cNOUrj0crohQ7BAAzsoL2465MvwtRneVgSP/WcTUn8XkhVTHQfI6gzxU4rrvSv7sup93zSaPdHzQLspVzmu87tnRRn1gyoBKjU38nzYitZogaxbvhyvuhJxzY3Tbo6XOvpzZb/Rcc8ASGZdRMtdSzBND4WhZIUPFeoBOuNYopHjqlsJthu+GQisBOXywTFOm3/2xbA62PkmHA7a2wwgBM4OsHXSrNnvMKcSTPi1zLTTwDrfdPNawy/96JXTfRw7u/GMWqt9fMzMwkcsDwPIlkicpIP4Mz+P1ekAs3KX4/R+We+tkWIqpRl9riWgy8sxkIXEhYIYxkra+Sh3zos5P8C0RUFlbdOiDZBerTuVN5FsTcMnW2xovSE6xaAYtpOjZygKzYgnxwbYa/yab4iE+hLjW/iVITd/nH9lZre/iAyz8Uik0OHzStK03ExSripYidbArGoN1xvL5siGTPty4Fuh1C6S2w3c9+1IO0M5mKrBJ5I/3LI9lIAfvErbEi/zgkr2jauWdks++uiv7uTqeqnpppiHN49oiwH+NL4imsiiAeQgLwgDRHSU+f+m2L374E32W69GjucxkqXBqpDVOdwbprKlAw9Syosj7he/DzGn0NQfhnkLNU9KdwyZj4f3P1HDO/T4Dfakg1Swizdn3f/HMaPnApnXKXjDirjhd65n60FA0Aoz0cxf55VMB74dIPL8QFXxu8bcDhAjNgy02+HnCM5n2oMbQ22PA6mZP7nJsVKT4OIgPfWDZIsPtznmMfQq+ePuh2cjmVABZampwYcXaHegE/RoPUqZZXvsgs8fHmsQvgo+Ue3qh0GDUTNIYXa9Qb4z5jUhB429F4vMWJ2t0/S923K+H5tXYXsDBl2SHHPAc4SfR+xKeC+UZMh7nW8qT7+kHqQmzg2vskfe1qJ6Zr7f/TYEtJSl0MVt+sXYjlcq6DYyFcPLgDLFdH19gm5dH2x+56t4u0Eoklo=
  • Ironport-sdr: zOIsx0O/y4aaLmlchnMqzEg88YIAOIM3scarB3wrjNbDarKvDG/SCPwQub2tYkhEHUgp0m6mXp yfrnAeoshjZQ==
  • List-id: Mini-os development list <minios-devel.lists.xenproject.org>

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