From owner-freebsd-bugs Fri Nov 10 15:20: 9 2000 Delivered-To: freebsd-bugs@freebsd.org Received: from freefall.freebsd.org (freefall.FreeBSD.org [216.136.204.21]) by hub.freebsd.org (Postfix) with ESMTP id A741037B4E5 for ; Fri, 10 Nov 2000 15:20:01 -0800 (PST) Received: (from gnats@localhost) by freefall.freebsd.org (8.9.3/8.9.2) id PAA25621; Fri, 10 Nov 2000 15:20:01 -0800 (PST) (envelope-from gnats@FreeBSD.org) Received: by hub.freebsd.org (Postfix, from userid 32767) id AAD0737B479; Fri, 10 Nov 2000 15:16:34 -0800 (PST) Message-Id: <20001110231634.AAD0737B479@hub.freebsd.org> Date: Fri, 10 Nov 2000 15:16:34 -0800 (PST) From: jogibson@cisco.com To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: www-1.0 Subject: misc/22758: select returns 0 on receipt of SIGALRM when linked with pthreads. Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org >Number: 22758 >Category: misc >Synopsis: select returns 0 on receipt of SIGALRM when linked with pthreads. >Confidential: no >Severity: serious >Priority: high >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Fri Nov 10 15:20:00 PST 2000 >Closed-Date: >Last-Modified: >Originator: John Gibson >Release: 4.0-STABLE, 4.1.1-STABLE >Organization: Cisco Systems >Environment: FreeBSD 4.1.1-STABLE FreeBSD 4.1.1-STABLE #0: Mon Oct 30 07:47:02 EST 2000 i386 >Description: On receipt of a SIGALRM, select will return 0 when linked to the reentrant C library libc_r (for pthreads) and not set errno to EINTR. When linked to libc (no pthreads) select returns -1 and sets errno to EINTR. >How-To-Repeat: /* * testsel.c * On receipt of SIGALRM, select() returns: * 0 when linked with libc_r * -1 otherwise. * * Tp compile with threads... * cc -o testsel testsel.c -pthread * * To compile without threads... * cc -o testsel testsel.c */ #include #include #include #include #include #include handle_sigalarm(void) { fprintf(stderr,"ALARM!\n"); } int main(void) { struct sigaction sact; fd_set fds; int error; sact.sa_flags = 1; sact.sa_handler = (sig_t) handle_sigalarm; sigaction(SIGALRM, &sact, NULL); FD_ZERO(&fds); alarm(1); fprintf(stderr, "test: calling select...\n"); error = select(0, &fds, 0, 0, 0); fprintf(stderr, "test: select returned %d\n", error); if (errno == EINTR) fprintf(stderr, "test: errno=EINTR\n"); else fprintf(stderr, "test: errno!=EINTR (error: %s)\n", strerror(errno)); } >Fix: >Release-Note: >Audit-Trail: >Unformatted: To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message