[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#259878: libc6: posix timer SIGEV_THREAD notification broken



Package: libc6
Version: 2.3.2.ds1-13
Severity: normal
Tags: patch

Posix timer SIGEV_THREAD notification does not work for 2.6
kernels. A message
(http://sources.redhat.com/ml/libc-hacker/2004-04/msg00032.html)
on the glibc mailing list provides additional information and a
patch, which applies to the debian source with one reject. I
reduced the patch to the following hunks and this does fix the
problem. 

--- libc/nptl/sysdeps/unix/sysv/linux/timer_routines.c.jj	2003-04-21 09:38:28.000000000 +0200
+++ libc/nptl/sysdeps/unix/sysv/linux/timer_routines.c	2004-04-15 16:49:55.679087743 +0200
@@ -1,4 +1,4 @@
-/* Copyright (C) 2003 Free Software Foundation, Inc.
+/* Copyright (C) 2003, 2004 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@redhat.com>, 2003.
 
@@ -17,6 +17,7 @@
    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
+#include <errno.h>
 #include <setjmp.h>
 #include <signal.h>
 #include <stdbool.h>
@@ -61,7 +62,19 @@ timer_helper_thread (void *arg)
     {
       siginfo_t si;
 
-      if (sigwaitinfo (&ss, &si) > 0)
+      /* sigwaitinfo cannot be used here, since it deletes
+	 SIGCANCEL == SIGTIMER from the set.  */
+
+      int oldtype = LIBC_CANCEL_ASYNC ();
+
+      /* XXX The size argument hopefully will have to be changed to the
+	 real size of the user-level sigset_t.  */
+      int result = INLINE_SYSCALL (rt_sigtimedwait, 4, &ss, &si, NULL,
+				   _NSIG / 8);
+
+      LIBC_CANCEL_RESET (oldtype);
+
+      if (result > 0)
 	{
 	  if (si.si_code == SI_TIMER)
 	    {

-- System Information:
Debian Release: testing/unstable
  APT prefers unstable
  APT policy: (500, 'unstable')
Architecture: i386 (i686)
Kernel: Linux 2.6.7
Locale: LANG=en_CA, LC_CTYPE=en_CA

Versions of packages libc6 depends on:
ii  libdb1-compat                 2.1.3-7    The Berkeley database routines [gl

-- no debconf information



Reply to: