]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
Refactor internal-signals.h
authorAdhemerval Zanella <adhemerval.zanella@linaro.org>
Thu, 21 Apr 2022 12:41:59 +0000 (09:41 -0300)
committerAdhemerval Zanella <adhemerval.zanella@linaro.org>
Thu, 30 Jun 2022 17:56:21 +0000 (14:56 -0300)
The main drive is to optimize the internal usage and required size
when sigset_t is embedded in other data structures.  On Linux, the
current supported signal set requires up to 8 bytes (16 on mips),
was lower than the user defined sigset_t (128 bytes).

A new internal type internal_sigset_t is added, along with the
functions to operate on it similar to the ones for sigset_t.  The
internal-signals.h is also refactored to remove unused functions

Besides small stack usage on some functions (posix_spawn, abort)
it lower the struct pthread by about 120 bytes (112 on mips).

Checked on x86_64-linux-gnu.

Reviewed-by: Arjun Shankar <arjun@redhat.com>
18 files changed:
nptl/descr.h
nptl/pthread_attr_setsigmask.c
nptl/pthread_create.c
nptl/pthread_kill.c
nptl/pthread_sigmask.c
rt/tst-timer-sigmask.c
signal/sigaction.c
signal/sigaddset.c
signal/sigdelset.c
signal/sigfillset.c
stdlib/abort.c
sysdeps/generic/internal-signals.h
sysdeps/posix/signal.c
sysdeps/unix/sysv/linux/ia64/unwind_longjmp.c
sysdeps/unix/sysv/linux/internal-signals.h
sysdeps/unix/sysv/linux/internal-sigset.h [new file with mode: 0644]
sysdeps/unix/sysv/linux/spawni.c
sysdeps/unix/sysv/linux/timer_routines.c

index b5852632e32c46ceb80f9ac916754e29c131f8fc..5cacb286f35da5d2e252b6fd4e0fa0bf166d126d 100644 (file)
@@ -35,6 +35,7 @@
 #include <kernel-features.h>
 #include <tls-internal-struct.h>
 #include <sys/rseq.h>
+#include <internal-sigset.h>
 
 #ifndef TCB_ALIGNMENT
 # define TCB_ALIGNMENT 32
@@ -387,7 +388,7 @@ struct pthread
   /* Signal mask for the new thread.  Used during thread startup to
      restore the signal mask.  (Threads are launched with all signals
      masked.)  */
-  sigset_t sigmask;
+  internal_sigset_t sigmask;
 
   /* Indicates whether is a C11 thread created by thrd_creat.  */
   bool c11;
index a6e650f4cc01a81cea4a130a1317cfe5183f9389..908a0c13ef769650ab541fa17ed7f1f2e7a70165 100644 (file)
@@ -28,7 +28,7 @@ pthread_attr_setsigmask_np (pthread_attr_t *attr, const sigset_t *sigmask)
 
   /* Filter out internal signals.  */
   struct pthread_attr *iattr = (struct pthread_attr *) attr;
-  __clear_internal_signals (&iattr->extension->sigmask);
+  clear_internal_signals (&iattr->extension->sigmask);
 
   return 0;
 }
index a06d611e32c64f363afb95d45335b5e2d5b537bc..308db65cd4c148f8a119ed9025af194946aa2c80 100644 (file)
@@ -423,7 +423,7 @@ start_thread (void *arg)
       /* Store the new cleanup handler info.  */
       THREAD_SETMEM (pd, cleanup_jmp_buf, &unwind_buf);
 
-      __libc_signal_restore_set (&pd->sigmask);
+      internal_signal_restore_set (&pd->sigmask);
 
       LIBC_PROBE (pthread_start, 3, (pthread_t) pd, pd->start_routine, pd->arg);
 
@@ -501,8 +501,8 @@ start_thread (void *arg)
      signal to be delivered.  (SIGSETXID cannot run application code,
      nor does it use pthread_kill.)  Reuse the pd->sigmask space for
      computing the signal mask, to save stack space.  */
-  __sigfillset (&pd->sigmask);
-  __sigdelset (&pd->sigmask, SIGSETXID);
+  internal_sigfillset (&pd->sigmask);
+  internal_sigdelset (&pd->sigmask, SIGSETXID);
   INTERNAL_SYSCALL_CALL (rt_sigprocmask, SIG_BLOCK, &pd->sigmask, NULL,
                         __NSIG_BYTES);
 
@@ -769,14 +769,14 @@ __pthread_create_2_1 (pthread_t *newthread, const pthread_attr_t *attr,
   /* Block all signals, so that the new thread starts out with
      signals disabled.  This avoids race conditions in the thread
      startup.  */
-  sigset_t original_sigmask;
-  __libc_signal_block_all (&original_sigmask);
+  internal_sigset_t original_sigmask;
+  internal_signal_block_all (&original_sigmask);
 
   if (iattr->extension != NULL && iattr->extension->sigmask_set)
     /* Use the signal mask in the attribute.  The internal signals
        have already been filtered by the public
        pthread_attr_setsigmask_np interface.  */
-    pd->sigmask = iattr->extension->sigmask;
+    internal_sigset_from_sigset (&pd->sigmask, &iattr->extension->sigmask);
   else
     {
       /* Conceptually, the new thread needs to inherit the signal mask
@@ -786,7 +786,7 @@ __pthread_create_2_1 (pthread_t *newthread, const pthread_attr_t *attr,
       pd->sigmask = original_sigmask;
       /* Reset the cancellation signal mask in case this thread is
         running cancellation.  */
-      __sigdelset (&pd->sigmask, SIGCANCEL);
+      internal_sigdelset (&pd->sigmask, SIGCANCEL);
     }
 
   /* Start the thread.  */
@@ -833,7 +833,7 @@ __pthread_create_2_1 (pthread_t *newthread, const pthread_attr_t *attr,
 
   /* Return to the previous signal mask, after creating the new
      thread.  */
-  __libc_signal_restore_set (&original_sigmask);
+  internal_signal_restore_set (&original_sigmask);
 
   if (__glibc_unlikely (retval != 0))
     {
index 8015e10b708d7f2e08dfa81ec9fe21fdd3640290..178d38d3bd403a208d68af9bd08369459acc17ba 100644 (file)
@@ -45,8 +45,8 @@ __pthread_kill_implementation (pthread_t threadid, int signo, int no_tid)
     }
 
   /* Block all signals, as required by pd->exit_lock.  */
-  sigset_t old_mask;
-  __libc_signal_block_all (&old_mask);
+  internal_sigset_t old_mask;
+  internal_signal_block_all (&old_mask);
   __libc_lock_lock (pd->exit_lock);
 
   int ret;
@@ -64,7 +64,7 @@ __pthread_kill_implementation (pthread_t threadid, int signo, int no_tid)
     }
 
   __libc_lock_unlock (pd->exit_lock);
-  __libc_signal_restore_set (&old_mask);
+  internal_signal_restore_set (&old_mask);
 
   return ret;
 }
@@ -83,7 +83,7 @@ __pthread_kill (pthread_t threadid, int signo)
 {
   /* Disallow sending the signal we use for cancellation, timers,
      for the setxid implementation.  */
-  if (__is_internal_signal (signo))
+  if (is_internal_signal (signo))
     return EINVAL;
 
   return __pthread_kill_internal (threadid, signo);
@@ -102,7 +102,7 @@ int
 attribute_compat_text_section
 __pthread_kill_esrch (pthread_t threadid, int signo)
 {
-  if (__is_internal_signal (signo))
+  if (is_internal_signal (signo))
     return EINVAL;
 
   return __pthread_kill_implementation (threadid, signo, ESRCH);
index 20f811cc6b844969eb0e5436659c0ef0655301ea..977740b97e73003068bfc56139898c48fa2ad18f 100644 (file)
@@ -32,7 +32,7 @@ __pthread_sigmask (int how, const sigset_t *newmask, sigset_t *oldmask)
          || __glibc_unlikely (__sigismember (newmask, SIGSETXID))))
     {
       local_newmask = *newmask;
-      __clear_internal_signals (&local_newmask);
+      clear_internal_signals (&local_newmask);
       newmask = &local_newmask;
     }
 
index 11acb670abb35dfe6af1e6ec275332b4cee49af3..4d088a691d724798a7aa5301bc20c25b59f6d2b3 100644 (file)
@@ -43,7 +43,7 @@ thread_handler (union sigval sv)
       if (sigismember (&ss, sig))
        {
          TEST_VERIFY (sig != SIGKILL && sig != SIGSTOP);
-         TEST_VERIFY (!__is_internal_signal (sig));
+         TEST_VERIFY (!is_internal_signal (sig));
        }
       if (test_verbose && sigismember (&ss, sig))
        printf ("%d, ", sig);
index 8e94b9a10ba2b3fcfdd5dbeca5bf7d845b6b695e..d56b3196cab1eea013cdd6defdfb74ffb095f24b 100644 (file)
@@ -24,7 +24,7 @@
 int
 __sigaction (int sig, const struct sigaction *act, struct sigaction *oact)
 {
-  if (sig <= 0 || sig >= NSIG || __is_internal_signal (sig))
+  if (sig <= 0 || sig >= NSIG || is_internal_signal (sig))
     {
       __set_errno (EINVAL);
       return -1;
index c6ef0a953afd7ec57fd814b08c57d14268b003d5..f0fed84dd7b8a0a6fe9801ea15e126e433dda1cd 100644 (file)
@@ -25,7 +25,7 @@ int
 sigaddset (sigset_t *set, int signo)
 {
   if (set == NULL || signo <= 0 || signo >= NSIG
-      || __is_internal_signal (signo))
+      || is_internal_signal (signo))
     {
       __set_errno (EINVAL);
       return -1;
index 81bb9a908aeb4fc4287f2520a4107591a9f5da56..2c973c9b84df916fa718029c0c437322a5cad157 100644 (file)
@@ -25,7 +25,7 @@ int
 sigdelset (sigset_t *set, int signo)
 {
   if (set == NULL || signo <= 0 || signo >= NSIG
-      || __is_internal_signal (signo))
+      || is_internal_signal (signo))
     {
       __set_errno (EINVAL);
       return -1;
index b52ef06aa03a6f989301fb2456115e50ffb72fe6..1d11ae4fec636ab74b402f0a48b88b3b71ba1cb4 100644 (file)
@@ -31,7 +31,7 @@ sigfillset (sigset_t *set)
     }
 
   __sigfillset (set);
-  __clear_internal_signals (set);
+  clear_internal_signals (set);
   return 0;
 }
 libc_hidden_def (sigfillset)
index bcf72f9356f68eac484ef3782a8ee83cc52e27e0..9c1065af0e7ef4b0a930d22ec985e6dbd6e421fe 100644 (file)
@@ -21,7 +21,7 @@
 #include <stdlib.h>
 #include <string.h>
 #include <unistd.h>
-#include <sigsetops.h>
+#include <internal-signals.h>
 
 /* Try to get a machine dependent instruction which will make the
    program crash.  This is used in case everything else fails.  */
@@ -48,7 +48,6 @@ void
 abort (void)
 {
   struct sigaction act;
-  sigset_t sigs;
 
   /* First acquire the lock.  */
   __libc_lock_lock_recursive (lock);
@@ -59,9 +58,10 @@ abort (void)
   if (stage == 0)
     {
       ++stage;
-      __sigemptyset (&sigs);
-      __sigaddset (&sigs, SIGABRT);
-      __sigprocmask (SIG_UNBLOCK, &sigs, 0);
+      internal_sigset_t sigs;
+      internal_sigemptyset (&sigs);
+      internal_sigaddset (&sigs, SIGABRT);
+      internal_sigprocmask (SIG_UNBLOCK, &sigs, NULL);
     }
 
   /* Send signal which possibly calls a user handler.  */
index 6121c117abd753f4a8f4894cf3c53fde40e7f56b..0c8f67f1a2dfa7de76bd7afda21695381f64b209 100644 (file)
 #define RESERVED_SIGRT  0
 
 static inline bool
-__is_internal_signal (int sig)
+is_internal_signal (int sig)
 {
   return false;
 }
 
 static inline void
-__clear_internal_signals (sigset_t *set)
+clear_internal_signals (sigset_t *set)
 {
 }
 
-static inline void
-__libc_signal_block_all (sigset_t *set)
-{
-  sigset_t allset;
-  __sigfillset (&allset);
-  __sigprocmask (SIG_BLOCK, &allset, set);
-}
-
-static inline void
-__libc_signal_block_app (sigset_t *set)
-{
-  sigset_t allset;
-  __sigfillset (&allset);
-  __clear_internal_signals (&allset);
-  __sigprocmask (SIG_BLOCK, &allset, set);
-}
-
-/* Restore current process signal mask.  */
-static inline void
-__libc_signal_restore_set (const sigset_t *set)
-{
-  __sigprocmask (SIG_SETMASK, set, NULL);
-}
+typedef sigset_t internal_sigset_t;
 
+#define internal_sigemptyset(__s)            sigemptyset (__s)
+#define internal_sigaddset(__s, __i)        sigaddset (__s, __i)
+#define internal_sigprocmask(__h, __s, __o)  sigprocmask (__h, __s, __o)
 
 #endif /* __INTERNAL_SIGNALS_H  */
index 8f17b4278df9d906ccd61090bc55b04859fa8a30..88c375712687996df56ec5006f57de8664d2ee31 100644 (file)
@@ -32,7 +32,7 @@ __bsd_signal (int sig, __sighandler_t handler)
 
   /* Check signal extents to protect __sigismember.  */
   if (handler == SIG_ERR || sig < 1 || sig >= NSIG
-      || __is_internal_signal (sig))
+      || is_internal_signal (sig))
     {
       __set_errno (EINVAL);
       return SIG_ERR;
index a59ad78036b6c5658a9057511a8eda31e856fdf6..a53ae799659259a8c6e621f58f5a17a11924fa52 100644 (file)
@@ -34,7 +34,7 @@ __libc_unwind_longjmp (sigjmp_buf env, int val)
 
   if (env[0].__mask_was_saved)
     /* Restore the saved signal mask.  */
-    __libc_signal_restore_set (&env[0].__saved_mask);
+    __sigprocmask (SIG_SETMASK, &env[0].__saved_mask, NULL);
 
   /* Call the machine-dependent function to restore machine state.  */
   __sigstack_longjmp (env[0].__jmpbuf, val ?: 1);
index f9efb6a15977b314be40175e690c0c5394c5a245..b624a080f7ae3e4101c95198055b2f8e7a84265a 100644 (file)
 #ifndef __INTERNAL_SIGNALS_H
 # define __INTERNAL_SIGNALS_H
 
+#include <internal-sigset.h>
+#include <limits.h>
 #include <signal.h>
 #include <sigsetops.h>
 #include <stdbool.h>
-#include <limits.h>
 #include <stddef.h>
 #include <sysdep.h>
 
 
 /* Return is sig is used internally.  */
 static inline bool
-__is_internal_signal (int sig)
+is_internal_signal (int sig)
 {
   return (sig == SIGCANCEL) || (sig == SIGSETXID);
 }
 
 /* Remove internal glibc signal from the mask.  */
 static inline void
-__clear_internal_signals (sigset_t *set)
+clear_internal_signals (sigset_t *set)
 {
   __sigdelset (set, SIGCANCEL);
   __sigdelset (set, SIGSETXID);
 }
 
-static const sigset_t sigall_set = {
-   .__val = {[0 ...  _SIGSET_NWORDS-1 ] =  -1 }
-};
-
-static const sigset_t sigtimer_set = {
-  .__val = { [0]                      = __sigmask (SIGTIMER),
-             [1 ... _SIGSET_NWORDS-1] = 0 }
+static const internal_sigset_t sigall_set = {
+   .__val = {[0 ...  __NSIG_WORDS-1 ] =  -1 }
 };
 
-/* Block all signals, including internal glibc ones.  */
-static inline void
-__libc_signal_block_all (sigset_t *set)
+/* Obtain and change blocked signals, including internal glibc ones.  */
+static inline int
+internal_sigprocmask (int how, const internal_sigset_t *set,
+                     internal_sigset_t *oldset)
 {
-  INTERNAL_SYSCALL_CALL (rt_sigprocmask, SIG_BLOCK, &sigall_set, set,
-                        __NSIG_BYTES);
+  return INTERNAL_SYSCALL_CALL (rt_sigprocmask, how, set, oldset,
+                               __NSIG_BYTES);
 }
 
-/* Block all application signals (excluding internal glibc ones).  */
+/* Block all signals, including internal glibc ones.  */
 static inline void
-__libc_signal_block_app (sigset_t *set)
+internal_signal_block_all (internal_sigset_t *oset)
 {
-  sigset_t allset = sigall_set;
-  __clear_internal_signals (&allset);
-  INTERNAL_SYSCALL_CALL (rt_sigprocmask, SIG_BLOCK, &allset, set,
+  INTERNAL_SYSCALL_CALL (rt_sigprocmask, SIG_BLOCK, &sigall_set, oset,
                         __NSIG_BYTES);
 }
 
-/* Block only SIGTIMER and return the previous set on SET.  */
+/* Restore current process signal mask.  */
 static inline void
-__libc_signal_block_sigtimer (sigset_t *set)
+internal_signal_restore_set (const internal_sigset_t *set)
 {
-  INTERNAL_SYSCALL_CALL (rt_sigprocmask, SIG_BLOCK, &sigtimer_set, set,
+  INTERNAL_SYSCALL_CALL (rt_sigprocmask, SIG_SETMASK, set, NULL,
                         __NSIG_BYTES);
 }
 
-/* Unblock only SIGTIMER and return the previous set on SET.  */
-static inline void
-__libc_signal_unblock_sigtimer (sigset_t *set)
-{
-  INTERNAL_SYSCALL_CALL (rt_sigprocmask, SIG_UNBLOCK, &sigtimer_set, set,
-                        __NSIG_BYTES);
-}
 
-/* Restore current process signal mask.  */
+/* It is used on timer_create code directly on sigwaitinfo call, so it can not
+   use the internal_sigset_t definitions.  */
+static const sigset_t sigtimer_set = {
+  .__val = { [0]                      = __sigmask (SIGTIMER),
+             [1 ... _SIGSET_NWORDS-1] = 0
+  }
+};
+
+/* Unblock only SIGTIMER.  */
 static inline void
-__libc_signal_restore_set (const sigset_t *set)
+signal_unblock_sigtimer (void)
 {
-  INTERNAL_SYSCALL_CALL (rt_sigprocmask, SIG_SETMASK, set, NULL,
+  INTERNAL_SYSCALL_CALL (rt_sigprocmask, SIG_UNBLOCK, &sigtimer_set, NULL,
                         __NSIG_BYTES);
 }
+
 #endif
diff --git a/sysdeps/unix/sysv/linux/internal-sigset.h b/sysdeps/unix/sysv/linux/internal-sigset.h
new file mode 100644 (file)
index 0000000..46939dd
--- /dev/null
@@ -0,0 +1,105 @@
+/* Internal sigset_t definition.
+   Copyright (C) 2022 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <https://www.gnu.org/licenses/>.  */
+
+#ifndef _INTERNAL_SIGSET_H
+#define _INTERNAL_SIGSET_H
+
+#include <sigsetops.h>
+
+typedef struct
+{
+  unsigned long int __val[__NSIG_WORDS];
+} internal_sigset_t;
+
+static inline void
+internal_sigset_from_sigset (internal_sigset_t *iset, const sigset_t *set)
+{
+  int cnt = __NSIG_WORDS;
+  while (--cnt >= 0)
+   iset->__val[cnt] = set->__val[cnt];
+}
+
+static inline void
+internal_sigemptyset (internal_sigset_t *set)
+{
+  int cnt = __NSIG_WORDS;
+  while (--cnt >= 0)
+   set->__val[cnt] = 0;
+}
+
+static inline void
+internal_sigfillset (internal_sigset_t *set)
+{
+  int cnt = __NSIG_WORDS;
+  while (--cnt >= 0)
+   set->__val[cnt] = ~0UL;
+}
+
+static inline int
+internal_sigisemptyset (const internal_sigset_t *set)
+{
+  int cnt = __NSIG_WORDS;
+  int ret = set->__val[--cnt];
+  while (ret == 0 && --cnt >= 0)
+    ret = set->__val[cnt];
+  return ret == 0;
+}
+
+static inline void
+internal_sigandset (internal_sigset_t *dest, const internal_sigset_t *left,
+                   const internal_sigset_t *right)
+{
+  int cnt = __NSIG_WORDS;
+  while (--cnt >= 0)
+    dest->__val[cnt] = left->__val[cnt] & right->__val[cnt];
+}
+
+static inline void
+internal_sigorset (internal_sigset_t *dest, const internal_sigset_t *left,
+                  const internal_sigset_t *right)
+{
+  int cnt = __NSIG_WORDS;
+  while (--cnt >= 0)
+    dest->__val[cnt] = left->__val[cnt] | right->__val[cnt];
+}
+
+static inline int
+internal_sigismember (const internal_sigset_t *set, int sig)
+{
+  unsigned long int mask = __sigmask (sig);
+  unsigned long int word = __sigword (sig);
+  return set->__val[word] & mask ? 1 : 0;
+}
+
+static inline void
+internal_sigaddset (internal_sigset_t *set, int sig)
+{
+  unsigned long int mask = __sigmask (sig);
+  unsigned long int word = __sigword (sig);
+  set->__val[word] |= mask;
+}
+
+static inline void
+internal_sigdelset (internal_sigset_t *set, int sig)
+{
+  unsigned long int mask = __sigmask (sig);
+  unsigned long int word = __sigword (sig);
+  set->__val[word] &= ~mask;
+}
+
+#endif /* _INTERNAL_SIGSET_H */
index d6f5ca89cddb8dec93448a2dd218a2653d21fa8f..ee843a2247bb577e9a8bcaca3a93af4831651be0 100644 (file)
@@ -57,7 +57,7 @@
 
 struct posix_spawn_args
 {
-  sigset_t oldmask;
+  internal_sigset_t oldmask;
   const char *file;
   int (*exec) (const char *, char *const *, char *const *);
   const posix_spawn_file_actions_t *fa;
@@ -124,7 +124,7 @@ __spawni_child (void *arguments)
        }
       else if (__sigismember (&hset, sig))
        {
-         if (__is_internal_signal (sig))
+         if (is_internal_signal (sig))
            sa.sa_handler = SIG_IGN;
          else
            {
@@ -284,8 +284,10 @@ __spawni_child (void *arguments)
 
   /* Set the initial signal mask of the child if POSIX_SPAWN_SETSIGMASK
      is set, otherwise restore the previous one.  */
-  __sigprocmask (SIG_SETMASK, (attr->__flags & POSIX_SPAWN_SETSIGMASK)
-                ? &attr->__ss : &args->oldmask, 0);
+  if (attr->__flags & POSIX_SPAWN_SETSIGMASK)
+    __sigprocmask (SIG_SETMASK, &attr->__ss, NULL);
+  else
+    internal_sigprocmask (SIG_SETMASK, &args->oldmask, NULL);
 
   args->exec (args->file, args->argv, args->envp);
 
@@ -368,7 +370,7 @@ __spawnix (pid_t * pid, const char *file,
   args.envp = envp;
   args.xflags = xflags;
 
-  __libc_signal_block_all (&args.oldmask);
+  internal_signal_block_all (&args.oldmask);
 
   /* The clone flags used will create a new child that will run in the same
      memory space (CLONE_VM) and the execution of calling thread will be
@@ -416,7 +418,7 @@ __spawnix (pid_t * pid, const char *file,
   if ((ec == 0) && (pid != NULL))
     *pid = new_pid;
 
-  __libc_signal_restore_set (&args.oldmask);
+  internal_signal_restore_set (&args.oldmask);
 
   __pthread_setcancelstate (state, NULL);
 
index 8f0a2f635dd7ae8150ada897a0d25d139d61666b..7433f7f559e0b5d33ada076c908dee842da02715 100644 (file)
@@ -41,7 +41,7 @@ struct thread_start_data
 static void *
 timer_sigev_thread (void *arg)
 {
-  __libc_signal_unblock_sigtimer (NULL);
+  signal_unblock_sigtimer ();
 
   struct thread_start_data *td = (struct thread_start_data *) arg;
   void (*thrfunc) (sigval_t) = td->thrfunc;