eclipse-iceoryx / iceoryx

Eclipse iceoryx™ - true zero-copy inter-process-communication
https://iceoryx.io
Apache License 2.0
1.58k stars 373 forks source link

Implement Posix System Configuration verificator #1649

Open elfenpiff opened 1 year ago

elfenpiff commented 1 year ago

Brief feature description

Let's assume we deploy iceoryx on a POSIX certified system. It is still possible for that system to not support certain features, it is allowed to have different system limits or other restrictions which are system specific and independent of the POSIX certification.

Important open question:

Is it allowed to implement simple functions like strncmp and strncpy or others in a non threadsafe way? This means those functions are not allowed to be called concurrently. This would effect basic classes like cxx::string, cxx::vector. The sysconf option _SC_THREAD_SAFE_FUNCTIONS implies that this is allowed when the system informs the user about it. We have to dig deeper here to make sure that the attribute Thread Safety and value MT-Safe depend on the option above (see: man strncmp for the attribute/value).

Details

We should implement a simple verification function which checks if the system limits and features iceoryx requires are actually provided by the system. This should include things like:

The steps would be that a platform or iceoryx_hoofs or iceoryx_posh defines its requirements to its system and that those are verified either everytime on startup or that we provide a deployment binary which verifies the system.

For a full list see: https://pubs.opengroup.org/onlinepubs/007908799/xsh/sysconf.html

elBoberido commented 1 year ago

@elfenpiff you mean something like a platform conformity suite for iceoryx?

elfenpiff commented 1 year ago

@elBoberido no.

The platform conformity suite verifies that the actual platform behaves like the posix standard defines. But this is something we actually don't have to do when the platform is certified according to POSIX PSE52. Then the open group has already done this for us.

But still it is allowed to be certified according to this standard and do not provide semaphore, shared memory or thread support. The call sysconf(_SC_SEMAPHORES); would in this case return 0 to indicate that semaphore for instance are not supported. And now the question: How does sem_init behave when they are not supported, answer is: undefined. So it is possible that iceoryx seems to run on a posix platform without realizing that some functionality is restricted since the underlying posix calls return 0 and set errno to 0.

This is why we need the posix system configuration verificator. It assumes that the platform is posix compliant and checks if that platform supports the features we require, like threads, semaphores etc.

elBoberido commented 1 year ago

@elBoberido I said platform conformity suite for iceoryx not platform conformity suite for POSIX :)

What you described is exactly what I meant. We must ensure that the platform abstraction works according our assumptions. Which means that the posix calls must not only be implemented but work for our use cases.