Date: Sat, 13 Mar 1999 12:33:31 -0500 (EST) From: Spike <spork@startrekmail.com> To: "Ben J. Cohen" <bjc23@hermes.cam.ac.uk> Cc: sporkl@ix.netcom.com, questions@FreeBSD.ORG Subject: Re: Redirection of processes and of X clients Message-ID: <Pine.BSF.4.05.9903131217001.754-100000@nyc-ny77-30.ix.netcom.com> In-Reply-To: <Pine.BSF.4.05.9903131621460.257-100000@bjc23.trin.cam.ac.uk>
next in thread | previous in thread | raw e-mail | index | archive | help
On Sat, 13 Mar 1999, Ben J. Cohen wrote: > On Sat, 13 Mar 1999, Spike wrote: > >> >> Firstly, is it possible to change the terminal a program is attached to > >> >> while it is running? > > >> >I don't believe what you want is at easily feasible. A process sent to the > >> >background is still attached to your terminal. What you want to do is set > >> >the STDIN, STDOUT, and STDERR file descriptors to a different terminal. > >> >Unless the program supports the ability to reassign its STD* file > >> >descriptors, I don't think you can do this. > >> > >> That is basically what I want to do. > >> Does the program which is being "moved" have to support the reassignment > >> or is it sufficient to get another program to do it? > > > >I suppose you could make a program that would run a second program with > >that second program's STD* file descriptors pointing at the first program, > >and then the first program would wait for, SIGUSR1, or specific user > >input, and then accept a filename to re-direct it's STD* file descriptors > >to and therefor the second program's as well. It shouldn't be that hard to > >write, but I'm not very good with C. I think I will give it a try though. > >Don't expect too much. > > This isn't quite what I wanted, because (presumably) programs which are to > support this would have to be patched. > Perhaps to do this in general (i.e., without modifying applications) would > need kernel-level modifications. No, I am trying to write this program so that the program that needs to be switched will be run by my program, and my program will contain the switching code. I know I can forward input/output over pipes to make the program take user input/give output on the terminal, and I know I can "forward" signals recieved from the terminal, and I *think* but I am not sure that I can properly switch over the controlling terminal and all of the process group/session stuff that comes with that. I am re-reading the relevant sections of "Advanced Programming in the Unix Environment" and will probably spend all day playing with this, so I hope to at least know what to do if not exactly how to do it by the end of the day. Again, I'm not very experienced so this may be beyond my abilities but I'll give it a try anyway. > > Thanks, > > Ben. > > > -Spike Gronim sporkl@ix.netcom.com Finger gronimw@shell.stuy.edu for PGP public key. The majority only rules those who let them. To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.4.05.9903131217001.754-100000>