Path: utzoo!attcan!uunet!algor2!jeffrey
From: jeffrey@algor2.UUCP (Jeffrey Kegler)
Newsgroups: comp.unix.questions
Subject: Re: Unix deficiencies/problems
Summary: Logical file names
Message-ID: <431@algor2.UUCP>
Date: 11 May 89 14:41:30 GMT
References: <810038@hpsemc.HP.COM> <810046@hpsemc.HP.COM> <159@dg.dg.com> <2656@mentor.cc.purdue.edu> <1116@vsi.COM>
Reply-To: jeffrey@algor2.UUCP (Jeffrey Kegler)
Organization: Algorists, Inc., Reston VA
Lines: 29
In article <2656@mentor.cc.purdue.edu>, mjs@mentor.cc.purdue.edu (Mike Spitzer) writes:
> application logfile 2>errs 3rep1 6>rep2
> [...]
>
In a previous followup to this message I asserted that this syntax is highly
dependent on the order of open() calls in the application. That turns out
to wrong as a few people have pointed out to me by Email.
The rules, as I now understand them, are
1) The shell opens file descriptors 0, 1 and 2.
2) It also opens any descriptors explicitly redirected on the command line
(3 through 6, in the above).
3) It also opens any descriptors explicitly redirected in exec commands.
4) The application's open() calls return the remaining file descriptors, lowest
first.
This actually forms a fairly reasonable replacement to logical file names.
Remaining problem: Any file descriptors whose redirection is forgotten, are
returned in response to the application's open calls. This could cause wierd
open() order dependent behavior. The logging data could wind up being written
into the database, for example.
--
Jeffrey Kegler, President, Algorists,
jeffrey@algor2.UU.NET or uunet!algor2!jeffrey
1762 Wainwright DR, Reston VA 22090