| pankajtakawale 2006-07-20, 1:23 pm |
|
ioctl(fd, TIOCSCTTY, NULL) gives following error
ioctl(TIOCSCTTY): Operation not permitted
pankajtakawale wrote:
> 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 ?
|