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

login
register
mail settings
Submitter Khem Raj
Date July 13, 2011, 4:19 a.m.
Message ID <1310530784-16538-1-git-send-email-raj.khem@gmail.com>
Download mbox | patch
Permalink /patch/7467/
State New, archived
Headers show

Comments

Khem Raj - July 13, 2011, 4:19 a.m.
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.

Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 .../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
Phil Blundell - July 13, 2011, 9:48 a.m.
On Tue, 2011-07-12 at 21:19 -0700, Khem Raj wrote:
> ++#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.
Khem Raj - July 13, 2011, 6:16 p.m.
On Wed, Jul 13, 2011 at 2:48 AM, Phil Blundell <pb@pbcl.net> wrote:
> On Tue, 2011-07-12 at 21:19 -0700, Khem Raj wrote:
>> ++#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.

>
> p.
>
>
>
> _______________________________________________
> Openembedded-core mailing list
> Openembedded-core@lists.openembedded.org
> http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/openembedded-core
>

Patch

diff --git a/meta/recipes-devtools/strace/strace-4.5.20/sigmask.patch b/meta/recipes-devtools/strace/strace-4.5.20/sigmask.patch
new file mode 100644
index 0000000..f99abe9
--- /dev/null
+++ b/meta/recipes-devtools/strace/strace-4.5.20/sigmask.patch
@@ -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 <raj.khem@gmail.com>
+
+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"
+ };
diff --git a/meta/recipes-devtools/strace/strace_4.5.20.bb b/meta/recipes-devtools/strace/strace_4.5.20.bb
index 3dba59f..391669f 100644
--- a/meta/recipes-devtools/strace/strace_4.5.20.bb
+++ b/meta/recipes-devtools/strace/strace_4.5.20.bb
@@ -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"