This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Bash uses lseek while reading from serial device


Corinna Vinschen writes:
> On Linux isatty on a descriptor connected to serial line returns 0,
> on Cygwin it returned 1 so far.  I fixed both problems here, isatty
> on a serial line returns 0 now, and lseek on serial (and, FWIW,
> sockets) don't simply return 0 anymore, but rather -1 with errno set
> to ESPIPE, as on Linux.

I'm not sure if Chet Ramey's suggestion that if isatty() returns 1
then bash is allowed to assume reads are newline-delimited is correct.
On Unix this would only be true if cannonical mode input processing was
enabled (icanon), and Cygwin stty reports that this mode is disabled
(-icanon) on serial devices.  Or at least it used to, with the snapshot
DLL it now complains "/dev/ttyS0: Inappropriate ioctl for device".

For what its worth my tests on Linux shows that isatty() returns 1 on
a serial device, namely /dev/ttyS0.  Which is what I would expect given
that serial devices have traditionally been synonymous with ttys on Unix.

> Ross, please give it a try.

The snapshot DLL solves the bug and the script runs without any data
being lost.  Thanks for looking into this.

					Ross Ridge


--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]