iceoryx icon indicating copy to clipboard operation
iceoryx copied to clipboard

define pid_t for different platforms and use it for filedescriptors

Open dkroenke opened this issue 3 years ago • 3 comments

Brief feature description

In iceoryx we are creating and using often filedescriptors. In POSIX standard the type for descriptors is defined as pid_t in <sys/types.h> on Unix. In iceoryx we have iceoryx_utils/platform/types.hpp for the diferent platforms as header available. This should be consistently used instead of int for all filedescriptors in iceoryx. Please be aware that windows doesn't know pid_t, it make sense to add a define for having it as int.

dkroenke avatar Jan 05 '21 19:01 dkroenke

@dkroenke I would recommend to introduce iox_pid_t which is an alias for pid_t in linux/mac/qnx and something else in windows. I already did it with the semaphores, see: https://github.com/eclipse-iceoryx/iceoryx/blob/master/iceoryx_utils/platform/linux/include/iceoryx_utils/platform/semaphore.hpp where I introduced iox_sem_t in the same manner.

elfenpiff avatar Jan 12 '21 09:01 elfenpiff

@elfenpiff I'm not sure about the naming convention. I understand that for the semaphore we add the "iox_" prefix because we made a custom implementation for it on the different platforms. But for a simple datatype like pid_t from <sys/types.h> i see no reason to add an iox_ prefix here because we do not make a custom implementation of it.

dkroenke avatar Jan 12 '21 10:01 dkroenke

@dkroenke I hope you are right but sometimes Windows suprises you and then we have another iox_ prefix ... But for now you are right, we should not over complicate things!

elfenpiff avatar Jan 12 '21 12:01 elfenpiff