Re: Proper use of select() parameter nfds?

Поиск
Список
Период
Сортировка
От Alex Pilosov
Тема Re: Proper use of select() parameter nfds?
Дата
Msg-id Pine.BSO.4.10.10107060943390.7004-100000@spider.pilosoft.com
обсуждение исходный текст
Ответ на Proper use of select() parameter nfds?  (Matthew Hagerty <mhagerty@voyager.net>)
Список 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





В списке pgsql-hackers по дате отправления:

Предыдущее
От: Zeugswetter Andreas SB
Дата:
Сообщение: AW: AW: Re: Backup and Recovery
Следующее
От: Peter Eisentraut
Дата:
Сообщение: Re: Database Users Management and Privileges