Re: how to find out the current tty from a daemon?

From: Joe Beanfish (joebeanfish_at_nospam.duh)
Date: 08/07/03


Date: Thu, 07 Aug 2003 13:44:20 -0400

Andrej Hocevar wrote:
>
> In article <uUbYa.641762$3C2.15601281@news3.calgary.shaw.ca>, Andrew Taylor wrote:
> > What do you mean by the "current tty"? Usually daemons will detach from
> > their tty with a TIOCNOTTY ioctl. If you want to log information to the
> > console, you probably want to write it directly to /dev/console, or
> > better yet, use syslogd and direct the output to the appropriate place
> > in /etc/syslog.conf.
>
> OK, I need to be more precise. Here's what I'm trying to do. I have
> my daemon lurking in the background (forked twice), waiting for the
> user to take some specified action (move the mouse wheel). When it
> happens, it is supposed to send an event to the _user's_ current
> console with an ioctl call. Unfortunatelly, it only works for the
> console I start it on; however, eventually, init might start it in
> the future so even that won't work anymore. So I need a way to get
> the name of the tty the user is currently using. (This is not meant
> for X.)
>
> After some thinking, this became unclear even to myself.

You're reinventing gpm. See
http://linux.schottelius.org/gpm/



Relevant Pages

  • Re: Console - Serial Port - tty
    ... Have removed both tty and sa from odm as you instructed ... But they came back after reboot. ... Console - Serial Port - tty ...
    (AIX-L)
  • [GIT PATCH] TTY/serial merge for .38
    ... Here is the big tty and serial merge for .38. ... smaller one that just moves drivers around after .38-rc1 is out, ... There was some arguing about the tty console detection patches, ... serial: ifx6x60: Fix missing include for msleep ...
    (Linux-Kernel)
  • Re: Proposal for redesigning the TTY layer
    ... They do not belong in DEVFS, since that would require DEVFS to know ... You can put it in the generic tty layer if you want, ... the console code. ... I was already planning to add the termios line discipline code outside ...
    (freebsd-arch)
  • Re: how to find out the current tty from a daemon?
    ... If you want to log information to the ... console with an ioctl call. ... the name of the tty the user is currently using. ... int last_console; ...
    (comp.os.linux.development.apps)
  • Re: mtx_lock_do_what_i_mean()
    ... kernel from anything to which we have a TTY attached. ... at printf() as a means to write to the message buffer only. ... and 2) something you can do by going through the TTY ... The fact that currently the console is used by both does ...
    (freebsd-arch)