svn commit: branches/uClibc-nptl: libc/pwd_grp libc/signal libc/stdlib lib etc...
Peter S. Mazinger
ps.m at gmx.net
Thu Dec 8 11:45:13 UTC 2005
On Wed, 7 Dec 2005 sjhill at uclibc.org wrote:
> Author: sjhill
> Date: 2005-12-07 20:57:34 -0800 (Wed, 07 Dec 2005)
> New Revision: 12720
>
> Log:
> Fix 'sigaction' for NPTL and other thread models.
Could you explain me the rationals of all these signals? I couldn't really
find the correct way to implement these. My consideration was:
__sigaction should be used internally within libc only (but due to the
fact that it is used in a macro iirc, I have renamed that to
__sigaction_internal, making an alias from it to
__sigaction/__libc_sigaction and sigaction)
Now if you remove #define sigaction __sigaction_internal, then all those
sources will use sigaction , not the internal version (thus using the
unhidden version and adding JUMP relocation). I have thought that
__libc_sigaction is what should be used externally (by pthreads/nptl),
and that is visible, but it seems that you don't make use of it.
The way you changed it, __sigaction_internal is completely useless,
because it is not used by anyone.
So how to handle it? The internally used versions within libc should make
use of an "own" hidden sigaction. How should pthreads overwrite the one in
libc if needed.
> Modified:
> branches/uClibc-nptl/libc/pwd_grp/lckpwdf.c
> branches/uClibc-nptl/libc/signal/sigaction.c
> branches/uClibc-nptl/libc/signal/sigignore.c
> branches/uClibc-nptl/libc/signal/sigintr.c
> branches/uClibc-nptl/libc/signal/signal.c
> branches/uClibc-nptl/libc/signal/sigset.c
> branches/uClibc-nptl/libc/signal/sysv_signal.c
> branches/uClibc-nptl/libc/stdlib/abort.c
> branches/uClibc-nptl/libc/sysdeps/linux/common/__syscall_rt_sigaction.c
> branches/uClibc-nptl/libc/sysdeps/linux/common/ssp.c
> branches/uClibc-nptl/libc/sysdeps/linux/mips/sigaction.c
> branches/uClibc-nptl/libc/unistd/sleep.c
> branches/uClibc-nptl/libpthread/nptl/init.c
> branches/uClibc-nptl/libpthread/nptl/sysdeps/pthread/sigaction.c
>
>
> Changeset:
> Modified: branches/uClibc-nptl/libc/pwd_grp/lckpwdf.c
> ===================================================================
> --- branches/uClibc-nptl/libc/pwd_grp/lckpwdf.c 2005-12-08 04:53:18 UTC (rev 12719)
> +++ branches/uClibc-nptl/libc/pwd_grp/lckpwdf.c 2005-12-08 04:57:34 UTC (rev 12720)
> @@ -20,7 +20,6 @@
> Boston, MA 02111-1307, USA. */
>
> #define sigfillset __sigfillset_internal
> -#define sigaction __sigaction_internal
>
> #include <features.h>
> #include <fcntl.h>
>
> Modified: branches/uClibc-nptl/libc/sysdeps/linux/common/__syscall_rt_sigaction.c
> ===================================================================
> --- branches/uClibc-nptl/libc/sysdeps/linux/common/__syscall_rt_sigaction.c 2005-12-08 04:53:18 UTC (rev 12719)
> +++ branches/uClibc-nptl/libc/sysdeps/linux/common/__syscall_rt_sigaction.c 2005-12-08 04:57:34 UTC (rev 12720)
> @@ -14,7 +14,7 @@
>
> #define __NR___syscall_rt_sigaction __NR_rt_sigaction
> #undef sigaction
> -attribute_hidden _syscall4(int, __syscall_rt_sigaction, int, signum,
> +_syscall4(int, __syscall_rt_sigaction, int, signum,
> const struct sigaction *, act, struct sigaction *, oldact,
> size_t, size);
I can't see why you should need this, you make __syscall_rt_sigaction
visible for no use. This code was moved probably out of sigaction.c, so
that it does not have to be duplicated in arch/sigaction.c
If attribute_hidden shouldn't be applied for some reason, the other way to
get rid of the visibility is to duplicate the code in each
arch/sigaction.c and make it static inline (they are the only users)
> --- branches/uClibc-nptl/libpthread/nptl/init.c 2005-12-08 04:53:18 UTC (rev 12719)
> +++ branches/uClibc-nptl/libpthread/nptl/init.c 2005-12-08 04:57:34 UTC (rev 12720)
> @@ -264,13 +264,13 @@
> sa.sa_flags = SA_SIGINFO;
> __sigemptyset (&sa.sa_mask);
>
> - (void) __libc_sigaction (SIGCANCEL, &sa, NULL);
> + (void) __sigaction_internal (SIGCANCEL, &sa, NULL);
that can work only if code is compiled in libc.so, but not in libpthread,
because _internal is hidden
>
> /* Install the handle to change the threads' uid/gid. */
> sa.sa_sigaction = sighandler_setxid;
> sa.sa_flags = SA_SIGINFO | SA_RESTART;
>
> - (void) __libc_sigaction (SIGSETXID, &sa, NULL);
> + (void) __sigaction_internal (SIGSETXID, &sa, NULL);
>
> /* The parent process might have left the signals blocked. Just in
> case, unblock it. We reuse the signal mask in the sigaction
>
> Modified: branches/uClibc-nptl/libpthread/nptl/sysdeps/pthread/sigaction.c
> ===================================================================
> --- branches/uClibc-nptl/libpthread/nptl/sysdeps/pthread/sigaction.c 2005-12-08 04:53:18 UTC (rev 12719)
> +++ branches/uClibc-nptl/libpthread/nptl/sysdeps/pthread/sigaction.c 2005-12-08 04:57:34 UTC (rev 12720)
> @@ -42,10 +42,9 @@
> return -1;
> }
>
> - return __libc_sigaction (sig, act, oact);
> + return __sigaction_internal (sig, act, oact);
same here
> }
> -libc_hidden_weak (__sigaction)
and reading this (done by glibc, it seems that libpthread has an own
__sigaction that is hidden (and probably used internally within
libpthread)
Peter
--
Peter S. Mazinger <ps dot m at gmx dot net> ID: 0xA5F059F2
Key fingerprint = 92A4 31E1 56BC 3D5A 2D08 BB6E C389 975E A5F0 59F2
More information about the uClibc
mailing list