[BRLTTY] Re: More then one connection to brlapi
Samuel Thibault
samuel.thibault at ens-lyon.org
Thu Nov 24 08:10:26 EST 2005
Milan Zamazal, le Thu 24 Nov 2005 13:56:19 +0100, a écrit :
> Sorry, yet another question:
>
> >>>>> "ST" == Samuel Thibault <samuel.thibault at ens-lyon.org> writes:
>
> ST> - Else (i.e. running on the linux text console), determine the
> ST> controlling tty by looking in /proc/self/stat the major and
> ST> minor number of the controlling tty (7th part)
>
> Could you be more specific about how to get the information from there,
> please? I can't identify it.
There is code for this in brltty/Programs/api_client.c:
getControllingTty(), in the #ifdef linux statement. You need to check
the major part against TTY_MAJOR, and then the minor part is the tty
number.
Mmm, thinking twice about it, a more generic way (but less prone
to succeed) would be to call stat() on STDERR_FILENO, and get the
major/minor number from there. But since stderr could be redirected, it
may fail. The problem is that I don't know any standard way to get an fd
of the controlling tty (and major/minor numbers are no standards
anyway).
Regards,
Samuel
More information about the BRLTTY
mailing list