LWN.net Logo

Changing standard Input and Output to a different virtual Terminal.

Changing standard Input and Output to a different virtual Terminal.

Posted Nov 30, 2012 17:40 UTC (Fri) by nybble41 (subscriber, #55106)
In reply to: Changing standard Input and Output to a different virtual Terminal. by gjw
Parent article: LCE: Checkpoint/restore in user space: are we there yet?

In principle, I think you could already do this to a running process (without root, even) by attaching a debugger:

$ gdb
(gdb) attach $pid
...
(gdb) call close(1)
$1 = 0
(gdb) call open("/dev/pts/$N", 1, 0660) // O_WRONLY = 1
$2 = 1
(gdb) quit


(Log in to post comments)

Changing standard Input and Output to a different virtual Terminal.

Posted Nov 30, 2012 23:03 UTC (Fri) by jimparis (subscriber, #38647) [Link]

There are some details you still need to handle, like termios settings and the controlling terminal. See http://blog.nelhage.com/2011/01/reptyr-attach-a-running-p... for a program that can help (and links to some others).

Copyright © 2013, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds