public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* open("/dev/ttyS1", O_LARGEFILE) blocks
@ 2002-10-14 11:39 Bernd Petrovitsch
  2002-10-14 11:52 ` Russell King
  0 siblings, 1 reply; 4+ messages in thread
From: Bernd Petrovitsch @ 2002-10-14 11:39 UTC (permalink / raw)
  To: linux-kernel

Hi all!

Is is normal/correct/intended that an open() of /dev/ttyS1 blocks?
----  snip  ----
{81}strace ./test-open /dev/ttyS0
[...]
open("/dev/ttyS0", O_RDONLY|O_NONBLOCK) = 3
close(3)                                = 0
open("/dev/ttyS0", O_RDONLY|O_NONBLOCK|O_LARGEFILE) = 3
close(3)                                = 0
open("/dev/ttyS0", O_RDONLY|O_LARGEFILE) = 3
close(3)                                = 0
_exit(0)                                = ?
{82}strace ./test-open /dev/ttyS1
[...]
open("/dev/ttyS1", O_RDONLY|O_NONBLOCK) = 3
close(3)                                = 0
open("/dev/ttyS1", O_RDONLY|O_NONBLOCK|O_LARGEFILE) = 3
close(3)                                = 0
open("/dev/ttyS1", O_RDONLY|O_LARGEFILE <unfinished ...>
{83}lsof /dev/ttyS0
{84}lsof /dev/ttyS1
{85}uname -a
Linux xxx 2.4.20-pre10aa1 #6 Fri Oct 11 13:41:20 CEST 2002 i686 unknown
----  snip  ----

The second one was terminated with a Ctrl-C.
Nothing was connected to none of the ports.
Is there a reason that an open() on /dev/ttyS0 works and blocks
on /dev/ttyS1?

	Bernd

-- 
Bernd Petrovitsch                              Email : bernd@gams.at
g.a.m.s gmbh                                  Fax : +43 1 205255-900
Prinz-Eugen-Straße 8                    A-1040 Vienna/Austria/Europe
                     LUGA : http://www.luga.at



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: open("/dev/ttyS1", O_LARGEFILE) blocks
  2002-10-14 11:39 open("/dev/ttyS1", O_LARGEFILE) blocks Bernd Petrovitsch
@ 2002-10-14 11:52 ` Russell King
  2002-10-14 12:29   ` Bernd Petrovitsch
  0 siblings, 1 reply; 4+ messages in thread
From: Russell King @ 2002-10-14 11:52 UTC (permalink / raw)
  To: Bernd Petrovitsch; +Cc: linux-kernel

On Mon, Oct 14, 2002 at 01:39:07PM +0200, Bernd Petrovitsch wrote:
> Hi all!
> 
> Is is normal/correct/intended that an open() of /dev/ttyS1 blocks?
> ----  snip  ----
> {81}strace ./test-open /dev/ttyS0
> [...]
> open("/dev/ttyS0", O_RDONLY|O_NONBLOCK) = 3
> close(3)                                = 0
> open("/dev/ttyS0", O_RDONLY|O_NONBLOCK|O_LARGEFILE) = 3
> close(3)                                = 0
> open("/dev/ttyS0", O_RDONLY|O_LARGEFILE) = 3
> close(3)                                = 0
> _exit(0)                                = ?
> {82}strace ./test-open /dev/ttyS1
> [...]
> open("/dev/ttyS1", O_RDONLY|O_NONBLOCK) = 3
> close(3)                                = 0
> open("/dev/ttyS1", O_RDONLY|O_NONBLOCK|O_LARGEFILE) = 3
> close(3)                                = 0
> open("/dev/ttyS1", O_RDONLY|O_LARGEFILE <unfinished ...>
> {83}lsof /dev/ttyS0
> {84}lsof /dev/ttyS1
> {85}uname -a
> Linux xxx 2.4.20-pre10aa1 #6 Fri Oct 11 13:41:20 CEST 2002 i686 unknown
> ----  snip  ----
> 
> The second one was terminated with a Ctrl-C.
> Nothing was connected to none of the ports.
> Is there a reason that an open() on /dev/ttyS0 works and blocks
> on /dev/ttyS1?

stty -aF /dev/ttyS0
stty -aF /dev/ttyS1

I bet ttyS0 has clocal set, whereas ttyS1 doesn't.

-- 
Russell King (rmk@arm.linux.org.uk)                The developer of ARM Linux
             http://www.arm.linux.org.uk/personal/aboutme.html


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: open("/dev/ttyS1", O_LARGEFILE) blocks
  2002-10-14 11:52 ` Russell King
@ 2002-10-14 12:29   ` Bernd Petrovitsch
  2002-10-14 13:37     ` Russell King
  0 siblings, 1 reply; 4+ messages in thread
From: Bernd Petrovitsch @ 2002-10-14 12:29 UTC (permalink / raw)
  To: Russell King; +Cc: linux-kernel

Russell King <rmk@arm.linux.org.uk> wrote:
>On Mon, Oct 14, 2002 at 01:39:07PM +0200, Bernd Petrovitsch wrote:
>> Hi all!
>> 
>> Is is normal/correct/intended that an open() of /dev/ttyS1 blocks?
>> ----  snip  ----
>> {81}strace ./test-open /dev/ttyS0
>> [...]
>> open("/dev/ttyS0", O_RDONLY|O_NONBLOCK) = 3
>> close(3)                                = 0
>> open("/dev/ttyS0", O_RDONLY|O_NONBLOCK|O_LARGEFILE) = 3
>> close(3)                                = 0
>> open("/dev/ttyS0", O_RDONLY|O_LARGEFILE) = 3
>> close(3)                                = 0
>> _exit(0)                                = ?
>> {82}strace ./test-open /dev/ttyS1
>> [...]
>> open("/dev/ttyS1", O_RDONLY|O_NONBLOCK) = 3
>> close(3)                                = 0
>> open("/dev/ttyS1", O_RDONLY|O_NONBLOCK|O_LARGEFILE) = 3
>> close(3)                                = 0
>> open("/dev/ttyS1", O_RDONLY|O_LARGEFILE <unfinished ...>
>> {83}lsof /dev/ttyS0
>> {84}lsof /dev/ttyS1
>> {85}uname -a
>> Linux xxx 2.4.20-pre10aa1 #6 Fri Oct 11 13:41:20 CEST 2002 i686 unknown
>> ----  snip  ----
>> 
>> The second one was terminated with a Ctrl-C.
>> Nothing was connected to none of the ports.
>> Is there a reason that an open() on /dev/ttyS0 works and blocks
>> on /dev/ttyS1?
>
>stty -aF /dev/ttyS0
>stty -aF /dev/ttyS1
>
>I bet ttyS0 has clocal set, whereas ttyS1 doesn't.

ACK. 
----  snip  ----
{91}stty -aF /dev/ttyS0
speed 57600 baud; rows 0; columns 0; line = 0;
intr = ^C; quit = ^\; erase = ^?; kill = ^U; eof = ^D; eol = <undef>; eol2 = <undef>; start = ^Q; stop = ^S; susp = ^Z;
rprnt = ^R; werase = ^W; lnext = ^V; flush = ^O; min = 1; time = 0;
-parenb -parodd cs8 -hupcl -cstopb cread clocal -crtscts
                                         ^^^^^^
ignbrk -brkint -ignpar -parmrk -inpck -istrip -inlcr -igncr -icrnl ixon ixoff -iuclc -ixany -imaxbel
-opost -olcuc -ocrnl -onlcr -onocr -onlret -ofill -ofdel nl0 cr0 tab0 bs0 vt0 ff0
-isig -icanon -iexten -echo -echoe -echok -echonl -noflsh -xcase -tostop -echoprt -echoctl -echoke
{92}stty -aF /dev/ttyS1
speed 19200 baud; rows 0; columns 0; line = 0;
intr = ^C; quit = ^\; erase = ^?; kill = ^U; eof = ^D; eol = <undef>; eol2 = <undef>; start = ^Q; stop = ^S; susp = ^Z;
rprnt = ^R; werase = ^W; lnext = ^V; flush = ^O; min = 1; time = 0;
-parenb -parodd cs8 hupcl -cstopb cread -clocal crtscts
                                        ^^^^^^^
-ignbrk -brkint -ignpar -parmrk -inpck -istrip -inlcr -igncr -icrnl -ixon -ixoff -iuclc -ixany -imaxbel
-opost -olcuc -ocrnl -onlcr -onocr -onlret -ofill -ofdel nl0 cr0 tab0 bs0 vt0 ff0
-isig -icanon -iexten -echo -echoe -echok -echonl -noflsh -xcase -tostop -echoprt -echoctl -echoke
----  snip  ----
Sigh, perhaps reading more in Stevens' "Adv. Programming in the
Unix Environment" could help .....

Hmm, so I conclude that using something like "stty < /dev/ttyS0" is 
evil in general and one should always use "stty -F /dev/ttyS0" instead.

	Bernd
-- 
Bernd Petrovitsch                              Email : bernd@gams.at
g.a.m.s gmbh                                  Fax : +43 1 205255-900
Prinz-Eugen-Straße 8                    A-1040 Vienna/Austria/Europe
                     LUGA : http://www.luga.at



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: open("/dev/ttyS1", O_LARGEFILE) blocks
  2002-10-14 12:29   ` Bernd Petrovitsch
@ 2002-10-14 13:37     ` Russell King
  0 siblings, 0 replies; 4+ messages in thread
From: Russell King @ 2002-10-14 13:37 UTC (permalink / raw)
  To: Bernd Petrovitsch; +Cc: linux-kernel

On Mon, Oct 14, 2002 at 02:29:23PM +0200, Bernd Petrovitsch wrote:
> Hmm, so I conclude that using something like "stty < /dev/ttyS0" is 
> evil in general and one should always use "stty -F /dev/ttyS0" instead.

Yep.  stty -F uses non-blocking mode, whereas the shell doesn't.

-- 
Russell King (rmk@arm.linux.org.uk)                The developer of ARM Linux
             http://www.arm.linux.org.uk/personal/aboutme.html


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2002-10-14 13:31 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-10-14 11:39 open("/dev/ttyS1", O_LARGEFILE) blocks Bernd Petrovitsch
2002-10-14 11:52 ` Russell King
2002-10-14 12:29   ` Bernd Petrovitsch
2002-10-14 13:37     ` Russell King

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox