Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 8 Sep 2016 19:36:33 +0200
From:      Jilles Tjoelker <jilles@stack.nl>
To:        "Lundberg, Johannes" <johannes@brilliantservice.co.jp>
Cc:        FreeBSD Current <freebsd-current@freebsd.org>
Subject:   Re: Weirdness in TTY & VT
Message-ID:  <20160908173633.GA50215@stack.nl>
In-Reply-To: <CAASDrVky8v4FWjqKYgv1mJ0-ksqVD9KWTNBNatfSVxBOBc5eyQ@mail.gmail.com>
References:  <CAASDrVky8v4FWjqKYgv1mJ0-ksqVD9KWTNBNatfSVxBOBc5eyQ@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Fri, Sep 02, 2016 at 05:12:12PM -0700, Lundberg, Johannes wrote:
> I'm porting some Linux code and have some weird behavior.

> In this (Linux) code fstat() and minor() is used on a /dev/tty file
> descriptor to get a tty number to map to. In FreeBSD this returns a number
> around 60-70 for st_rdev which means VT_ACTIVATE ioctl call will fail
> because it only allows values 0-12.

> Should not this be compatible with FreeBSD? If not, what is the FreeBSD way
> to do this?

> Is there some implementation missing in vt?

minor() and major() are obsolete in FreeBSD. A (userland) dev_t is an
opaque identifier.

The direct equivalent is devname_r() or fdevname_r() followed by parsing
the resulting string.

There is also a VT_GETINDEX ioctl but I don't know whether it works.

-- 
Jilles Tjoelker



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20160908173633.GA50215>