(In Linux)
I need to be able to change the "controlling terminal" of an arbitrary >process. I have read the doc for the ioctl TIOCSCTTY, but as far as I can >tell, that only works for the calling process. Also, it seems to have some >(IMHO) weird limitations. So, Q1: Is there any other system call for this?
Note: I note that a lot of the "classic Unix" calls in this general area >(process/session/controlling tty stuff) are specifically only able to
affect the calling process, but that Linux has expanded on this - often >allowing arbitrary processes to be affected.
(In Linux)
I need to be able to change the "controlling terminal" of an arbitrary process. I have read the doc for the ioctl TIOCSCTTY, but as far as I can tell, that only works for the calling process. Also, it seems to have some (IMHO) weird limitations. So, Q1: Is there any other system call for this?
https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap11.html
11.1.3 The Controlling Terminal
"Each process of a session that has a controlling terminal
has the same controlling terminal"
"A terminal may be the controlling terminal for at most one session."
I believe there are security issues that would in general
prevent one from willy-nilly changing the controlling terminal
for an arbitrary process outside of the standard mechanisms like
setsid.
In article <fO7DM.428700$U3w1.203718@fx09.iad>,
Scott Lurndal <slp53@pacbell.net> wrote:
...
https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap11.html
11.1.3 The Controlling Terminal
"Each process of a session that has a controlling terminal
has the same controlling terminal"
"A terminal may be the controlling terminal for at most one session."
I believe there are security issues that would in general
prevent one from willy-nilly changing the controlling terminal
for an arbitrary process outside of the standard mechanisms like
setsid.
It looks like setsid(), followed by opening the desired terminal device,
may solve my problem. Yes, I get it that this doesn't allow you to do it
to an arbitrary process - it still has to be the process itself - but I
think I can live with that.
P.S. No "XY problem" here, but the actual use case is way too complex to explain in a Usenet post.
Sysop: | Keyop |
---|---|
Location: | Huddersfield, West Yorkshire, UK |
Users: | 299 |
Nodes: | 16 (2 / 14) |
Uptime: | 82:40:44 |
Calls: | 6,696 |
Calls today: | 1 |
Files: | 12,229 |
Messages: | 5,347,908 |