Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

File descriptor madness



Playing with ztcp and zselect has raised my awareness of file descriptor
usage to a higher plane.

In particular, getpwuid() on Solaris (2.8) is opening an fd to its new
(so new it's not properly documented) `doors' system as an interface to
NIS.  If I remember right, we've always had some sort of problem with
NIS and its use of file descriptors.  In this case it's tying up fd 3,
right in the paltry set of 9 fd's we have available.  It never releases
it.  (endpwent() doesn't help, by the way, in case you thought it
might.)

One solution to this problem is to open (or dup something such as fd 0
onto) all fd's 3 to 9 during initialisation and then close them again
before any user code is executed (keeping careful track of any that were
already open).  It's not particularly efficient, but not *that*
inefficient either.

Any comments?

-- 
Peter Stephenson <pws@xxxxxxx>                  Software Engineer
CSR Ltd., Science Park, Milton Road,
Cambridge, CB4 0WH, UK                          Tel: +44 (0)1223 392070


**********************************************************************
The information transmitted is intended only for the person or
entity to which it is addressed and may contain confidential 
and/or privileged material. 
Any review, retransmission, dissemination or other use of, or
taking of any action in reliance upon, this information by 
persons or entities other than the intended recipient is 
prohibited.  
If you received this in error, please contact the sender and 
delete the material from any computer.
**********************************************************************



Messages sorted by: Reverse Date, Date, Thread, Author