TSDuck v3.45-4766
MPEG Transport Stream Toolkit
Loading...
Searching...
No Matches

Various system utilities. More...

Namespaces

namespace  ts
 TSDuck namespace, containing all TSDuck classes and functions.
 

Typedefs

using ts::ioctl_request_t = platform-dependent
 Portable type for ioctl() request parameter.
 
using ts::SysHandleType = platform_specific
 Data type for system file or device handler or descriptor.
 
using ts::SysProcessIdType = platform_specific
 Data type for system process id.
 

Functions

void ts::AddCloseOnForkExec (int fd, bool cloexec=true)
 Close a file descriptor on fork().
 
fs::path ts::CallerLibraryFile ()
 Get the name of the executable or shared library file containing the caller code.
 
UString ts::ClassName (const std::type_index index)
 Get the name of a class from the type_index of a class.
 
UString ts::ClassName (const std::type_info &info)
 Get the name of a class from the type_info of an object.
 
fs::path ts::ExecutableFile ()
 Get the name of the current application executable file.
 
cn::milliseconds ts::GetProcessCpuTime ()
 Get the CPU time of the process in milliseconds.
 
SysProcessIdType ts::GetProcessId ()
 Get the current process id.
 
size_t ts::GetProcessVirtualSize ()
 Get the virtual memory size of the process in bytes.
 
void ts::GetValidFileDescriptors (std::set< int > &descs)
 Get the set of currently valid file descriptors in the process.
 
UString ts::GetValidFileDescriptorsString ()
 Get the set of currently valid file descriptors in the process, as a string.
 
void ts::IgnorePipeSignal ()
 Ensure that writing to a broken pipe does not kill the current process.
 
bool ts::IsPrivilegedUser ()
 Check if the current user is privileged (root on UNIX, an administrator on Windows).
 
int ts::LastSysErrorCode ()
 Get the error code of the last operating system call.
 
bool ts::ProcessIdExists (SysProcessIdType pid)
 Check if a process exists.
 
void ts::RemoveCloseOnForkExec (int fd)
 Remove a file descriptor from the list of those to close on fork().
 
bool ts::SetBinaryModeStdin (Report &report=(ts::CerrReport::Instance()))
 Put the standard input stream in binary mode.
 
bool ts::SetBinaryModeStdout (Report &report=(ts::CerrReport::Instance()))
 Put the standard output stream in binary mode.
 
int ts::SetLastSysErrorCode (int error_code)
 Force the error code of the last operating system call.
 
template<class Rep , class Period >
void ts::SetTimersPrecision (cn::duration< Rep, Period > &precision)
 Request a minimum resolution for the system timers.
 
bool ts::StdErrIsTerminal ()
 Check if the standard error is a terminal.
 
bool ts::StdInIsTerminal ()
 Check if the standard input is a terminal.
 
bool ts::StdOutIsTerminal ()
 Check if the standard output is a terminal.
 
int ts::SysCloseHandle (SysHandleType hfd)
 The close() system call which applies to system file or device handler or descriptor.
 
std::string ts::SysErrorCodeMessage (int code=LastSysErrorCode(), const std::error_category *category=nullptr)
 Format a system error code into a string.
 
bool ts::SysSuccess (int code)
 Check if a system error code means success.
 
int ts::TranslateError (int code)
 Translate an error code, mapping to some portable code.
 

Variables

constexpr int ts::SYS_CANCELED = -2
 A synthetic error code value which means "canceled operation".
 
constexpr int ts::SYS_EOF = -3
 A synthetic error code value which means "end of file".
 
constexpr int ts::SYS_ERROR = -1
 A synthetic error code value which means "unspecified error".
 
constexpr SysHandleType ts::SYS_HANDLE_INVALID = platform_specific
 Value of type SysHandleType which is invalid.
 
constexpr int ts::SYS_PENDING_IO = -5
 A synthetic error code value which means "I/O not completed".
 
constexpr SysProcessIdType ts::SYS_PROCESS_ID_INVALID = platform_specific
 Value of type SysProcessIdType which is invalid.
 
constexpr int ts::SYS_REJECTED = -4
 A synthetic error code value which means "rejected".
 
constexpr int ts::SYS_SUCCESS = 0
 An error code value which means "no error" on all operating systems.
 

Detailed Description

Various system utilities.