From d68bd8eade18c37064668fbd19abbb2aa67ba998 Mon Sep 17 00:00:00 2001 From: Karsten Knese Date: Thu, 30 Jan 2020 16:31:45 -0800 Subject: [PATCH 1/3] wip Signed-off-by: Karsten Knese --- .../include/iceoryx_utils/internal/cxx/vector.inl | 3 ++- .../include/iceoryx_utils/internal/units/duration.hpp | 8 ++++++++ .../posix_wrapper/shared_memory_object/allocator.cpp | 2 +- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/iceoryx_utils/include/iceoryx_utils/internal/cxx/vector.inl b/iceoryx_utils/include/iceoryx_utils/internal/cxx/vector.inl index b957210c44..098feffb36 100644 --- a/iceoryx_utils/include/iceoryx_utils/internal/cxx/vector.inl +++ b/iceoryx_utils/include/iceoryx_utils/internal/cxx/vector.inl @@ -201,7 +201,8 @@ inline const T& vector::at(const uint64_t index) const { if (index + 1 > m_size) { - fprintf(stderr, "out of bounds access, current size is %lu but given index is %lu\n", m_size, index); + std::cerr << "out of bounds access, current size is " + << m_size << " but given index is " << index << std::endl; std::terminate(); } return reinterpret_cast(m_data)[index]; diff --git a/iceoryx_utils/include/iceoryx_utils/internal/units/duration.hpp b/iceoryx_utils/include/iceoryx_utils/internal/units/duration.hpp index 98f5478856..9de045ac2e 100644 --- a/iceoryx_utils/include/iceoryx_utils/internal/units/duration.hpp +++ b/iceoryx_utils/include/iceoryx_utils/internal/units/duration.hpp @@ -22,6 +22,14 @@ #include #include +#ifdef __APPLE__ +struct itimerspec +{ + struct timespec it_value; + struct timespec it_interval; +}; +#endif + namespace iox { namespace units diff --git a/iceoryx_utils/source/posix_wrapper/shared_memory_object/allocator.cpp b/iceoryx_utils/source/posix_wrapper/shared_memory_object/allocator.cpp index 359182f06b..773470a7d0 100644 --- a/iceoryx_utils/source/posix_wrapper/shared_memory_object/allocator.cpp +++ b/iceoryx_utils/source/posix_wrapper/shared_memory_object/allocator.cpp @@ -41,7 +41,7 @@ void* Allocator::allocate(const uint64_t f_size, const uint64_t f_alignment) } uintptr_t l_currentAddress = reinterpret_cast(m_startAddress) + m_currentPosition; - uintptr_t l_alignedPosition = cxx::align(l_currentAddress, f_alignment); + uintptr_t l_alignedPosition = cxx::align(l_currentAddress, static_cast(f_alignment)); l_alignedPosition -= reinterpret_cast(m_startAddress); byte_t* l_returnValue = nullptr; From 7e3c95c15cb2ccd6f78632dd4d6239f133b7e217 Mon Sep 17 00:00:00 2001 From: Karsten Knese Date: Thu, 30 Jan 2020 16:33:09 -0800 Subject: [PATCH 2/3] wip Signed-off-by: Karsten Knese --- .github/ISSUE_TEMPLATE/bug_report.md | 25 ------------------- .github/ISSUE_TEMPLATE/feature_request.md | 16 ------------ .../iceoryx_utils/internal/cxx/vector.inl | 2 +- 3 files changed, 1 insertion(+), 42 deletions(-) delete mode 100644 .github/ISSUE_TEMPLATE/bug_report.md delete mode 100644 .github/ISSUE_TEMPLATE/feature_request.md diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md deleted file mode 100644 index 6f2be27963..0000000000 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ /dev/null @@ -1,25 +0,0 @@ ---- -name: Bug report -about: Create a report to help us improve -title: '' -labels: '' -assignees: '' - ---- - -## Required information - -**Operating system:** -E.g. Ubuntu 18.04 LTS - -**Compiler version:** -E.g. GCC 7.4.0 - -**Observed result or behaviour:** -A clear and precise description of the observed result. - -**Expected result or behaviour:** -What do you expect to happen? - -**Conditions where it occurred / Performed steps:** -Describe how one can reproduce the bug. diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md deleted file mode 100644 index 9f1bf044e9..0000000000 --- a/.github/ISSUE_TEMPLATE/feature_request.md +++ /dev/null @@ -1,16 +0,0 @@ ---- -name: Feature request -about: Suggest an idea for this project -title: '' -labels: '' -assignees: '' - ---- - -## Brief feature description - -Please describe in a few sentences what should be implemented - -## Detailed information - -E.g. a list of pros and cons of different considerations and how iceoryx and its user could benefit from it diff --git a/iceoryx_utils/include/iceoryx_utils/internal/cxx/vector.inl b/iceoryx_utils/include/iceoryx_utils/internal/cxx/vector.inl index 098feffb36..eadea11b35 100644 --- a/iceoryx_utils/include/iceoryx_utils/internal/cxx/vector.inl +++ b/iceoryx_utils/include/iceoryx_utils/internal/cxx/vector.inl @@ -202,7 +202,7 @@ inline const T& vector::at(const uint64_t index) const if (index + 1 > m_size) { std::cerr << "out of bounds access, current size is " - << m_size << " but given index is " << index << std::endl; + << m_size << " but given index is " << index << std::endl; std::terminate(); } return reinterpret_cast(m_data)[index]; From 4b2d0bef5019ddcfcb01e17fda9083b5430de098 Mon Sep 17 00:00:00 2001 From: Karsten Knese Date: Thu, 30 Jan 2020 17:00:10 -0800 Subject: [PATCH 3/3] wip Signed-off-by: Karsten Knese --- .../include/iceoryx_utils/posix_wrapper/timer.hpp | 4 ++++ iceoryx_utils/source/posix_wrapper/semaphore.cpp | 14 ++++++++++++-- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/iceoryx_utils/include/iceoryx_utils/posix_wrapper/timer.hpp b/iceoryx_utils/include/iceoryx_utils/posix_wrapper/timer.hpp index be018725a2..f09c882fdd 100644 --- a/iceoryx_utils/include/iceoryx_utils/posix_wrapper/timer.hpp +++ b/iceoryx_utils/include/iceoryx_utils/posix_wrapper/timer.hpp @@ -27,6 +27,10 @@ #include #include +#if __APPLE__ +#define timer_t time_t +#endif + namespace iox { namespace posix diff --git a/iceoryx_utils/source/posix_wrapper/semaphore.cpp b/iceoryx_utils/source/posix_wrapper/semaphore.cpp index 016da5a5c0..c15d730bbb 100644 --- a/iceoryx_utils/source/posix_wrapper/semaphore.cpp +++ b/iceoryx_utils/source/posix_wrapper/semaphore.cpp @@ -97,8 +97,13 @@ bool Semaphore::timedWait(const struct timespec* abs_timeout, const bool doConti // interruption error while (true) { +#if __APPLE__ + auto cCall = cxx::makeSmartC( + sem_trywait, cxx::ReturnMode::PRE_DEFINED_ERROR_CODE, {-1}, {ETIMEDOUT}, m_handlePtr, abs_timeout); +#else auto cCall = cxx::makeSmartC( sem_timedwait, cxx::ReturnMode::PRE_DEFINED_ERROR_CODE, {-1}, {ETIMEDOUT}, m_handlePtr, abs_timeout); +#endif if (cCall.hasErrors()) { return false; @@ -115,8 +120,13 @@ bool Semaphore::timedWait(const struct timespec* abs_timeout, const bool doConti } else { - auto cCall = cxx::makeSmartC( - sem_timedwait, cxx::ReturnMode::PRE_DEFINED_ERROR_CODE, {-1}, {ETIMEDOUT}, m_handlePtr, abs_timeout); +#if __APPLE__ + auto cCall = cxx::makeSmartC( + sem_trywait, cxx::ReturnMode::PRE_DEFINED_ERROR_CODE, {-1}, {ETIMEDOUT}, m_handlePtr, abs_timeout); +#else + auto cCall = cxx::makeSmartC( + sem_timedwait, cxx::ReturnMode::PRE_DEFINED_ERROR_CODE, {-1}, {ETIMEDOUT}, m_handlePtr, abs_timeout); +#endif if (cCall.hasErrors() || cCall.getErrNum() == ETIMEDOUT) { return false;