From nobody@FreeBSD.org  Tue Aug  5 23:41:44 2008
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 103D71065671
	for <freebsd-gnats-submit@FreeBSD.org>; Tue,  5 Aug 2008 23:41:44 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (www.freebsd.org [IPv6:2001:4f8:fff6::21])
	by mx1.freebsd.org (Postfix) with ESMTP id F2DC88FC14
	for <freebsd-gnats-submit@FreeBSD.org>; Tue,  5 Aug 2008 23:41:43 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (localhost [127.0.0.1])
	by www.freebsd.org (8.14.2/8.14.2) with ESMTP id m75NfhJ4085976
	for <freebsd-gnats-submit@FreeBSD.org>; Tue, 5 Aug 2008 23:41:43 GMT
	(envelope-from nobody@www.freebsd.org)
Received: (from nobody@localhost)
	by www.freebsd.org (8.14.2/8.14.1/Submit) id m75Nfh40085975;
	Tue, 5 Aug 2008 23:41:43 GMT
	(envelope-from nobody)
Message-Id: <200808052341.m75Nfh40085975@www.freebsd.org>
Date: Tue, 5 Aug 2008 23:41:43 GMT
From: Jakub Jasinski <jakub.jasinski@utoronto.ca>
To: freebsd-gnats-submit@FreeBSD.org
Subject: select() apparently consumes cpu when it should not
X-Send-Pr-Version: www-3.1
X-GNATS-Notify:

>Number:         126289
>Category:       kern
>Synopsis:       [libc] select(2) apparently consumes cpu when it should not
>Confidential:   no
>Severity:       non-critical
>Priority:       high
>Responsible:    freebsd-bugs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Tue Aug 05 23:50:01 UTC 2008
>Closed-Date:    Wed Nov 24 01:12:38 UTC 2010
>Last-Modified:  Wed Nov 24 01:12:38 UTC 2010
>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:
State-Changed-From-To: open->closed 
State-Changed-By: arundel 
State-Changed-When: Wed Nov 24 01:12:17 UTC 2010 
State-Changed-Why:  
Duplicate of #126230. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=126289 
>Unformatted:
