zsh-workers
 help / color / mirror / code / Atom feed
* File descriptor madness
@ 2002-05-09 18:15 Peter Stephenson
  2002-05-09 18:47 ` Danek Duvall
  0 siblings, 1 reply; 9+ messages in thread
From: Peter Stephenson @ 2002-05-09 18:15 UTC (permalink / raw)
  To: Zsh hackers list

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@csr.com>                  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.
**********************************************************************


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2002-05-13  9:39 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-05-09 18:15 File descriptor madness Peter Stephenson
2002-05-09 18:47 ` Danek Duvall
2002-05-09 19:08   ` Bart Schaefer
2002-05-09 18:57     ` Peter Stephenson
2002-05-09 20:36       ` Bart Schaefer
2002-05-10 17:24         ` Peter Stephenson
2002-05-10 17:41           ` Peter Stephenson
2002-05-13  9:38             ` Peter Stephenson
2002-05-10 17:57           ` Slightly OT " Borsenkow Andrej

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).