Skip to content

iox::posix🔗

Namespaces🔗

Name
iox::posix::internal

Classes🔗

Name
struct iox::posix::CreateNamedSemaphore_t
struct iox::posix::CreateUnnamedSharedMemorySemaphore_t
struct iox::posix::CreateUnnamedSingleProcessSemaphore_t
class iox::posix::FileLock
Posix file lock C++ wrapping class Following RAII, the lock is acquired on creation and released on destruction. Releasing the locks works even if the process crashes with a segfault or using SIGKILL. 'lslocks' can be used to display all system-wide locks (see man page)
class iox::posix::NamedPipe
struct iox::posix::OpenNamedSemaphore_t
class iox::posix::PosixCallBuilder
class iox::posix::PosixCallEvaluator
class which is created by the verificator to evaluate the result of a posix call
struct iox::posix::PosixCallResult
result of a posix call
class iox::posix::PosixCallVerificator
class which verifies the return value of a posix function call
class iox::posix::PosixGroup
struct iox::posix::PosixRights
class iox::posix::PosixUser
class iox::posix::Semaphore
Posix semaphore C++ Wrapping class.
class iox::posix::SignalGuard
The SignalGuard is a class returned by registerSignalHandler. When it goes out of scope it restores the previous signal action. Typical use case: One would like to override the signal action in main() or some C posix makes it necessary to override the standard signal action before and after the call.
class iox::posix::SignalWatcher
The SignalWatcher waits for SIGINT and SIGTERM. One can wait until the signal has occurred or ask the watcher if it has occurred.
class iox::posix::Timer
Interface for timers on POSIX operating systems.

Types🔗

Name
enum FileLockError { INVALID_FILE_NAME, LOCKED_BY_OTHER_PROCESS, ACCESS_DENIED, QUOTA_EXHAUSTED, INVALID_CHARACTERS_IN_FILE_NAME, SYSTEM_LIMIT, PROCESS_LIMIT, NO_SUCH_DIRECTORY, SPECIAL_FILE, FILE_TOO_LARGE, FILE_IN_USE, OUT_OF_MEMORY, I_O_ERROR, SYS_CALL_NOT_IMPLEMENTED, INTERNAL_LOGIC_ERROR}
enum SemaphoreError { CREATION_FAILED, NAME_TOO_LONG, UNABLE_TO_OPEN_HANDLE, INVALID_SEMAPHORE_HANDLE, SEMAPHORE_OVERFLOW, INTERRUPTED_BY_SIGNAL_HANDLER, UNDEFINED}
enum SemaphoreWaitState { TIMEOUT, NO_TIMEOUT}
enum int Signal { BUS = SIGBUS, INT = SIGINT, TERM = SIGTERM, HUP = SIGHUP, ABORT = SIGABRT}
Corresponds to the SIG* macros defined in signal.h. The integer values are equal to the corresponding macro value.
enum TimerError { NO_ERROR, TIMER_NOT_INITIALIZED, NO_VALID_CALLBACK, KERNEL_ALLOC_FAILED, INVALID_ARGUMENTS, ALLOC_MEM_FAILED, NO_PERMISSION, INVALID_POINTER, NO_TIMER_TO_DELETE, TIMEOUT_IS_ZERO, INTERNAL_LOGIC_ERROR}
using void(*)(int) SignalHandlerCallback_t
using cxx::string< MAX_THREAD_NAME_LENGTH > ThreadName_t

Functions🔗

Name
SignalGuard registerSignalHandler*(const Signal signal, const SignalHandlerCallback_t callback)
Register a callback for a specific posix signal (SIG
).
void waitForTerminationRequest()
convenience function, calls SignalWatcher::getInstance().waitForSignal();
bool hasTerminationRequested()
convenience function, calls SignalWatcher::getInstance().wasSignalTriggered();
void setThreadName(pthread_t thread, const ThreadName_t & name)
ThreadName_t getThreadName(pthread_t thread)

Attributes🔗

Name
constexpr int MaxNumberOfGroups
constexpr uint32_t POSIX_CALL_ERROR_STRING_SIZE
constexpr uint64_t POSIX_CALL_EINTR_REPETITIONS
constexpr int32_t POSIX_CALL_INVALID_ERRNO
constexpr CreateUnnamedSingleProcessSemaphore_t CreateUnnamedSingleProcessSemaphore
constexpr CreateUnnamedSharedMemorySemaphore_t CreateUnnamedSharedMemorySemaphore
constexpr CreateNamedSemaphore_t CreateNamedSemaphore
constexpr OpenNamedSemaphore_t OpenNamedSemaphore
constexpr uint64_t MAX_THREAD_NAME_LENGTH

Types Documentation🔗

enum FileLockError🔗

Enumerator Value Description
INVALID_FILE_NAME
LOCKED_BY_OTHER_PROCESS
ACCESS_DENIED
QUOTA_EXHAUSTED
INVALID_CHARACTERS_IN_FILE_NAME
SYSTEM_LIMIT
PROCESS_LIMIT
NO_SUCH_DIRECTORY
SPECIAL_FILE
FILE_TOO_LARGE
FILE_IN_USE
OUT_OF_MEMORY
I_O_ERROR
SYS_CALL_NOT_IMPLEMENTED
INTERNAL_LOGIC_ERROR

enum SemaphoreError🔗

Enumerator Value Description
CREATION_FAILED
NAME_TOO_LONG
UNABLE_TO_OPEN_HANDLE
INVALID_SEMAPHORE_HANDLE
SEMAPHORE_OVERFLOW
INTERRUPTED_BY_SIGNAL_HANDLER
UNDEFINED

enum SemaphoreWaitState🔗

Enumerator Value Description
TIMEOUT
NO_TIMEOUT

enum Signal🔗

Enumerator Value Description
BUS SIGBUS
INT SIGINT
TERM SIGTERM
HUP SIGHUP
ABORT SIGABRT

Corresponds to the SIG* macros defined in signal.h. The integer values are equal to the corresponding macro value.

enum TimerError🔗

Enumerator Value Description
NO_ERROR
TIMER_NOT_INITIALIZED
NO_VALID_CALLBACK
KERNEL_ALLOC_FAILED
INVALID_ARGUMENTS
ALLOC_MEM_FAILED
NO_PERMISSION
INVALID_POINTER
NO_TIMER_TO_DELETE
TIMEOUT_IS_ZERO
INTERNAL_LOGIC_ERROR

using SignalHandlerCallback_t🔗

using iox::posix::SignalHandlerCallback_t = typedef void (*)(int);

using ThreadName_t🔗

using iox::posix::ThreadName_t = typedef cxx::string<MAX_THREAD_NAME_LENGTH>;

Functions Documentation🔗

function registerSignalHandler🔗

SignalGuard registerSignalHandler(
    const Signal signal,
    const SignalHandlerCallback_t callback
)

Register a callback for a specific posix signal (SIG***).

Parameters:

  • Signal the signal to which the callback should be attached
  • callback the callback which should be called when the signal is raised.

Return: SignalGuard, when it goes out of scope the previous signal action is restored.

Attention: if a signal callback was already registered for the provided signal with registerSignalHandler or with sigaction() or signal(), the signal callback is overridden until the SignalGuard goes out of scope and restores the previous callback. If you override the callbacks multiple times and the created SignalGuards goes out of scope in a different order then the callback is restored which was active when the last SignalGuard which is going out of scope was created.

function waitForTerminationRequest🔗

void waitForTerminationRequest()

convenience function, calls SignalWatcher::getInstance().waitForSignal();

function hasTerminationRequested🔗

bool hasTerminationRequested()

convenience function, calls SignalWatcher::getInstance().wasSignalTriggered();

function setThreadName🔗

void setThreadName(
    pthread_t thread,
    const ThreadName_t & name
)

function getThreadName🔗

ThreadName_t getThreadName(
    pthread_t thread
)

Attributes Documentation🔗

variable MaxNumberOfGroups🔗

static constexpr int MaxNumberOfGroups = 888;

variable POSIX_CALL_ERROR_STRING_SIZE🔗

static constexpr uint32_t POSIX_CALL_ERROR_STRING_SIZE = 128U;

variable POSIX_CALL_EINTR_REPETITIONS🔗

static constexpr uint64_t POSIX_CALL_EINTR_REPETITIONS = 5U;

variable POSIX_CALL_INVALID_ERRNO🔗

static constexpr int32_t POSIX_CALL_INVALID_ERRNO = -1;

variable CreateUnnamedSingleProcessSemaphore🔗

static constexpr CreateUnnamedSingleProcessSemaphore_t CreateUnnamedSingleProcessSemaphore =
    [CreateUnnamedSingleProcessSemaphore_t](/v2.0.5/API-reference/hoofs/Classes/structiox_1_1posix_1_1CreateUnnamedSingleProcessSemaphore__t/)();

variable CreateUnnamedSharedMemorySemaphore🔗

static constexpr CreateUnnamedSharedMemorySemaphore_t CreateUnnamedSharedMemorySemaphore =
    [CreateUnnamedSharedMemorySemaphore_t](/v2.0.5/API-reference/hoofs/Classes/structiox_1_1posix_1_1CreateUnnamedSharedMemorySemaphore__t/)();

variable CreateNamedSemaphore🔗

static constexpr CreateNamedSemaphore_t CreateNamedSemaphore = [CreateNamedSemaphore_t](/v2.0.5/API-reference/hoofs/Classes/structiox_1_1posix_1_1CreateNamedSemaphore__t/)();

variable OpenNamedSemaphore🔗

static constexpr OpenNamedSemaphore_t OpenNamedSemaphore = [OpenNamedSemaphore_t](/v2.0.5/API-reference/hoofs/Classes/structiox_1_1posix_1_1OpenNamedSemaphore__t/)();

variable MAX_THREAD_NAME_LENGTH🔗

constexpr uint64_t MAX_THREAD_NAME_LENGTH = 15U;

Updated on 18 December 2023 at 13:11:42 CET