Re: Weirdness in TTY & VT

2016-09-08 Thread Lundberg, Johannes
Thanks for the feedback. I solved it by asking for next free vt (#nr) and
then simply opening /dev/ttyv[#nr+1].


On Thu, Sep 8, 2016 at 10:36 AM, Jilles Tjoelker  wrote:

> 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
>

-- 
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
秘密保持について:この電子メールは、名宛人に送信したものであり、秘匿特権の対象となる情報を含んでいます。
もし、名宛人以外の方が受信された場合、このメールの破棄、およびこのメールに関する一切の開示、
複写、配布、その他の利用、または記載内容に基づくいかなる行動もされないようお願い申し上げます。
---
CONFIDENTIALITY NOTE: The information in this email is confidential
and intended solely for the addressee.
Disclosure, copying, distribution or any other action of use of this
email by person other than intended recipient, is prohibited.
If you are not the intended recipient and have received this email in
error, please destroy the original message.
___
freebsd-current@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"

Re: Weirdness in TTY & VT

2016-09-08 Thread Jilles Tjoelker
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
___
freebsd-current@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"


Re: Weirdness in TTY & VT

2016-09-03 Thread Edward Tomasz Napierała
On 0902T1712, Lundberg, Johannes wrote:
> ​Hi
> 
> 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?

Device numbers don't really matter in FreeBSD.  To get the current
VT number, use VT_GETACTIVE ioctl.  Take a look at vidcontrol(1)
source to see how it's done ("vidcontrol -i active").

___
freebsd-current@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"

Weirdness in TTY & VT

2016-09-02 Thread Lundberg, Johannes
​Hi

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?

Thanks!

​

-- 
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
秘密保持について:この電子メールは、名宛人に送信したものであり、秘匿特権の対象となる情報を含んでいます。
もし、名宛人以外の方が受信された場合、このメールの破棄、およびこのメールに関する一切の開示、
複写、配布、その他の利用、または記載内容に基づくいかなる行動もされないようお願い申し上げます。
---
CONFIDENTIALITY NOTE: The information in this email is confidential
and intended solely for the addressee.
Disclosure, copying, distribution or any other action of use of this
email by person other than intended recipient, is prohibited.
If you are not the intended recipient and have received this email in
error, please destroy the original message.
___
freebsd-current@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"