Skip to content

iox::posix🔗

Classes🔗

Name
class iox::posix::AccessController
abstraction class for the management of access control lists (ACLs).
class iox::posix::Allocator
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::MemoryMap
class iox::posix::MessageQueue
Wrapper class for posix message queue.
struct iox::posix::OpenNamedSemaphore_t
class iox::posix::PosixGroup
struct iox::posix::PosixRights
class iox::posix::PosixUser
class iox::posix::Semaphore
Posix semaphore C++ Wrapping class.
class iox::posix::SharedMemory
class iox::posix::SharedMemoryObject
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::Timer
Interface for timers on POSIX operating systems.
class iox::posix::UnixDomainSocket
Wrapper class for unix domain socket.

Types🔗

Name
enum uint8_t IpcChannelError
enum uint8_t IpcChannelMode
enum uint8_t IpcChannelSide
enum MemoryMapError
enum uint64_t AccessMode
enum uint64_t OwnerShip
enum SharedMemoryError
enum SharedMemoryObjectError
enum FileLockError
enum SemaphoreError
enum SemaphoreWaitState
enum int Signal { BUS = SIGBUS, INT = SIGINT, TERM = SIGTERM, HUP = SIGHUP }
Corresponds to the SIG* macros defined in signal.h. The integer values are equal to the corresponding macro value.
enum TimerError
using uint8_t byte_t
using void(*)(int) SignalHandlerCallback_t
using cxx::string< MAX_THREAD_NAME_LENGTH > ThreadName_t

Functions🔗

Name
cxx::optional< uint64_t > pageSize()
struct timespec addTimeMs(struct timespec time, const uint32_t timeToAdd_ms)
adds period in time [ms] to a given timestruct
double subtractTimespecMS(const struct timespec minuend, const struct timespec subtrahend)
subtract subtrahend from minuend
SignalGuard registerSignalHandler(const Signal signal, const SignalHandlerCallback_t callback)
Register a callback for a specific posix signal (SIG***).
void setThreadName(pthread_t thread, const ThreadName_t & name)
ThreadName_t getThreadName(pthread_t thread)

Attributes🔗

Name
constexpr const char * ACCESS_MODE_STRING
constexpr const char * OWNERSHIP_STRING
constexpr uint64_t MaxPageSize
constexpr unsigned int TS_DIVIDER_sec
constexpr unsigned int TS_DIVIDER_msec
constexpr char PATH_PREFIX
constexpr int MaxNumberOfGroups
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 IpcChannelError🔗

Enumerator Value Description
INVALID_STATE
NOT_INITIALIZED
ACCESS_DENIED
NO_SUCH_CHANNEL
INTERNAL_LOGIC_ERROR
CHANNEL_ALREADY_EXISTS
INVALID_ARGUMENTS
MAX_MESSAGE_SIZE_EXCEEDED
MESSAGE_TOO_LONG
CHANNEL_FULL
INVALID_CHANNEL_NAME
TIMEOUT
PROCESS_LIMIT
SYSTEM_LIMIT
OUT_OF_MEMORY
INVALID_FILE_DESCRIPTOR
I_O_ERROR
CONNECTION_RESET_BY_PEER
UNDEFINED

enum IpcChannelMode🔗

Enumerator Value Description
NON_BLOCKING
BLOCKING

enum IpcChannelSide🔗

Enumerator Value Description
CLIENT
SERVER

enum MemoryMapError🔗

Enumerator Value Description
INVALID_STATE
ACCESS_FAILED
UNABLE_TO_LOCK
INVALID_FILE_DESCRIPTOR
MAP_OVERLAP
INVALID_PARAMETERS
OPEN_FILES_SYSTEM_LIMIT_EXCEEDED
FILESYSTEM_DOES_NOT_SUPPORT_MEMORY_MAPPING
NOT_ENOUGH_MEMORY_AVAILABLE
OVERFLOWING_PARAMETERS
PERMISSION_FAILURE
NO_WRITE_PERMISSION
UNKNOWN_ERROR

enum AccessMode🔗

Enumerator Value Description
READ_ONLY 0U
READ_WRITE 1U

enum OwnerShip🔗

Enumerator Value Description
MINE 0U
OPEN_EXISTING 1U

enum SharedMemoryError🔗

Enumerator Value Description
INVALID_STATE
EMPTY_NAME
NAME_WITHOUT_LEADING_SLASH
INSUFFICIENT_PERMISSIONS
DOES_EXIST
PROCESS_LIMIT_OF_OPEN_FILES_REACHED
SYSTEM_LIMIT_OF_OPEN_FILES_REACHED
DOES_NOT_EXIST
NOT_ENOUGH_MEMORY_AVAILABLE
REQUESTED_MEMORY_EXCEEDS_MAXIMUM_FILE_SIZE
PATH_IS_A_DIRECTORY
TOO_MANY_SYMBOLIC_LINKS
NO_FILE_RESIZE_SUPPORT
NO_RESIZE_SUPPORT
INVALID_FILEDESCRIPTOR
UNKNOWN_ERROR

enum SharedMemoryObjectError🔗

Enumerator Value Description
INVALID_STATE
SHARED_MEMORY_CREATION_FAILED
MAPPING_SHARED_MEMORY_FAILED

enum FileLockError🔗

Enumerator Value Description
INVALID_STATE
NO_FILE_NAME_PROVIDED
LOCKED_BY_OTHER_PROCESS
ACCESS_DENIED
INVALID_FILE_NAME
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
INVALID_STATE
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

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

enum TimerError🔗

Enumerator Value Description
INVALID_STATE
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 byte_t🔗

using iox::posix::byte_t = typedef uint8_t;

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 pageSize🔗

cxx::optional< uint64_t > pageSize()

function addTimeMs🔗

struct timespec addTimeMs(
    struct timespec time,
    const uint32_t timeToAdd_ms
)

adds period in time [ms] to a given timestruct

Parameters:

  • time period time base
  • timeToAdd_ms period in time [ms] to be added

Return: sum of the two inputs [timespec]

function subtractTimespecMS🔗

double subtractTimespecMS(
    const struct timespec minuend,
    const struct timespec subtrahend
)

subtract subtrahend from minuend

Parameters:

  • minuend [timespec]
  • subtrahend [timespec]

Return: result [ms]

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 setThreadName🔗

void setThreadName(
    pthread_t thread,
    const ThreadName_t & name
)

function getThreadName🔗

ThreadName_t getThreadName(
    pthread_t thread
)

Attributes Documentation🔗

variable ACCESS_MODE_STRING🔗

static constexpr const char * ACCESS_MODE_STRING = {"AccessMode::READ_ONLY", "AccessMode::READ_WRITE"};

variable OWNERSHIP_STRING🔗

static constexpr const char * OWNERSHIP_STRING = {"OwnerShip::MINE", "OwnerShip::OPEN_EXISTING"};

variable MaxPageSize🔗

constexpr uint64_t MaxPageSize = 1024u * 512u;

variable TS_DIVIDER_sec🔗

constexpr unsigned int TS_DIVIDER_sec = 1000000000;

variable TS_DIVIDER_msec🔗

constexpr unsigned int TS_DIVIDER_msec = (TS_DIVIDER_sec / 1000);

variable PATH_PREFIX🔗

constexpr char PATH_PREFIX = "/tmp/";

variable MaxNumberOfGroups🔗

static constexpr int MaxNumberOfGroups = 888;

variable CreateUnnamedSingleProcessSemaphore🔗

static constexpr CreateUnnamedSingleProcessSemaphore_t CreateUnnamedSingleProcessSemaphore =
    [CreateUnnamedSingleProcessSemaphore_t](/v1.0.1/API-reference/utils/Classes/structiox_1_1posix_1_1CreateUnnamedSingleProcessSemaphore__t/)();

variable CreateUnnamedSharedMemorySemaphore🔗

static constexpr CreateUnnamedSharedMemorySemaphore_t CreateUnnamedSharedMemorySemaphore =
    [CreateUnnamedSharedMemorySemaphore_t](/v1.0.1/API-reference/utils/Classes/structiox_1_1posix_1_1CreateUnnamedSharedMemorySemaphore__t/)();

variable CreateNamedSemaphore🔗

static constexpr CreateNamedSemaphore_t CreateNamedSemaphore = [CreateNamedSemaphore_t](/v1.0.1/API-reference/utils/Classes/structiox_1_1posix_1_1CreateNamedSemaphore__t/)();

variable OpenNamedSemaphore🔗

static constexpr OpenNamedSemaphore_t OpenNamedSemaphore = [OpenNamedSemaphore_t](/v1.0.1/API-reference/utils/Classes/structiox_1_1posix_1_1OpenNamedSemaphore__t/)();

variable MAX_THREAD_NAME_LENGTH🔗

constexpr uint64_t MAX_THREAD_NAME_LENGTH = 15U;

Updated on 17 June 2021 at 11:15:26 CEST