Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.2 8/23/84; site ucbcad.UUCP Path: utzoo!watmath!clyde!bonnie!akgua!mcnc!decvax!ucbvax!ucbcad!faustus From: faustus@ucbcad.UUCP (Wayne A. Christopher) Newsgroups: net.unix-wizards Subject: Re: Re: "swapfd" (more unix ideas) Message-ID: <40@ucbcad.UUCP> Date: Sun, 23-Jun-85 22:31:02 EDT Article-I.D.: ucbcad.40 Posted: Sun Jun 23 22:31:02 1985 Date-Received: Sun, 30-Jun-85 00:32:29 EDT References: <6954@ucbvax.ARPA> <5687@utzoo.UUCP> <288@azure.UUCP> <8420@ucbvax.ARPA> Organization: UC Berkeley CAD Group, Berkeley, CA Lines: 29 > changefds(pgrp, fd1, fd2) > int pgrp, fd1, fd2; > > Change all occerences of file decriptors in process group pgrp > that are decendants of fd1 to refer to the file fd2. > Decendants of a file descriptor are dup's and a child's inherited > descriptor. > > This can be implemented in the kernel easily by moveing the > descriptors from the user structure to the process table. > This call would allow a shell to change a commands input or output > to a file instead of the default. However, the changes to csh > were too tricky for a simple hack job. In conjunction with this call, you need two others (which I've tried to implement but never quite got around to debugging) -- chtty(pgrp, ttyname) Changes the controlling tty of processes in pgrp to ttyname, opening it if necessary. chparent(pid, newparent) Changes the parent of pid to newparent. This second one is the most difficult, and I had to do something like add an extra flag to the wait structure, which indicated that the child had been stolen. In any case, with these three you could do quite a bit with process changing. Of course, it's not clear how much "in the spirit of UNIX" all this is, but... Wayne