"swapfd" (more unix ideas)

Wayne A. Christopher faustus at ucbcad.UUCP
Mon Jun 24 12:31:02 AEST 1985


> 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



More information about the Comp.unix.wizards mailing list