Bug 126232 - [linux] Linux ioctl TCGETS (0x5401) always fails
Summary: [linux] Linux ioctl TCGETS (0x5401) always fails
Status: Closed Not A Bug
Alias: None
Product: Base System
Classification: Unclassified
Component: kern (show other bugs)
Version: Unspecified
Hardware: Any Any
: Normal Affects Only Me
Assignee: freebsd-emulation (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-08-04 08:20 UTC by yuri
Modified: 2017-05-01 12:54 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description yuri 2008-08-04 08:20:03 UTC
I've ran ktrace(1) on some Linux application and noticed that it has a
lot calls like this:

 97754 app CALL  linux_ioctl(0xf,0x5401 ,0xbfbfbc78)
 97754 app RET   linux_ioctl -1 errno 25 Inappropriate ioctl for device

0x5401 stands for TCGETS on Linux. As I understand this ioctl is obsolete
and is replaced by tcgetattr() (?).

It's better to not return errno but to do what tcgetattr() does. This will
take out one more potential point of failure for some Linux apps.
Comment 1 Mark Linimon freebsd_committer freebsd_triage 2008-08-04 09:31:04 UTC
Responsible Changed
From-To: freebsd-bugs->freebsd-emulation

reclassify.
Comment 2 chagin.dmitry 2008-08-05 17:27:44 UTC
>
>  Description:
>  I've ran ktrace(1) on some Linux application and noticed that it has a
>  lot calls like this:
>  97754 app CALL linux_ioctl(0xf,0x5401 ,0xbfbfbc78)
>  97754 app RET linux_ioctl -1 errno 25 Inappropriate ioctl for device
>  0x5401 stands for TCGETS on Linux. As I understand this ioctl is
>  obsolete
>  and is replaced by tcgetattr() (?).

Actually it not absolutelly so, tcgetattr() it is a glibc function
which uses ioctl TCGETS inside.


>  It's better to not return errno but to do what tcgetattr() does.
>  This will take out one more potential point of failure for some Linux
>  apps.

I think that the author should give more information, at least explain
on what specifies a file descriptor.

thnx!

-- 
Have fun!
chd
Comment 3 Yuri Victorovich freebsd_committer freebsd_triage 2008-08-05 17:50:18 UTC
Chagin Dmitry wrote:
> Actually it not absolutelly so, tcgetattr() it is a glibc function
> which uses ioctl TCGETS inside.
>

Actually on FreeBSD tcgetattr() is typedefed to ioctl TCGETA.

In short this PR asks to implement TCGETS in Linux emulator.

>
> I think that the author should give more information, at least explain
> on what specifies a file descriptor.

Which author?
Comment 4 Yuri Victorovich freebsd_committer freebsd_triage 2008-08-05 18:20:55 UTC
Here is the relevant piece of information I found on usenet:
<<
TCGETA is the predecessor to *TCGETS*.  It uses the termio structure, 
not the
termios structure.  The difference is that the flag members in termio are
of type unsigned short, while in termios they're tcflag_t, which is
unsigned long on a Sun.
 >>
Comment 5 chagin.dmitry 2008-08-05 18:52:26 UTC
On Tue, 5 Aug 2008, Yuri wrote:

> Chagin Dmitry wrote:
>> Actually it not absolutelly so, tcgetattr() it is a glibc function
>> which uses ioctl TCGETS inside.
>> 
>
> Actually on FreeBSD tcgetattr() is typedefed to ioctl TCGETA.
>
> In short this PR asks to implement TCGETS in Linux emulator.
>

It is already implemented, see sys/compat/linux/linux_ioctl.c
from line 670
tcgetattr fails if file descriptor is not a tty, may be problem here?

>> 
>> I think that the author should give more information, at least explain
>> on what specifies a file descriptor.
>
> Which author?
>

certainly, author ot the PR

-- 
Have fun!
chd