From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/9211 Path: news.gmane.org!not-for-mail From: Szabolcs Nagy Newsgroups: gmane.linux.lib.musl.general Subject: Re: [PATCH] Separate siginfo_t for MIPS Date: Wed, 27 Jan 2016 02:03:57 +0100 Message-ID: <20160127010356.GP9621@port70.net> References: <20151210124712.3b4b811fd0d99a5b482b4ee3@ubnt.com> <20151210123633.GD23362@port70.net> <20151216043428.GC238@brightrain.aerifal.cx> <20160126222453.GN9621@port70.net> <20160126225757.GI238@brightrain.aerifal.cx> <20160126233231.GO9621@port70.net> Reply-To: musl@lists.openwall.com NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="adJ1OR3c6QgCpb/j" X-Trace: ger.gmane.org 1453856654 14541 80.91.229.3 (27 Jan 2016 01:04:14 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 27 Jan 2016 01:04:14 +0000 (UTC) To: musl@lists.openwall.com Original-X-From: musl-return-9224-gllmg-musl=m.gmane.org@lists.openwall.com Wed Jan 27 02:04:14 2016 Return-path: Envelope-to: gllmg-musl@m.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by plane.gmane.org with smtp (Exim 4.69) (envelope-from ) id 1aOEWq-0002r6-Nt for gllmg-musl@m.gmane.org; Wed, 27 Jan 2016 02:04:13 +0100 Original-Received: (qmail 19674 invoked by uid 550); 27 Jan 2016 01:04:09 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Original-Received: (qmail 19655 invoked from network); 27 Jan 2016 01:04:08 -0000 Mail-Followup-To: musl@lists.openwall.com Content-Disposition: inline In-Reply-To: <20160126233231.GO9621@port70.net> User-Agent: Mutt/1.5.24 (2015-08-30) Xref: news.gmane.org gmane.linux.lib.musl.general:9211 Archived-At: --adJ1OR3c6QgCpb/j Content-Type: text/plain; charset=us-ascii Content-Disposition: inline * Szabolcs Nagy [2016-01-27 00:32:32 +0100]: > * Rich Felker [2016-01-26 17:57:57 -0500]: > > On Tue, Jan 26, 2016 at 11:24:54PM +0100, Szabolcs Nagy wrote: > > > * Rich Felker [2015-12-15 23:34:28 -0500]: > > > > On Thu, Dec 10, 2015 at 01:36:33PM +0100, Szabolcs Nagy wrote: > > > > > * Dmitry Ivanov [2015-12-10 12:47:12 +0200]: > > > > > > MIPS has non-default siginfo_t structure. Also, some si_code values are > > > > > > different. This patch is required for POSIX timers to work. > > > .... > > > > #define si_errno si_code > > #define si_code si_errno instead of such confusing hack reorder the bits inclusion in signal.h --adJ1OR3c6QgCpb/j Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="0001-move-bits-signal.h-include-close-to-the-top-of-signa.patch" >From 680ee704efddb07f1b79e92f1dbf25b25f6fdc70 Mon Sep 17 00:00:00 2001 From: Szabolcs Nagy Date: Wed, 27 Jan 2016 00:40:32 +0000 Subject: [PATCH 1/2] move bits/signal.h include close to the top of signal.h only have code above the bits/signal.h include that is necessary. (some types are used for the ucontext struct and mips has to override a few macro definitions) this way mips bits/signal.h will be able to affect siginfo_t. --- include/signal.h | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/include/signal.h b/include/signal.h index 559362f..8df725d 100644 --- a/include/signal.h +++ b/include/signal.h @@ -27,8 +27,6 @@ extern "C" { #include -#define SIG_HOLD ((void (*)(int)) 2) - #define SIG_BLOCK 0 #define SIG_UNBLOCK 1 #define SIG_SETMASK 2 @@ -43,6 +41,18 @@ extern "C" { #define SI_USER 0 #define SI_KERNEL 128 +typedef struct sigaltstack stack_t; + +#endif + +#include + +#if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \ + || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) \ + || defined(_BSD_SOURCE) + +#define SIG_HOLD ((void (*)(int)) 2) + #define FPE_INTDIV 1 #define FPE_INTOVF 2 #define FPE_FLTDIV 3 @@ -78,8 +88,6 @@ extern "C" { #define CLD_STOPPED 5 #define CLD_CONTINUED 6 -typedef struct sigaltstack stack_t; - union sigval { int sival_int; void *sival_ptr; @@ -240,8 +248,6 @@ int sigandset(sigset_t *, const sigset_t *, const sigset_t *); #define SA_ONESHOT SA_RESETHAND #endif -#include - #define SIG_ERR ((void (*)(int))-1) #define SIG_DFL ((void (*)(int)) 0) #define SIG_IGN ((void (*)(int)) 1) -- 2.7.0 --adJ1OR3c6QgCpb/j Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="0002-fix-siginfo_t-for-mips.patch" >From 3365723da2b4aa3f82f101f63649b3c03ee1898c Mon Sep 17 00:00:00 2001 From: Szabolcs Nagy Date: Wed, 27 Jan 2016 00:54:25 +0000 Subject: [PATCH 2/2] fix siginfo_t for mips si_errno and si_code are swapped in mips siginfo_t compared to other archs and some si_code values are different. This fix is required for POSIX timers to work. based on patch by Dmitry Ivanov. --- arch/mips/bits/signal.h | 9 +++++++++ include/signal.h | 4 ++++ 2 files changed, 13 insertions(+) diff --git a/arch/mips/bits/signal.h b/arch/mips/bits/signal.h index 818e0a7..889f77e 100644 --- a/arch/mips/bits/signal.h +++ b/arch/mips/bits/signal.h @@ -73,6 +73,15 @@ typedef struct __ucontext { #define SIG_UNBLOCK 2 #define SIG_SETMASK 3 +#undef SI_ASYNCIO +#undef SI_MESGQ +#undef SI_TIMER +#define SI_ASYNCIO (-2) +#define SI_MESGQ (-4) +#define SI_TIMER (-3) + +#define __SI_SWAP_ERRNO_CODE + #endif #define SIGHUP 1 diff --git a/include/signal.h b/include/signal.h index 8df725d..c6323c6 100644 --- a/include/signal.h +++ b/include/signal.h @@ -94,7 +94,11 @@ union sigval { }; typedef struct { +#ifdef __SI_SWAP_ERRNO_CODE + int si_signo, si_code, si_errno; +#else int si_signo, si_errno, si_code; +#endif union { char __pad[128 - 2*sizeof(int) - sizeof(long)]; struct { -- 2.7.0 --adJ1OR3c6QgCpb/j--