Open the serial interface for output.
- Parameters
-
[in] | ctty | true to make the interface the process controlling terminal |
- Returns
- *this
- Exceptions
-
- Note
- If the interface is already open, it is re-opened with the new settings
Definition at line 250 of file sttybuf.cpp.
References csdbg::streambuf::close(), config(), csdbg::util::is_chardev(), csdbg::util::is_writable(), likely, m_devnode, csdbg::streambuf::m_handle, open(), and unlikely.
259 throw exception(
"device node '%s' does not exist",
m_devnode);
263 "failed to stat path '%s' (errno %d - %s)",
270 throw exception(
"'%s' is not a character device",
m_devnode);
273 throw exception(
"serial interface '%s' is not writable",
m_devnode);
275 u32 flags = O_WRONLY;
287 "failed to open serial interface '%s' (errno %d - %s)",
static bool is_writable(const fileinfo_t &)
Check if the process has write access to a file.
struct stat fileinfo_t
File metadata.
i32 m_handle
Stream handle (descriptor)
#define likely(expr)
Offer a hint (positive) to the pipeline branch predictor.
virtual sttybuf & open()
Open the serial interface for output.
static bool is_chardev(const fileinfo_t &)
Check if a file is a character device node.
i8 * m_devnode
Device node file (devfs)
unsigned int u32
32-bit unsigned integer
int i32
32-bit signed integer
virtual sttybuf & config() const
Configure the serial interface.
#define unlikely(expr)
Offer a hint (negative) to the pipeline branch predictor.
virtual streambuf & close()
Close the stream.