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
Views: Raw Message | Whole Thread | Download mbox | Resend email
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

Browse pgsql-hackers by date

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