Unix Programming - is it necessary to be a session leader to attach psuedo terminal as a controlling term

This is Interesting: Free IT Magazines  
Home > Archive > Unix Programming > July 2006 > is it necessary to be a session leader to attach psuedo terminal as a controlling term





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 term
pankajtakawale

2006-07-20, 1:23 pm

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






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com