Date: Tue, 5 Aug 2008 23:41:43 GMT From: Jakub Jasinski <jakub.jasinski@utoronto.ca> To: freebsd-gnats-submit@FreeBSD.org Subject: kern/126289: select() apparently consumes cpu when it should not Message-ID: <200808052341.m75Nfh40085975@www.freebsd.org> Resent-Message-ID: <200808052350.m75No1gs021461@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
>Number: 126289 >Category: kern >Synopsis: select() apparently consumes cpu when it should not >Confidential: no >Severity: non-critical >Priority: high >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Tue Aug 05 23:50:01 UTC 2008 >Closed-Date: >Last-Modified: >Originator: Jakub Jasinski >Release: 7.0 >Organization: >Environment: FreeBSD mail2.parkin.ca 7.0-RELEASE FreeBSD 7.0-RELEASE #4: Tue Aug 5 19:09:47 EDT 2008 admin@mail2.parkin.ca:/usr/obj/usr/src/sys/CUSTOM amd64 >Description: Refer to http://www.freebsd.org/cgi/query-pr.cgi?pr=126230 select() consumes cpu when it should not. >How-To-Repeat: Run the sample select program (or any other program that select-s) while rsync-ing and a.out will consume >1% cpu: #include <stdio.h> #include <sys/time.h> #include <sys/types.h> #include <unistd.h> int main(void) { fd_set rfds; struct timeval tv; int retval; FD_ZERO(&rfds); FD_SET(0, &rfds); tv.tv_sec = 120; tv.tv_usec = 0; retval = select(1, &rfds, NULL, NULL, &tv); if (retval == -1) perror("select()"); else if (retval) printf("Data is available now.\n"); else printf("No data within 120 seconds.\n"); return 0; } >Fix: >Release-Note: >Audit-Trail: >Unformatted:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200808052341.m75Nfh40085975>