libcsdbg  1.28
C++ exception (and generic) stack trace debug library
filebuf & csdbg::filebuf::sync ( bool  full) const
virtual

Commit cached data to the file.

Parameters
[in]fullfalse to perform a data sync (omit file metadata)
Returns
*this
Exceptions
csdbg::exception

Definition at line 256 of file filebuf.cpp.

References likely, csdbg::streambuf::m_handle, m_path, and unlikely.

257 {
258  i32 retval;
259  if ( likely(full) )
260  retval = fsync(m_handle);
261  else
262  retval = fdatasync(m_handle);
263 
264  if ( unlikely(retval < 0) )
265  throw exception("failed to sync file '%s'", m_path);
266 
267  return const_cast<filebuf&> (*this);
268 }
i32 m_handle
Stream handle (descriptor)
Definition: streambuf.hpp:43
#define likely(expr)
Offer a hint (positive) to the pipeline branch predictor.
Definition: config.hpp:344
int i32
32-bit signed integer
Definition: config.hpp:82
i8 * m_path
Output file path.
Definition: filebuf.hpp:37
filebuf(const i8 *)
Object constructor.
Definition: filebuf.cpp:23
#define unlikely(expr)
Offer a hint (negative) to the pipeline branch predictor.
Definition: config.hpp:349