libcsdbg  1.28
C++ exception (and generic) stack trace debug library
sttybuf & csdbg::sttybuf::discard ( ) const
virtual

Discard the data cached in the serial interface (in-kernel) buffers.

Returns
*this

Definition at line 355 of file sttybuf.cpp.

References csdbg::util::dbg_warn(), m_devnode, csdbg::streambuf::m_handle, and unlikely.

Referenced by config(), and flush().

356 {
357  i32 retval;
358  do {
359  retval = tcflush(m_handle, TCIOFLUSH);
360  }
361  while ( unlikely(retval < 0 && errno == EINTR) );
362 
363 #if CSDBG_DBG_LEVEL & CSDBG_DBGL_WARNING
364  if ( unlikely(retval < 0) )
366  "failed to clear the buffers of serial interface '%s' (errno %d - %s)",
367  m_devnode,
368  errno,
369  strerror(errno)
370  );
371 #endif
372 
373  return const_cast<sttybuf&> (*this);
374 }
sttybuf(const i8 *, u32=9600)
Object constructor.
Definition: sttybuf.cpp:67
i32 m_handle
Stream handle (descriptor)
Definition: streambuf.hpp:43
static void dbg_warn(const i8 *,...)
Print a warning debug message on the standard error stream.
Definition: util.cpp:703
i8 * m_devnode
Device node file (devfs)
Definition: sttybuf.hpp:34
int i32
32-bit signed integer
Definition: config.hpp:82
#define unlikely(expr)
Offer a hint (negative) to the pipeline branch predictor.
Definition: config.hpp:349

+ Here is the call graph for this function:

+ Here is the caller graph for this function: