1 #include "../include/streambuf.hpp"
2 #include "../include/util.hpp"
3 #if !defined CSDBG_WITH_PLUGIN && !defined CSDBG_WITH_HIGHLIGHT
4 #include "../include/exception.hpp"
115 "failed to duplicate descriptor %d (errno %d - %s)",
137 while (
unlikely(retval < 0 && errno == EINTR) );
159 while (
likely(sz > 0) ) {
194 while (
unlikely(retval < 0 && errno == EINTR) );
216 while (
unlikely(retval < 0 && errno == EINTR) );
253 gettimeofday(&now, NULL);
254 u64 tstamp =
static_cast<u64> (now.tv_sec) * 10e+5 + now.tv_usec;
257 append(
"path: %s\r\n", path);
258 append(
"pid: %x\r\n", getpid());
259 append(
"tid: %lx\r\n", pthread_self());
260 append(
"tstamp: %lx\r\n", tstamp);
virtual streambuf & header()
Append LDP headers to the buffer.
virtual string & append(const string &)
Append a string.
virtual streambuf & flush()=0
To be implemented.
static const i8 * exec_path()
Get the absolute path of the executable.
This abstract class is the base for all buffered output stream types (for files, sockets, serial interfaces e.t.c)
char i8
8-bit signed integer
unsigned long long u64
64-bit unsigned integer
i32 m_handle
Stream handle (descriptor)
virtual string & operator=(const string &)
Assignment operator.
streambuf()
Object default constructor.
#define likely(expr)
Offer a hint (positive) to the pipeline branch predictor.
virtual string & clear()
Clear contents.
virtual streambuf & operator=(const streambuf &)
Assignment operator.
virtual streambuf & lock() const
Lock the stream (exclusively)
Lightweight string buffer class (for ISO-8859-1 text)
virtual ~streambuf()=0
To be implemented.
virtual i32 handle() const
Get the handle.
int i32
32-bit signed integer
virtual streambuf & unlock() const
Unlock the stream.
virtual bool is_opened() const
Check if the stream is opened for output.
This class is a throwable with a textual description of an error.
#define unlikely(expr)
Offer a hint (negative) to the pipeline branch predictor.
virtual streambuf & close()
Close the stream.
u32 m_length
Character count.