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 *

On Tue, Oct 15, 2013 at 12:18:15AM -0700, Matt Thomas wrote:
> On Oct 15, 2013, at 12:09 AM, Marc Balmer <> 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).


Home | Main Index | Thread Index | Old Index