libzypp  17.24.1
zypp::io Namespace Reference

Classes

class  TimeoutException
 

Typedefs

using timeout_type = size_t
 

Enumerations

enum  BlockingMode { BlockingMode::FailedToSetMode = -1, BlockingMode::WasBlocking, BlockingMode::WasNonBlocking }
 
enum  ReceiveUpToResult { Success, Timeout, EndOfFile, Error }
 

Functions

BlockingMode setFILEBlocking (FILE *file, bool mode=true)
 Enables or disabled non blocking mode on a file descriptor. More...
 
std::pair< ReceiveUpToResult, std::string > receiveUpto (FILE *file, char c, timeout_type timeout, bool failOnUnblockError)
 

Variables

static const timeout_type no_timeout = static_cast<timeout_type>(-1)
 

Typedef Documentation

◆ timeout_type

using zypp::io::timeout_type = typedef size_t

Definition at line 61 of file IOTools.h.

Enumeration Type Documentation

◆ BlockingMode

Enumerator
FailedToSetMode 

Failed to block or unblock the fd.

WasBlocking 

FD was blocking before.

WasNonBlocking 

FD was non blocking before.

Definition at line 22 of file IOTools.h.

◆ ReceiveUpToResult

Enumerator
Success 
Timeout 
EndOfFile 
Error 

Definition at line 54 of file IOTools.h.

Function Documentation

◆ setFILEBlocking()

BlockingMode zypp::io::setFILEBlocking ( FILE *  file,
bool  mode = true 
)

Enables or disabled non blocking mode on a file descriptor.

The return value is one of the zypp::io::BlockingMode values

Definition at line 24 of file IOTools.cc.

◆ receiveUpto()

std::pair< ReceiveUpToResult, std::string > zypp::io::receiveUpto ( FILE *  file,
char  c,
timeout_type  timeout,
bool  failOnUnblockError = true 
)

Reads data from file until it finds a seperator c, hits the end of the file or times out. The timeout value is specified in milliseconds, a timeout of -1 means no timeout. If failOnUnblockError is set to false the function will not error out if unblocking the file descriptor did not work. The default is to fail if it's not possible to unblock the file.

Definition at line 52 of file IOTools.cc.

Variable Documentation

◆ no_timeout

const timeout_type zypp::io::no_timeout = static_cast<timeout_type>(-1)
static

Definition at line 62 of file IOTools.h.