проблема такая (язык перл), есть некий враттер для чтения из сокета:
sub rdsock
{
my $sock = shift;
my %args = @_;
my $timeout = $args{-timeout} || $TIMEOUT_DATA;
my $nb = $args{-nbytes};
my $data;
eval {
local $SIG{ALRM} = sub { die "alarm\n" };
alarm($timeout);
if (defined($nb)) {
$sock->read($data, $nb);
} else {
$data = $sock->getline();
}
alarm(0);
};
if ($@) {
return 0 unless $@ eq "alarm\n";
}else{
return 0 if(!$data);
return $data;
}
}
но, он почему-то не работает, в трейсе происходит вот такое:
read(4, 0xa351068, 4096) = ? ERESTARTSYS (To be restarted)
--- SIGALRM (Alarm clock) @ 0 (0) ---
sigreturn() = ? (mask now [])
rt_sigprocmask(SIG_BLOCK, [ALRM], NULL, 8) = 0
rt_sigprocmask(SIG_UNBLOCK, [ALRM], NULL, 8) = 0
rt_sigprocmask(SIG_BLOCK, [ALRM], [], 8) = 0
rt_sigaction(SIGALRM, {0x80b6289, [], SA_RESTORER, 0x7e0be8}, {0x80b6289, [], SA_RESTORER, 0x7e0be8}, 8) = 0
rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
rt_sigprocmask(SIG_BLOCK, [ALRM], [], 8) = 0
rt_sigaction(SIGALRM, {SIG_DFL}, {0x80b6289, [], SA_RESTORER, 0x7e0be8}, 8) = 0
rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
rt_sigprocmask(SIG_BLOCK, [ALRM], [], 8) = 0
rt_sigaction(SIGALRM, {0x80b6289, [], SA_RESTORER, 0x7e0be8}, {SIG_DFL}, 8) = 0
rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
alarm(2) = 0
read(4, 0xa351068, 4096) = ? ERESTARTSYS (To be restarted)
--- SIGALRM (Alarm clock) @ 0 (0) ---
sigreturn() = ? (mask now [])