Path: utzoo!attcan!uunet!lll-winken!lll-tis!ames!nrl-cmf!cmcl2!beta!unm-la!unmvax!turing.UNM.EDU!mike From: mike@turing.UNM.EDU (Michael I. Bushnell) Newsgroups: comp.unix.wizards Subject: Re: Redirect Output in the Middle of a Program - Missing Feature Keywords: system call, C interface Message-ID: <1028@unmvax.unm.edu> Date: 5 May 88 08:06:33 GMT References: <13085@brl-adm.ARPA> <3571@gryphon.CTS.COM> <2841@cvl.umd.edu> <62@denali.UUCP> <670@esl.UUCP> <606@taux01.UUCP> <1242@ark.cs.vu.nl> Sender: news@unmvax.unm.edu Reply-To: mike@turing.UNM.EDU.UUCP (Michael I. Bushnell) Organization: University of New Mexico, Albuquerque Lines: 35 Path: utzoo!attcan!uunet!lll-winken!lll-tis!ames!nrl-cmf!cmcl2!beta!unm-la!unmvax!turing.UNM.EDU!mike From: mike@turing.UNM.EDU (Michael I. Bushnell) Newsgroups: comp.unix.wizards Subject: Re: Redirect Output in the Middle of a Program - Missing Feature Keywords: system call, C interface Message-ID: <1028@unmvax.unm.edu> Date: 5 May 88 08:06:33 GMT References: <13085@brl-adm.ARPA> <3571@gryphon.CTS.COM> <2841@cvl.umd.edu> <62@denali.UUCP> <670@esl.UUCP> <606@taux01.UUCP> <1242@ark.cs.vu.nl> Sender: news@unmvax.unm.edu Reply-To: mike@turing.UNM.EDU.UUCP (Michael I. Bushnell) Organization: University of New Mexico, Albuquerque In article <1242@ark.cs.vu.nl> maart@cs.vu.nl (Maarten Litmaath) writes: >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? Sigh. This is real hard to do for the same reason fixing vhangup is hard. The file descriptors are in the processes u. area, and are thus unavailable to the parent when it executes the system call. Signal delivery faces the same problem, and is solved by a hack in the swapin code. N u m q u a m G l o r i a D e o Michael I. Bushnell HASA - "A" division 14308 Skyline Rd NE Computer Science Dept. Albuquerque, NM 87123 OR Farris Engineering Ctr. OR University of New Mexico mike@turing.unm.edu Albuquerque, NM 87131 {ucbvax,gatech}!unmvax!turing.unm.edu!mike