Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!utgpu!water!watmath!clyde!rutgers!husc6!cmcl2!phri!roy From: roy@phri.UUCP Newsgroups: comp.unix.questions Subject: Re: File descriptors Message-ID: <2728@phri.UUCP> Date: Wed, 27-May-87 11:15:37 EDT Article-I.D.: phri.2728 Posted: Wed May 27 11:15:37 1987 Date-Received: Sat, 30-May-87 06:20:58 EDT References: <5875@brl-smoke.ARPA> <1673@tekcrl.TEK.COM> <5881@brl-smoke.ARPA> Reply-To: roy@phri.UUCP (Roy Smith) Organization: Public Health Research Inst. (NY, NY) Lines: 31 In <5881@brl-smoke.ARPA> gwyn@brl.arpa (Doug Gwyn (VLD/VMB) ) writes: > The only reason there are [distinct per-system and per-process open file] > tables rather than one is to permit the sharing of the file position > pointer across a fork. I don't see the necessity for this particular > characteristic (I can't recall ever having made use of it) The last program I can think of that took advantage of this sharing was the v6 shell (boy, I seem to be on a nostalgia trip these past few days; maybe that old-timers BOF isn't such a bad idea). Exit and goto (and if) were not built in to the shell, but were fork/exec'ed just like any other command. Since they shared stdin with the shell (and the shell didn't do buffered reads) they could do seeks on stdin and alter what line in your shell script file the parent shell would read next. Goto would rewind stdin and search for the label, leaving the file pointer right after it; exit would simply seek to EOF on stdin; when it exited, the shell would see EOF and exit just as if you typed control-D. I never thought to try this before, but I wonder what would have happened if you did "(sleep 10; goto foo)&" inside a shell script. Yuck! Modern shells have goto and exit, as well as if/then/else, for, while, and the kitchen sink built in. This makes shell scripts run faster. It also makes them not fit into a 64k address space. BTW, I agree with Doug; when answering a question, it is better to leave out some details if that makes the gist of the answer clearer. The questioner can always come back for more later. -- Roy Smith, {allegra,cmcl2,philabs}!phri!roy System Administrator, Public Health Research Institute 455 First Avenue, New York, NY 10016