]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
For signals which are ignored by default (SIGCONT, CHLD, WINCH and URG),
authorNicholas Nethercote <njn@valgrind.org>
Sun, 13 Mar 2005 04:46:36 +0000 (04:46 +0000)
committerNicholas Nethercote <njn@valgrind.org>
Sun, 13 Mar 2005 04:46:36 +0000 (04:46 +0000)
don't set a signal handler unless the client has.  This prevents syscalls
from being spuriously interrupted if one if these signals is received.

MERGED FROM CVS HEAD

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3325

coregrind/vg_signals.c

index dfa2c8c512ee01534b3f9105ce4b11f777ed3a4f..5d3d547af7441aae8ebb5f8071ca0e8b8d95cf59 100644 (file)
@@ -253,6 +253,13 @@ void calculate_SKSS_from_SCSS ( SKSS* dst )
       case VKI_SIGCONT:
         /* Let the kernel handle SIGCONT unless the client is actually
            catching it. */
+      case VKI_SIGCHLD:                                                        
+      case VKI_SIGWINCH:                                                       
+      case VKI_SIGURG:                                                         
+         /* For signals which are have a default action of Ignore,             
+            only set a handler if the client has set a signal handler.         
+            Otherwise the kernel will interrupt a syscall which                
+            wouldn't have otherwise been interrupted. */                 
         if (vg_scss.scss_per_sig[sig].scss_handler == VKI_SIG_DFL)
            skss_handler = VKI_SIG_DFL;
         else if (vg_scss.scss_per_sig[sig].scss_handler == VKI_SIG_IGN)
@@ -262,6 +269,8 @@ void calculate_SKSS_from_SCSS ( SKSS* dst )
         break;
 
       default:
+         // VKI_SIGVG* are runtime variables, so we can't make them            
+         // cases in the switch, so we handle them in the 'default' case.
         if (sig == VKI_SIGVGKILL)
            skss_handler = sigvgkill_handler;
         else if (sig == VKI_SIGVGCHLD)