more unix ideas

wizard%wisdom.bitnet at WISCVM.ARPA wizard%wisdom.bitnet at WISCVM.ARPA
Mon May 13 19:46:43 AEST 1985


From: Mike Trachtman  <wizard%wisdom.bitnet at WISCVM.ARPA>

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.

thus effectively these two processes have swapped fd's
I think that this should be easy to implement in the system.

This could be useful for the following purposes.

1) If I need more fd's then allowed, I could make a child process
        who would hold those fd's I currently do not need.
2) A  change to the shell, so that a job while running (or stopped)
could have its ouput redirected someplace else.
for example, some program generated more output then expected,
then I can suspend it, then redirect the output to a file
or a pipe. with

% fg %1 >file
or
% fg %1 | filter | ... &
or
% fg %1 <file
        after some initial input is read from the terminal
        and the rest should be read from the file
3) a mechanism for suspended logins.
when a user does a suspend to a login shell,
have init when the person relogins, swapfds to the new fds of
the terminal the user is at now.

Obviously, the two procs should have the same owner, or the
one doing it should be su.

Side notes: I think that a process whose fd has been swapped
should be notified (signalled) of it, so that it can resync,
or change its idea of what kind of buffering need be done.

this could be done automatically in the stdio library, unless
the user wants to control it, then he must
also inform stdio.


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.
        (i.e. the shell would interpret that as a returned wait
        that the process does not want to be waited for anymore)


What do people think??
What does Berkeley think ??

Mike
(We run BSD 4.2)

                                Mike Trachtman
My address:

        wizard at wisdom                           (BITNET)
        wizard%wisdom.bitnet at wiscvm.ARPA        (ARPA/CSNET)
        wizard%wisdom.bitnet at berkley            (ARPA/CSNET)
and if all else fails (ONLY for VERY short items)
        ...!decvax!humus!wisdom!wizard          (UUCP)

(One should not say anything, when one has nothing to say.)



More information about the Comp.unix.wizards mailing list