For Programmers: Free Programming Magazines  


Home > Archive > Unix Programming > July 2006 > is it necessary to be a session leader to attach psuedo terminal as a controlling ter









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author is it necessary to be a session leader to attach psuedo terminal as a controlling ter
pankajtakawale

2006-07-20, 8:00 am

To attach controlling terminal (CT) to a process:
I have following code similar in OpenSSH

1. disconnect from old CT
2. become a session leader setsid()
3. attach psuedo tty to process calling ioctl(fd, TIOCSCTTY, NULL)

I dont want my process being a session leader to avoid SIGHUP for child
process.

But if I comment out setsid, I get error in ioctl and subsequent open
calls for terminals-
ioctl - (Input/output error)
/dev/pts/4: No such file or directory
open /dev/tty failed

(fd is associated with /dev/pts/4)

Is there any mechanism to attach psuedo terminal to process as its
Controlling Terminal without being a session leader?

OR can a process give up session leadership after attaching CT ?

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com