From nobody@FreeBSD.org  Mon Aug  4 07:19:14 2008
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 686A81065674
	for <freebsd-gnats-submit@FreeBSD.org>; Mon,  4 Aug 2008 07:19:14 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (www.freebsd.org [IPv6:2001:4f8:fff6::21])
	by mx1.freebsd.org (Postfix) with ESMTP id 57C5E8FC20
	for <freebsd-gnats-submit@FreeBSD.org>; Mon,  4 Aug 2008 07:19:14 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (localhost [127.0.0.1])
	by www.freebsd.org (8.14.2/8.14.2) with ESMTP id m747JE5N093829
	for <freebsd-gnats-submit@FreeBSD.org>; Mon, 4 Aug 2008 07:19:14 GMT
	(envelope-from nobody@www.freebsd.org)
Received: (from nobody@localhost)
	by www.freebsd.org (8.14.2/8.14.1/Submit) id m747JEuO093828;
	Mon, 4 Aug 2008 07:19:14 GMT
	(envelope-from nobody)
Message-Id: <200808040719.m747JEuO093828@www.freebsd.org>
Date: Mon, 4 Aug 2008 07:19:14 GMT
From: Yuri <yuri@tsoft.com>
To: freebsd-gnats-submit@FreeBSD.org
Subject: Linux ioctl TCGETS (0x5401) always fails
X-Send-Pr-Version: www-3.1
X-GNATS-Notify:

>Number:         126232
>Category:       kern
>Synopsis:       [linux] Linux ioctl TCGETS (0x5401) always fails
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    freebsd-emulation
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Mon Aug 04 07:20:03 UTC 2008
>Closed-Date:    
>Last-Modified:  Sun Aug 31 03:22:54 UTC 2008
>Originator:     Yuri
>Release:        70-STABLE
>Organization:
n/a
>Environment:
>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() (?).

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.



>How-To-Repeat:

>Fix:


>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-bugs->freebsd-emulation 
Responsible-Changed-By: linimon 
Responsible-Changed-When: Mon Aug 4 08:31:04 UTC 2008 
Responsible-Changed-Why:  
reclassify. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=126232 

From: Chagin Dmitry <chagin.dmitry@gmail.com>
To: bug-followup@freebsd.org, yuri@tsoft.com
Cc: dchagin@freebsd.org
Subject: Re: ports/126232: Linux ioctl TCGETS (0x5401)
Date: Tue, 5 Aug 2008 20:27:44 +0400 (MSD)

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

From: Yuri <yuri@rawbw.com>
To: Chagin Dmitry <chagin.dmitry@gmail.com>
Cc: bug-followup@freebsd.org, dchagin@freebsd.org
Subject: Re: ports/126232: Linux ioctl TCGETS (0x5401)
Date: Tue, 05 Aug 2008 09:50:18 -0700

 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?
 

From: Yuri <yuri@rawbw.com>
To: Cc: Chagin Dmitry <chagin.dmitry@gmail.com>, bug-followup@freebsd.org,
        dchagin@freebsd.org
Subject: Re: ports/126232: Linux ioctl TCGETS (0x5401)
Date: Tue, 05 Aug 2008 10:20:55 -0700

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

From: Chagin Dmitry <chagin.dmitry@gmail.com>
To: Yuri <yuri@rawbw.com>
Cc: Chagin Dmitry <chagin.dmitry@gmail.com>, bug-followup@freebsd.org, 
    dchagin@freebsd.org
Subject: Re: ports/126232: Linux ioctl TCGETS (0x5401)
Date: Tue, 5 Aug 2008 21:52:26 +0400 (MSD)

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