Redirect Output in the Middle of a Program - Missing Feature

Maarten Litmaath maart at cs.vu.nl
Tue May 3 07:53:12 AEST 1988


Right now it's impossible to redirect output while a program is running,
by typing something like:

	% a.out
	[bla bla gnome hobgoblin... invisible stalker... Mount device busy]
	^Z
	% bg > /etc/passwd
	%

(To catch some signal from inside the program, etc. is not a general
solution!)
There should be some system call to indicate that some stream of a child
is to be reopened. The indication will probably be some kind of signal.
The C interface could be something like:

	int	redirect(pid, fd, file)
	int	pid, fd;
	char	*file;

to connect file descriptor fd to file, and

	int	dup3(pid, fd, newfd)
	int	pid, fd, newfd;

to make file descriptor fd a duplicate of newfd.
In my opinion the UNIX kernel data structures are suited for these ideas.
Am I blundering about, forgetting something important, or why haven't
they been implemented yet?
-- 
South-Africa:                         |Maarten Litmaath @ Free U Amsterdam:
           revival of the Third Reich |maart at cs.vu.nl, mcvax!botter!ark!maart



More information about the Comp.unix.wizards mailing list