From owner-freebsd-hackers Tue Dec 19 9: 1:16 2000 From owner-freebsd-hackers@FreeBSD.ORG Tue Dec 19 09:01:14 2000 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from exchange.universe.dart.spb (bb.marketsite.ru [194.226.198.1]) by hub.freebsd.org (Postfix) with ESMTP id E8C1B37B402 for ; Tue, 19 Dec 2000 09:01:11 -0800 (PST) Received: from runnet-gw.marketsite.ru (WILD [192.168.1.24]) by exchange.universe.dart.spb with SMTP (Microsoft Exchange Internet Mail Service Version 5.5.2650.21) id XPK2PAVK; Tue, 19 Dec 2000 20:01:03 +0300 Content-Length: 1422 Message-ID: X-Mailer: XFMail 1.4.0 on FreeBSD X-Priority: 3 (Normal) Content-Type: text/plain; charset=KOI8-R Content-Transfer-Encoding: 8bit MIME-Version: 1.0 Date: Tue, 19 Dec 2000 20:01:10 +0300 (MSK) Reply-To: diwil@dataart.com Sender: diwil@runnet-gw.marketsite.ru From: Dmitry Dicky To: freebsd-hackers@freebsd.org Subject: recvfrom() and signals Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG 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 majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message