tech-kern archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: Getting the device name from a struct tty *
Am 15.10.13 09:40, schrieb Martin Husemann:
> On Tue, Oct 15, 2013 at 12:18:15AM -0700, Matt Thomas wrote:
>>
>> On Oct 15, 2013, at 12:09 AM, Marc Balmer <marc%msys.ch@localhost> wrote:
>>> Is that possible?
>>
>> No.
>
> If you only need it as a hint (like for naming a wchan or an event)
> you may try to approximate it as
>
> dev_t dev;
> char buf[16]; // XXX: we should have a symbolic name for this
> snprintf(buf, sizeof(buf), "%s%d", cdevsw_getname(major(dev)), minof(dev));
>
> (untested). But I guess you will end up with things like uplcom5 instead of
> ttyU5, and the number may be wrong (e.g. +128 if dtyU5 is used or similar).
Thank you, I will test that. If I ended up with uplcom5 instead of
ttyU5, that would already be something.
Right now, I increment an internal counter, so the first line discipline
gets the name ldisc0, then ldisc1.
The issue is that this line discipline creates a Lua state and I must be
able to identify the state to load code into it.
Maybe I have to do it the other way round: Create a (named) Lua state,
load the code into it, and then pass that name somehow down to the
linediscipline. That would probably mean a new tty(4) ioctl,
TIOCSLINEDES2 or so.
Need to test a few scenarios, I think.
Home |
Main Index |
Thread Index |
Old Index