Re: NPTL on ARM isseu with __aeabi_unwind_cpp_pr0

2012-01-11 Thread Carmelo Amoroso
On 05/01/12 14:42, Johannes Stezenbach wrote:
 On Mon, Dec 12, 2011 at 12:13:49PM +0100, Johannes Stezenbach wrote:
 On Thu, Dec 01, 2011 at 08:58:24AM +0100, Carmelo AMOROSO wrote:
 On 01/12/2011 6.29, Khem Raj wrote:
 On (29/11/11 17:05), Johannes Stezenbach wrote:
 static linking on ARM with NPTL causes duplicate symbol
 errors for __aeabi_unwind_cpp_pr0.  I think it is
 both gcc and uClibc issue.
 hmm this object is added to libc-shared-y so I think it should not be
 part of static libc

 however I see that it does not make that distinction for librt or
 libpthread so if you link with librt.a then this object will get in way
 probably it should not exist in static versions of these libs as well.

 I' think to have a clean fix for this. Let me send the patch so you can
 look at it.
 Do you have the patch ready for testing?
 I have some time to test it this week.
 Just a reminder that this issue is still open.  If you have a patch,
 please send it.

 Thanks
 Johannes

it's on my todo list, but I'm a bit busy in thee days.
not needed to remind it again.

thanks for your patience.

carmelo




 ___
 uClibc mailing list
 uClibc@uclibc.org
 http://lists.busybox.net/mailman/listinfo/uclibc

___
uClibc mailing list
uClibc@uclibc.org
http://lists.busybox.net/mailman/listinfo/uclibc


Conformance of the system() call

2012-01-11 Thread Richard Braun
Hello,

It looks like the system() function as used with linuxthreads (or on
sparc) doesn't block SIGCHLD but resets the default handler instead,
which may result in lost signals if a custom handler was installed.

Attached is a small source file that demonstrates the issue. A patch
will follow as a reply to this message.

Thanks.

-- 
Richard Braun
#include stdio.h
#include signal.h
#include stdlib.h
#include unistd.h

static void die(const char *f)
{
perror(f);
exit(EXIT_FAILURE);
}

#define MSG SIGCHLD received\n

static void handle_sigchld(int signum)
{
(void)signum;

write(1, MSG, sizeof(MSG) - 1);
}

int main(int argc, char *argv[])
{
struct sigaction sa;
char tmp[64];
int ret;

sa.sa_handler = handle_sigchld;
sigemptyset(sa.sa_mask);
sa.sa_flags = 0;

ret = sigaction(SIGCHLD, sa, NULL);

if (ret)
die(sigaction);

snprintf(tmp, sizeof(tmp), kill -CHLD %d, getpid());
ret = system(tmp);

if (ret == -1)
die(system);

return EXIT_SUCCESS;
}
___
uClibc mailing list
uClibc@uclibc.org
http://lists.busybox.net/mailman/listinfo/uclibc

[PATCH] libc: make system() block SIGCHLD

2012-01-11 Thread Richard Braun
When built with an old thread implementation (or for a sparc target),
the implementation of the system() function doesn't conform to its
specification. Namely, it resets the SIGCHLD handler to its default
instead of blocking the signal, which may result in lost signals
if a custom handler was installed. Replace this by appropriate calls
to sigprocmask().

Signed-off-by: Richard Braun rbr...@sceen.net
---
 libc/stdlib/system.c |   22 +-
 1 files changed, 17 insertions(+), 5 deletions(-)

diff --git a/libc/stdlib/system.c b/libc/stdlib/system.c
index a0ff726..4ed6618 100644
--- a/libc/stdlib/system.c
+++ b/libc/stdlib/system.c
@@ -33,25 +33,34 @@ extern __typeof(system) __libc_system;
 int __libc_system(const char *command)
 {
int wait_val, pid;
-   __sighandler_t save_quit, save_int, save_chld;
+   __sighandler_t save_quit, save_int;
+   sigset_t smask, omask;
 
if (command == 0)
return 1;
 
save_quit = signal(SIGQUIT, SIG_IGN);
save_int = signal(SIGINT, SIG_IGN);
-   save_chld = signal(SIGCHLD, SIG_DFL);
+
+   sigemptyset(smask);
+   sigaddset(smask, SIGCHLD);
+
+   if (sigprocmask(SIG_BLOCK, smask, omask) != 0) {
+   signal(SIGQUIT, save_quit);
+   signal(SIGINT, save_int);
+   return -1;
+   }
 
if ((pid = vfork())  0) {
signal(SIGQUIT, save_quit);
signal(SIGINT, save_int);
-   signal(SIGCHLD, save_chld);
+   sigprocmask(SIG_SETMASK, omask, NULL);
return -1;
}
if (pid == 0) {
signal(SIGQUIT, SIG_DFL);
signal(SIGINT, SIG_DFL);
-   signal(SIGCHLD, SIG_DFL);
+   sigprocmask(SIG_SETMASK, omask, NULL);
 
execl(/bin/sh, sh, -c, command, (char *) 0);
_exit(127);
@@ -69,7 +78,10 @@ int __libc_system(const char *command)
 
signal(SIGQUIT, save_quit);
signal(SIGINT, save_int);
-   signal(SIGCHLD, save_chld);
+
+   if (sigprocmask(SIG_SETMASK, omask, NULL) != 0)
+   wait_val = -1;
+
return wait_val;
 }
 #else
-- 
1.7.2.5

___
uClibc mailing list
uClibc@uclibc.org
http://lists.busybox.net/mailman/listinfo/uclibc