[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Making terminal available for TIOCSCTTY
On Thu, Jan 09, 2003 at 03:05:56PM -0800, Ed Vance wrote:
> On Thu, Jan 09, 2003 at 2:21 PM, Jan Hudec wrote:
> > I think, that it's a bit different. It should look like following:
> > process A has pty/1 as ctty.
> > process A makes pty/1 available (presumably via TIOCNOTTY)
> > process B has no ctty (there is something about setsid I don't fully
> > understand)
> > process A tells process B that it can use pty/1
> > process B opens pty/1 and makes it it's controling terminal
> > (TIOCSCTTY)
> >
> > The reason behind this: I have a process that logs a LOT to
> > stdout/stderr, does "setterm" ioctls on it and needs WINCH
> > signal (thus a controling tty). I want to run it from gdb
> > and have gdb and this programs output separated. Thus I use
> > gdb's tty command. But I need to make a tty available (under
> > X, that is in some terminal emulator).
> >
>
> If B calls setsid() successfully, then B opening pty/1 should
> make pty/1 ctty of B. Should not need to use TIOCSCTTY ioctl
> unless pty/1 still has a session attached, which it will if
> process A was not the session leader. Then you would not need
> the TIOCNOTTY and would need to use TIOCSCTTY with arg=1 to
> wrestle pty/1 away from its current group. Which call is
> returning an error?
The TIOCSCTTY. The problem is, that TIOCSCTTY with arg=1 only works for
superuser (at least seems so from kernel source). Thus I need to detach
the terminal properly...
-------------------------------------------------------------------------------
Jan 'Bulb' Hudec <bulb@ucw.cz>
--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive: http://mail.nl.linux.org/kernelnewbies/
FAQ: http://kernelnewbies.org/faq/