On 13 May 1998, James Youngman wrote:

> >>>>> "John" == John H Darrah <[EMAIL PROTECTED]> writes:
> 
>   John> Does any one know if ferror returns anything on a
>   John> framing, parity or overrun error? It appears that
>   John> it doesn't from the testing I've done.
> 
> man termios; see PARMRK.
> 
> ferror(3) is a stdio function.  It doesn't actually know anything
> about the underlying hardware.  IMHO, if your application actually
> cares that the underlying comms. layer is serial rather than (e.g.) a
> file or a network pty then you should consider using read(2) and
> write(2) instead of stdio.

I am well aware of all the parity/tcsetattr
particulars. I currently test for \0 in the input
which catches the parity (works fine). 

What I'm more concerned about is the fact that I
can produce an overrun condition that is not
considered an error by 'fread' and friends.  The
kernel reports the overrun condition via syslog,
but the error condition is not propagated to
fread and therefor characters are dropped without 
anyone knowing.

Considering your response, I yanked fread and
friends and revamped it using open(2),read(2).

I test for errors per the man page:

  /* On error -1 is returned, and errno is set
     appropriately. */

  ichr = read(xfd, &ibuff[lc], (BUFSIZ - lc));
  if (ichr < 0) {
      fatal("read error");
  }

It still ignores overrun errors. The kernel
reports many via syslog and examination of the
received data shows dropped characters.


syslog:
 May 13 16:38:09 trixie kernel: ttyS40: 14 input
 overrun(s)
 May 13 16:38:14 trixie kernel: ttyS40: 1 input
 overrun(s)

(Yes, I have 50 ports on this box)

Thanks again ;-)

--
John Darrah (u05192)    | Dept: N/C Programming
Giddens Industries      |
PO box 3190             | Ph: (206) 767-4212 #229
Everett  WA    98203    | Fx: (206) 764-9639


-- 
  PLEASE read the Red Hat FAQ, Tips, Errata and the MAILING LIST ARCHIVES!
http://www.redhat.com/RedHat-FAQ /RedHat-Errata /RedHat-Tips /mailing-lists
         To unsubscribe: mail [EMAIL PROTECTED] with 
                       "unsubscribe" as the Subject.

Reply via email to