Skip site navigation (1) Skip section navigation (2)

Re: Proper use of select() parameter nfds?

From: Alex Pilosov <alex(at)pilosoft(dot)com>
To: Matthew Hagerty <mhagerty(at)voyager(dot)net>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Proper use of select() parameter nfds?
Date: 2001-07-06 13:45:22
Message-ID: Pine.BSO.4.10.10107060943390.7004-100000@spider.pilosoft.com (view raw or flat)
Thread:
Lists: pgsql-hackers
On Fri, 6 Jul 2001, Matthew Hagerty wrote:

> I take this to mean that each descriptor set contains n descriptors and I 
> am interested in examining the first nfds descriptors referenced in my 
> sets.  I also understood it to mean that nfds has absolutely nothing to do 
> with the actual *value* of a descriptor, i.e. the value returned by 
> fopen(), socket(), etc..  Is this correct thinking?  What got me 
> second-guessing myself was a use of select() that seems to indicate that 
> you have to make sure nfds is larger than the value of the largest 
Correct.
<snip>

> Any clarification on how nfds should be set would be greatly appreciated.

Just like you said:
"you have to make sure nfds is larger than the value of the largest
filedescriptor". 


Reason being: kernel has to know how large is the mask passed to it, and
how far does it need to look.

-alex




In response to

pgsql-hackers by date

Next:From: Zeugswetter Andreas SBDate: 2001-07-06 14:00:34
Subject: AW: AW: Re: Backup and Recovery
Previous:From: Doug McNaughtDate: 2001-07-06 13:44:04
Subject: Re: Proper use of select() parameter nfds?

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group