Re: Calling open on /dev/ttyS0 hangs (LWL 4.4.6)
On Wed, May 23, 2007 at 09:46:46AM -0500, Michael J. Forster wrote:
> On my Slackware 11.0 (2.4.33 kernel) box the following
> just hangs and spikes the cpu under LWL Pro 4.4.6:
>
> (setf *foo* (open "/dev/ttyS0" :direction :input))
See the reference manual under common-lisp:open:
If external-format has a name which is not :default and the
parameters include :eol-style, it is used as is.
Otherwise, the system decides which external format to use via
guess-external-format. By default, this finds a match based on the
filename; or (if that fails), looks in the EMACSstyle (-*-)
attribute line for an option called encoding or external-format; or
(if that fails), chooses from among likely encodings by analyzing
the bytes near the start of the file. By default, it then also
analyses the start of the file for byte patterns indicating the
end-of-line style, and uses a default endof- line style if no such
pattern is found.
So cl:open tries to read from the file. I can see why that might
cause problems on a tty line, though not sure why it'd peg your CPU.
It doesn't peg mine. (LWL Pro, 5.2; Debian, custom-built 2.6.15)
I disassembled OPEN, but don't know enough assembler to make much
sense of it.
So I DELIVERed an app with just the OPEN. It doesn't peg my cpu,
either. I straced it, and the output ends in mid line:
open("/dev/ttyS0", O_RDONLY|O_LARGEFILE) = 3
read(3,
^ cursor here
What does
cat /dev/ttyS0
do? I.e. does it spike your cpu, too? What happens if you
strace cat /dev/ttyS0
? (When I strace cat /dev/ttyS0 the output is similar to the above,
and it doesn't spike my cpu. Nor, just to be clear, when I don't
strace it. :)
-- Larry