more unix ideas

Henry Spencer henry at utzoo.UUCP
Tue Jun 18 02:03:11 AEST 1985


> 1) have a swapfd system call
>         Usage:  swapfd(fd1,proc,fd2)
> or possibly:    swapfd(proc1,fd1,proc2,fd2)
> 
> what this does, is makes procs (usually another process) fd2, to become
> my fd1, and my fd1 to become (point to a file structure) of procs fd2.

Dennis Ritchie has implemented a nicer version of this in V8:  you can
send file descriptors across pipes.  This does require the cooperation
of the other process, which is an advantage or a disadvantage depending
on what you are doing.

> 2) have another version of the exit sytem call,
>         which will just cause the parents wait to return,
>         without the process really exiting.
>         This so that a process could put itself in background.

This is trivial to do in standard Unix; just have the child process fork
a new child, and then exit.  (Remember that a child of a dead process does
not become a child of the deceased's parent, it becomes an orphan.)  This
has been used in things like daemons since time immemorial (i.e. 1974 or
earlier!).
-- 
				Henry Spencer @ U of Toronto Zoology
				{allegra,ihnp4,linus,decvax}!utzoo!henry



More information about the Comp.unix.wizards mailing list