mailing list of musl libc
 help / color / mirror / code / Atom feed
From: Szabolcs Nagy <nsz@port70.net>
To: musl@lists.openwall.com
Subject: Re: [PATCH] Separate siginfo_t for MIPS
Date: Tue, 26 Jan 2016 23:24:54 +0100	[thread overview]
Message-ID: <20160126222453.GN9621@port70.net> (raw)
In-Reply-To: <20151216043428.GC238@brightrain.aerifal.cx>

[-- Attachment #1: Type: text/plain, Size: 1099 bytes --]

* Rich Felker <dalias@libc.org> [2015-12-15 23:34:28 -0500]:
> On Thu, Dec 10, 2015 at 01:36:33PM +0100, Szabolcs Nagy wrote:
> > * Dmitry Ivanov <dmitrijs.ivanovs@ubnt.com> [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.
...
> > until then i think it's enough to fix it in signal.h
> > with some dirty ifdef around these members.
> 
> Indeed, I think a makeshift solution could work okay here and avoid
> moving this large, redundant structure into bits/signal.h. However I'd
> rather not depend on compiler-predefined macros (like __mips__ in
> Dmitry's second patch) in public headers, since we don't assume
> particular compilers for compiling applications.
> 
> Ideally bits/signal.h would define something in the reserved namespace
> to change the behavior of the top-level signal.h. However
> bits/signal.h needs to be towards the bottom of signal.h for other
> reasons, so I don't see a really clean solution. Ideas?

workaround solution attached, only build tested

[-- Attachment #2: sig.diff --]
[-- Type: text/x-diff, Size: 1183 bytes --]

diff --git a/arch/mips/bits/signal.h b/arch/mips/bits/signal.h
index 818e0a7..50a0061 100644
--- a/arch/mips/bits/signal.h
+++ b/arch/mips/bits/signal.h
@@ -73,6 +73,18 @@ 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)
+
+#undef si_errno
+#undef si_code
+#define si_errno __si_code
+#define si_code  __si_errno
+
 #endif
 
 #define SIGHUP    1
diff --git a/include/signal.h b/include/signal.h
index 559362f..3496942 100644
--- a/include/signal.h
+++ b/include/signal.h
@@ -86,7 +86,7 @@ union sigval {
 };
 
 typedef struct {
-	int si_signo, si_errno, si_code;
+	int si_signo, __si_errno, __si_code;
 	union {
 		char __pad[128 - 2*sizeof(int) - sizeof(long)];
 		struct {
@@ -127,6 +127,8 @@ typedef struct {
 		} __sigsys;
 	} __si_fields;
 } siginfo_t;
+#define si_errno   __si_errno
+#define si_code    __si_code
 #define si_pid     __si_fields.__si_common.__first.__piduid.si_pid
 #define si_uid     __si_fields.__si_common.__first.__piduid.si_uid
 #define si_status  __si_fields.__si_common.__second.__sigchld.si_status

  reply	other threads:[~2016-01-26 22:24 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-10 10:47 Dmitry Ivanov
2015-12-10 12:36 ` Szabolcs Nagy
2015-12-10 13:49   ` [PATCH v2] Different " Dmitry Ivanov
2015-12-16  4:34   ` [PATCH] Separate " Rich Felker
2016-01-26 22:24     ` Szabolcs Nagy [this message]
2016-01-26 22:57       ` Rich Felker
2016-01-26 23:32         ` Szabolcs Nagy
2016-01-27  1:03           ` Szabolcs Nagy
2016-01-27  3:33             ` Rich Felker

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160126222453.GN9621@port70.net \
    --to=nsz@port70.net \
    --cc=musl@lists.openwall.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).