#3214 new defect

non-blocking termios interface

Reported by: Stavros Passas Owned by:
Priority: normal Milestone:
Component: rtems Version: 5
Severity: normal Keywords:
Cc: Sebastian Huber, Peer Stritzinger Blocked By:
Blocking:

Description

We face some issues with TERMIOS, when used on slow UART devices when running on RTEMS master. This was not happening before the last big refactoring of TERMIOS.

Even when the tty is blocking, rtems_termios_write_tty function is calling doTransmit with

wait = true
nextWait = false.

However in doTransmit, wait is over-written with nextWait at the end of each loop, so after one loop wait becomes false regardless if a write is blocking or non-blocking, and the function may return before writing all the characters.

I think what it is intended to be done there is to do wait |= nextWait, so if wait is already true, it remains true for the entire function.

Attachments (1)

3214-Fix-termios-blocking-interface.patch (714 bytes) - added by Stavros Passas on Oct 31, 2017 at 10:19:54 PM.
proposed fix

Download all attachments as: .zip

Change History (6)

Changed on Oct 31, 2017 at 10:19:54 PM by Stavros Passas

proposed fix

comment:1 Changed on Oct 31, 2017 at 10:20:19 PM by Stavros Passas

proposed fix attached.

comment:2 Changed on Nov 2, 2017 at 10:16:19 AM by Sebastian Huber

Cc: Peer Stritzinger added

We implemented this behaviour for the select() support. In case select() indicates a ready write to a Termios file descriptor, then it is guaranteed that we can transmit at least one character. You can use a loop around write() to transfer everything in on rush.

comment:3 Changed on Nov 2, 2017 at 11:37:30 AM by Stavros Passas

You are right. I was hoping there is a way to differentiate between select(), and blocking and non-blocking write() calls. This way we break existing applications, even thought I guess we can easily port them.

comment:4 Changed on Nov 2, 2017 at 11:47:37 AM by Sebastian Huber

Do these applications run on FreeBSD or Linux?

comment:5 Changed on Nov 2, 2017 at 8:11:44 PM by Stavros Passas

RTEMS applications.

Note: See TracTickets for help on using tickets.