Skip to contentSkip to conversation

strace: Define own sigmask macro if not defined already in signal.h

PATCH In review Khem Raj 2 participants 4 messages Jul 13, 2011

lore
Share & tools
lore

Khem Raj

author
#0 lore raw

PATCH 1/2 strace: Define own sigmask macro if not defined already in signal.h

This is required especially on uclibc systems where BSD compatible obsolete functions are disabled by kconfig. Therefore we check if the macro is undefined then we define it. Therefore eglibc/glibc builds should work as they use to.

---
 .../strace/strace-4.5.20/sigmask.patch             |   21 ++++++++++++++++++++
 meta/recipes-devtools/strace/strace_4.5.20.bb      |    6 +++-
 2 files changed, 25 insertions(+), 2 deletions(-)
 create mode 100644 meta/recipes-devtools/strace/strace-4.5.20/sigmask.patch
meta/recipes-devtools/strace/strace-4.5.20/sigmask.patch new file +21 -0
new file mode 100644
index 0000000..f99abe9
@@ -0,0 +1,21 @@
+sigmask is a macro which is dropped if BSD compatibility is
+not enabled. So we check if the macro does not exist then
+we define it to __sigmask
+
+Signed-off-by: Khem Raj <[email protected]>
+
+Index: strace-4.5.20/signal.c
+===================================================================
+--- strace-4.5.20.orig/signal.c	2010-02-23 13:26:16.000000000 -0800
++++ strace-4.5.20/signal.c	2011-07-12 21:08:58.628861476 -0700
+@@ -140,6 +140,10 @@
+ #endif
+ #endif /* LINUX */
+ 
++#ifndef sigmask
++/* Compute mask for signal SIG.  */
++#define sigmask(sig)   __sigmask(sig)
++#endif /* sigmask */
+ const char *const signalent0[] = {
+ #include "signalent.h"
+ };
meta/recipes-devtools/strace/strace_4.5.20.bb +4 -2
index 3dba59f..391669f 100644
@@ -3,9 +3,11 @@ HOMEPAGE = "http://strace.sourceforge.net"
 SECTION = "console/utils"
 LICENSE = "BSD"
 LIC_FILES_CHKSUM = "file://COPYRIGHT;md5=4535377ede62550fdeaf39f595fd550a"
-PR = "r1"
+PR = "r2"
 
-SRC_URI = "${SOURCEFORGE_MIRROR}/strace/strace-${PV}.tar.bz2"
+SRC_URI = "${SOURCEFORGE_MIRROR}/strace/strace-${PV}.tar.bz2 \
+           file://sigmask.patch \
+          "
 
 SRC_URI[md5sum] = "64dfe10d9db0c1e34030891695ffca4b"
 SRC_URI[sha256sum] = "ea8c059369eaa5ad90b246f34eab247d0ee48bfdee2670c7196320a4669ccabd"
Signature · 1 line
1.7.5.1
author
#1 lore raw

PATCH 2/2 util-linux: Replace sigsetmask with posix compliant functions

This patch is not needed upstream since the code using sigsetmask has been deleted.

---
 .../util-linux-2.19.1/remove_sigsetmark.patch      |   35 ++++++++++++++++++++
 meta/recipes-core/util-linux/util-linux_2.19.1.bb  |    3 +-
 2 files changed, 37 insertions(+), 1 deletions(-)
 create mode 100644 meta/recipes-core/util-linux/util-linux-2.19.1/remove_sigsetmark.patch
meta/recipes-core/util-linux/util-linux-2.19.1/remove_sigsetmark.patch new file +35 -0
new file mode 100644
index 0000000..02e4d16
@@ -0,0 +1,35 @@
+simpleinit: remove deprecated sigsetmask()
+
+The sigsetmask() is deprecated in favor of sigprocmask().
+
+This is not needed upstream since simpleinit is removed from
+util-linux-ng master
+
+Signed-off-by: Khem Raj <[email protected]>
+
+Upstream-Status: Inappropriate
+
+Index: util-linux-2.19.1/simpleinit/shutdown.c
+===================================================================
+--- util-linux-2.19.1.orig/simpleinit/shutdown.c	2011-03-04 03:47:47.000000000 -0800
++++ util-linux-2.19.1/simpleinit/shutdown.c	2011-07-06 08:43:39.183849752 -0700
+@@ -145,7 +145,7 @@
+ {
+ 	int c, i, fd;
+ 	char *ptr;
+-
++	sigset_t sigmask;
+ 	i = getdtablesize ();
+ 	for (fd = 3; fd < i; fd++) close (fd);
+ 	if (getpid () == 1)
+@@ -153,7 +153,9 @@
+ 	    for (fd = 0; fd < 3; fd++) close (fd);
+ 	    while (1) wait (NULL);  /*  Grim reaper never stops  */
+ 	}
+-	sigsetmask (0); /*  simpleinit(8) blocks all signals: undo for ALRM  */
++	/*  simpleinit(8) blocks all signals: undo for ALRM  */
++	sigemptyset(&sigmask);
++	sigprocmask (SIG_SETMASK, &sigmask, NULL);
+ 	for (i = 1; i < NSIG; i++) signal (i, SIG_DFL);
+ 
+         setlocale(LC_ALL, "");
meta/recipes-core/util-linux/util-linux_2.19.1.bb +2 -1
index 0fd67d1..2ef95e6 100644
@@ -1,5 +1,5 @@
 MAJOR_VERSION = "2.19"
-PR = "r2"
+PR = "r3"
 require util-linux.inc
 
 # note that `lscpu' is under GPLv3+
@@ -8,6 +8,7 @@ LICENSE_util-linux-lscpu = "GPLv3+"
 SRC_URI += "file://util-linux-ng-replace-siginterrupt.patch \
             file://util-linux-ng-2.16-mount_lock_path.patch \
             file://uclibc-__progname-conflict.patch \      
+            file://remove_sigsetmark.patch \
 "
 
 SRC_URI[md5sum] = "3eab06f05163dfa65479c44e5231932c"
Signature · 1 line
1.7.5.1
#2 lore raw
In reply to Khem Raj
Quoted 4 lines · Khem Raj

++#ifndef sigmask
++/* Compute mask for signal SIG. */
++#define sigmask(sig) __sigmask(sig)
++#endif /* sigmask */

That looks a bit dubious to me. If this is relying on some uclibc implementation detail then I think it should either be applied for uclibc only, or guarded with something like "#if defined(__UCLIBC__) && !defined(sigmask)". Otherwise you might end up trying to call __sigmask() on non-uclibc systems which could have unwanted effects.

p.

author
#3 lore raw
Quoted 11 lines · Phil Blundell
Quoted 4 lines · Khem Raj

++#ifndef sigmask
++/* Compute mask for signal SIG.  */
++#define sigmask(sig)   __sigmask(sig)
++#endif /* sigmask */

That looks a bit dubious to me.  If this is relying on some uclibc implementation detail then I think it should either be applied for uclibc only, or guarded with something like "#if defined(__UCLIBC__) && !defined(sigmask)".  Otherwise you might end up trying to call __sigmask() on non-uclibc systems which could have unwanted effects.

in general for eglibc/glibc it wont matter since signal.h defines sigmask and is defined to point to __sigmask but for non glibc/eglibc libc yes there is a
chance.

Quoted 10 lines

p.

_______________________________________________
Openembedded-core mailing list
[email protected]
http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/openembedded-core