All of lore.kernel.org
 help / color / mirror / Atom feed
From: Petr Vorel <petr.vorel@gmail.com>
To: ltp@lists.linux.it
Subject: [LTP] [PATCH 1/5] rt_sigaction.h: Check for type sighandler_t and use if present
Date: Mon, 18 Mar 2019 04:23:26 +0100	[thread overview]
Message-ID: <20190318032330.3346-2-petr.vorel@gmail.com> (raw)
In-Reply-To: <20190318032330.3346-1-petr.vorel@gmail.com>

__sighandler_t is libc implementation specific and should not be relied
upon. Instead, we fall back upon void (*)(int), as specified by POSIX.

This fixes MUSL build.

Credits: taken from util-linux

Signed-off-by: Petr Vorel <petr.vorel@gmail.com>
---
 include/lapi/rt_sigaction.h | 8 ++++++++
 m4/ltp-sighandler_t.m4      | 8 ++++++++
 2 files changed, 16 insertions(+)
 create mode 100644 m4/ltp-sighandler_t.m4

diff --git a/include/lapi/rt_sigaction.h b/include/lapi/rt_sigaction.h
index 2dbbc7672..ff1a7314d 100644
--- a/include/lapi/rt_sigaction.h
+++ b/include/lapi/rt_sigaction.h
@@ -36,12 +36,20 @@
 #if defined(__mips__)
 struct kernel_sigaction {
 	unsigned int sa_flags;
+# ifdef HAVE_SIGHANDLER_T
 	__sighandler_t k_sa_handler;
+# else
+void (* k_sa_handler)(int);
+# endif
 	sigset_t sa_mask;
 };
 #else
 struct kernel_sigaction {
+# ifdef HAVE_SIGHANDLER_T
 	__sighandler_t k_sa_handler;
+# else
+void (* k_sa_handler)(int);
+# endif
 	unsigned long sa_flags;
 	void (*sa_restorer) (void);
 	sigset_t sa_mask;
diff --git a/m4/ltp-sighandler_t.m4 b/m4/ltp-sighandler_t.m4
new file mode 100644
index 000000000..97c70a269
--- /dev/null
+++ b/m4/ltp-sighandler_t.m4
@@ -0,0 +1,8 @@
+dnl SPDX-License-Identifier: GPL-2.0-or-later
+dnl Copyright (c) 2019 Petr Vorel <petr.vorel@gmail.com>
+
+AC_DEFUN([LTP_CHECK_SIGHANDLER_T],[
+AC_CHECK_TYPES([sighandler_t], [], [], [[
+#include <signal.h>
+]])
+])
-- 
2.20.1


  reply	other threads:[~2019-03-18  3:23 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-18  3:23 [LTP] [PATCH 0/5] Some MUSL fixes Petr Vorel
2019-03-18  3:23 ` Petr Vorel [this message]
2019-03-18 15:40   ` [LTP] [PATCH 1/5] rt_sigaction.h: Check for type sighandler_t and use if present Cyril Hrubis
2019-03-18 18:43     ` Petr Vorel
2019-03-18  3:23 ` [LTP] [PATCH 2/5] {rt_, }sigaction: Define _GNU_SOURCE to get SA_NOMASK on MUSL Petr Vorel
2019-03-18 15:41   ` Cyril Hrubis
2019-03-18  3:23 ` [LTP] [PATCH 3/5] ptrace: Use int instead of enum __ptrace_request Petr Vorel
2019-03-18 15:50   ` Cyril Hrubis
2019-03-18  3:23 ` [LTP] [PATCH 4/5] mremap: Define _GNU_SOURCE to get MREMAP_MAYMOVE on MUSL Petr Vorel
2019-03-18 15:51   ` Cyril Hrubis
2019-03-18  3:23 ` [LTP] [PATCH 5/5] mallopt: Test only on glibc Petr Vorel
2019-03-18 15:59   ` Cyril Hrubis

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=20190318032330.3346-2-petr.vorel@gmail.com \
    --to=petr.vorel@gmail.com \
    --cc=ltp@lists.linux.it \
    /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.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.