Hello fellows,

I just faced with a problem of a strange (may be not documented)
recvfrom() behaviour.

The fragment of the code is:
...
        signal(SIGALRM, timeouttrap);
        alarm(10);
        i = recvfrom(sock, buf, len, 0, from, fromlen);
        printf("%d bytes received\n",i);
.... 
void timeouttrap(int sig)
{
        printf(">> %d", sig);
        return;
}

I use non blocking socket and it receives data with no problems.
When alarm occures, the signal delivered to the process and alarm handler
prints a signal number. As I understand after this recvfrom should
return -1 and errno should be set to EINTR.

BUt, upon signal delivery (actually any signal, CHLD for example)
recvfrom() still hangs the program execution and awaits data.

However, man pages say that recvfrom() will return -1 if the call has been
interrupted.

Is this a system bug or just my misunderstanding?

Thank you in advance,
Dmitry.

-- 
**********************************************************************
   ("`-''-/").___..--''"`-._     (\         Dimmy the Wild     UA1ACZ
    `6_ 6  )   `-.  (     ).`-.__.`)        DataArt Enterprises, Inc. 
    (_Y_.)'  ._   )  `._ `. ``-..-'         Serpukhovskaja street, 10
  _..`--'_..-_/  /--'_.' ,'                 Saint Petersburg,  Russia
 (il),-''  (li),'  ((!.-'                   +7 (812) 3261780, 5585314
**********************************************************************


To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-hackers" in the body of the message

Reply via email to