43      flags = flags | O_NONBLOCK;
 
   44    else if ( flags & O_NONBLOCK )
 
   45      flags = flags ^ O_NONBLOCK;
 
 
   57    char *tmpBuf = 
static_cast<char*
>(buf);
 
   60    while ( written < size ) {
 
 
   71    char *tmpBuf = 
static_cast<char*
>(buf);
 
   73    while ( read != size ) {
 
 
   87    FILE * inputfile = file;
 
   91    int    inputfileFd = ::fileno( inputfile );
 
   93    size_t linebuffer_size = 0;
 
  107    int remainingTimeout = 
static_cast<int>( timeout );
 
  119      fd.events =  G_IO_IN | G_IO_HUP | G_IO_ERR;
 
  123        g_timer_start( timer );
 
  125      clearerr( inputfile );
 
  136        ssize_t nread = 
zyppng::eintrSafeCallEx( ::getdelim, [&](){ clearerr( inputfile ); }, &linebuf.
value(), &linebuffer_size, c, inputfile );
 
  138          if ( ::feof( inputfile ) ) {
 
  141          if ( errno != EAGAIN && ( ::ferror( inputfile ) || errno != 0 ) ) {
 
  143            else ERR << 
"Unknown getdelim error." << std::endl;
 
  150            line += std::string( linebuf, nread );
 
  152          if ( ! ::ferror( inputfile ) || ::feof( inputfile ) ) {
 
  161        remainingTimeout -= g_timer_elapsed( timer, 
nullptr ) * 1000;
 
  162        if ( remainingTimeout <= 0 )
 
 
  178    std::vector<char> data( count + 1 , 
'\0' );
 
 
 
Reference counted access to a Tp object calling a custom Dispose function when the last AutoDispose h...
reference value() const
Reference to the Tp object.
~TimeoutException() noexcept override
Dtor.
bool writeAll(int fd, void *buf, size_t size)
BlockingMode setFILEBlocking(FILE *file, bool mode)
Enables or disabled non blocking mode on a file descriptor.
std::pair< ReceiveUpToResult, std::string > receiveUpto(FILE *file, char c, timeout_type timeout, bool failOnUnblockError)
@ WasBlocking
FD was blocking before.
@ FailedToSetMode
Failed to block or unblock the fd.
@ WasNonBlocking
FD was non blocking before.
ReadAllResult readAll(int fd, void *buf, size_t size)
BlockingMode setFDBlocking(int fd, bool mode)
static constexpr timeout_type no_timeout
std::vector< char > peek_data_fd(FILE *fd, off_t offset, size_t count)
AutoDispose< void > OnScopeExit
auto eintrSafeCallEx(const Fun &function, const RestartCb &restartCb, Args &&... args)
auto eintrSafeCall(Fun &&function, Args &&... args)
std::string strerr_cxx(const int err=-1)