Bug 72650 - Signal Handling always seems to restart system calls
Summary: Signal Handling always seems to restart system calls
Status: RESOLVED FIXED
Alias: None
Product: valgrind
Classification: Developer tools
Component: general (show other bugs)
Version: 2.1 CVS
Platform: Unlisted Binaries Linux
: NOR normal
Target Milestone: ---
Assignee: Jeremy Fitzhardinge
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-01-14 17:41 UTC by Crispin Flowerday
Modified: 2004-01-16 03:16 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Crispin Flowerday 2004-01-14 17:41:30 UTC
Using the test case below, normally and under versions of valgrind in debian
before 2.1.0, you can exit the program using Ctrl+C, using valginr 2.1.0, it is
impossible to quit using Ctrl+C.

#include <unistd.h>
#include <signal.h>

static void nullfunction( int ) {}

static void 
setup_signal( int sig, void(*routine)(int) )
{
   struct sigaction act;
   act.sa_flags   = 0;
   act.sa_handler = (void(*)(int))routine;
   sigemptyset( &act.sa_mask );
   sigaction( sig, &act, 0 );
}

int main()
{
   char buff[8];
   setup_signal( SIGINT, nullfunction );
   read( 0, buff, sizeof( buff ) );
   return 0;
}
Comment 1 Tom Hughes 2004-01-14 17:46:32 UTC
Another point to note is that this is the correct behaviour if SA_RESTART is specified when the handler is installed, so when fixing this we need to make sure that the system call is restarted in that case...
Comment 2 Jeremy Fitzhardinge 2004-01-16 03:16:32 UTC
Fixed in CVS.