[comp.unix.wizards] suntools and file descriptors

levy@ttrdc.UUCP (Daniel R. Levy) (03/23/89)

(I tried to send this to the moderator of comp.sys.sun, but I am unsure
whether it worked, so I am sending this to comp.unix.wizards too.)

In the process of debugging some code which uses hardwired file descriptors
on a Sun system, I discovered that suntools windows leave a number of extra
file descriptors open, depending on what tool is running.  For example, a
shelltool leaves fd 4, 5, 8, 9, and 10 open; a cmdtool has 4, 5, 9, 10, 11,
12, and 13 open.

My question is, if an application running in these windows closes these
descriptors, will it have any ill effect?  Does it depend on what the
application wants to do?  If so, in what way?

Thank you very much in advance, and I also apologize in advance if this has
been asked before.
-- 
Daniel R. Levy             UNIX(R) mail:  att!ttbcad!levy
AT&T Bell Laboratories
5555 West Touhy Avenue     Any opinions expressed in the message above are
Skokie, Illinois  60077    mine, and not necessarily AT&T's.

guy@auspex.UUCP (Guy Harris) (03/25/89)

>My question is, if an application running in these windows closes these
>descriptors, will it have any ill effect?

If by "running in these windows" you mean "running in the terminal
emulator in that window", you can close them and nothing evil will
happen.  SunView is obnoxiously sloppy about closing descriptors before
running the shell in a tty or command subwindow, although it's not quite
as obnoxious as the text/command subwindow's habit of not removing its
temporary files when it exits.