Re: [regression] ENOTTY returned for tty fds

Greg KH
2024-07-24T09:08:37Z

On Wed, Jul 24, 2024 at 11:07:32AM +0300, stsp wrote:
> 24.07.2024 09:51, Greg KH пишет:
> > What caused this change/regression?
>
> I have absolutely no idea.
> I've found it by debugging userspace,
> and wrote a test-case to make sure the
> problem is not in user-space.

So this has always worked this way? Or has it changed? If changed,
when did it work before?

> > And does any real-world programs
> > rely on this?
>
> dosemu

It does this today or wants to do this in the future?

> > What exactly are you trying to determine with this ioctl
> > test?
>
> Whether it is a PTS (Pseudo-Tty-Slave), or
> a real comport with MSR signalling.

Why is that needed? And why not do it how other programs (like stty)
does it?

> > Is there a different way to determine that?
> I am not aware of any "canonical" way
> of determining this. Maybe you tell me. :)
> So far the only fix I know, is to stop checking
> errno. But you return ENOTTY for a tty-associated
> fd (isatty(fd)==1), so I believe this is a
> bug in a kernel.

isatty() is a libc provided function, not a kernel call.

thanks,

greg k-h