Problems while using divecomputer-simulator for linux

Linus Torvalds torvalds at linux-foundation.org
Mon Mar 31 08:01:33 PDT 2014


On Mon, Mar 31, 2014 at 7:38 AM, Dirk Hohndel <dirk at hohndel.org> wrote:
>> BTW, the reason why we have the --enable-pty option, and not some
>> autodetection at runtime, is that I couldn't find an easy way to tell
>> the difference between a pty and a real serial port. No doubt it can be
>> done some way (e.g. the major number for pty's?), but I need something
>> that works on other unix like systems too.
>
> I'm not aware of an easy way to do that, either. Linus?

There is no portable way to do it. Looking at the major number is
indeed the only way, but even under Linux there are multiple different
major numbers (legacy pty numbers vs modern ones: major number 3 vs
136-143), and they don't match between unixes anyway.

I'm sure there are heuristics to guess that work well enough in
practice. Like just looking at the name you used to open things (but
you'd need to follow symlinks etc). But no, nothing simple to say
"this is a pseudo-tty vs a real serial line"

                  Linus


More information about the devel mailing list