-
Notifications
You must be signed in to change notification settings - Fork 403
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Iox #33 implement ipc mutex semaphore #834
Iox #33 implement ipc mutex semaphore #834
Conversation
Codecov Report
@@ Coverage Diff @@
## master #834 +/- ##
==========================================
+ Coverage 75.05% 75.11% +0.06%
==========================================
Files 332 332
Lines 11863 11880 +17
Branches 2001 2007 +6
==========================================
+ Hits 8904 8924 +20
+ Misses 2190 2187 -3
Partials 769 769
Flags with carried forward coverage won't be shown. Click here to find out more.
|
f3e3eb3
to
8fcdad2
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
platform files not yet reviewed ... something for tomorrow
...yx_hoofs/include/iceoryx_hoofs/internal/posix_wrapper/shared_memory_object/shared_memory.hpp
Outdated
Show resolved
Hide resolved
...yx_hoofs/include/iceoryx_hoofs/internal/posix_wrapper/shared_memory_object/shared_memory.hpp
Outdated
Show resolved
Hide resolved
iceoryx_hoofs/source/posix_wrapper/shared_memory_object/shared_memory.cpp
Outdated
Show resolved
Hide resolved
iceoryx_hoofs/source/posix_wrapper/shared_memory_object/shared_memory.cpp
Outdated
Show resolved
Hide resolved
iceoryx_hoofs/source/posix_wrapper/shared_memory_object/shared_memory.cpp
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well, couldn't wait. All files reviewed.
|
||
int HandleTranslator::add(HANDLE handle) noexcept | ||
{ | ||
for (int64_t limit = m_handleList.size(), k = 0; k < limit; ++k) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's a pity we don't get the index in a range based for loop. But why this unusual for-loop parameters and not just int64_t i = 0; i < m_handleList.size(); ++i
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is my habit and this is useful when working with a std::vector
where it is possible that with every iteration the size is determined again. But I admit this is not required in the cxx::vector
case since we store the size there.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's the same with std::vector
and other container, at least in release builds.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add some explanation to the newly added classes
iceoryx_hoofs/platform/win/include/iceoryx_hoofs/platform/handle_translator.hpp
Show resolved
Hide resolved
iceoryx_hoofs/platform/win/include/iceoryx_hoofs/platform/platform_settings.hpp
Show resolved
Hide resolved
…aphore Signed-off-by: Christian Eltzschig <me@elchris.org>
Signed-off-by: Christian Eltzschig <me@elchris.org>
Signed-off-by: Christian Eltzschig <me@elchris.org>
Signed-off-by: Christian Eltzschig <me@elchris.org>
Signed-off-by: Christian Eltzschig <me@elchris.org>
Signed-off-by: Christian Eltzschig <me@elchris.org>
Signed-off-by: Christian Eltzschig <me@elchris.org>
Signed-off-by: Christian Eltzschig <me@elchris.org>
…meout is waited Signed-off-by: Christian Eltzschig <me@elchris.org>
Signed-off-by: Christian Eltzschig <me@elchris.org>
… into explicit policy Signed-off-by: Christian Eltzschig <me@elchris.org>
Signed-off-by: Christian Eltzschig <me@elchris.org>
Signed-off-by: Christian Eltzschig <me@elchris.org>
Signed-off-by: Christian Eltzschig <me@elchris.org>
Signed-off-by: Christian Eltzschig <me@elchris.org>
Signed-off-by: Christian Eltzschig <me@elchris.org>
Signed-off-by: Christian Eltzschig <me@elchris.org>
- rename Policy into OpenMode - return cxx::expected in unlinkIfExist in SharedMemory Signed-off-by: Christian Eltzschig <me@elchris.org>
Signed-off-by: Christian Eltzschig <me@elchris.org>
Signed-off-by: Christian Eltzschig <me@elchris.org>
Signed-off-by: Christian Eltzschig <me@elchris.org>
Signed-off-by: Christian Eltzschig <me@elchris.org>
Signed-off-by: Christian Eltzschig <me@elchris.org>
Signed-off-by: Christian Eltzschig <me@elchris.org>
- swap EINVAL errno with ENOENT in mac os Signed-off-by: Christian Eltzschig <me@elchris.org>
Signed-off-by: Christian Eltzschig <me@elchris.org>
...yx_hoofs/include/iceoryx_hoofs/internal/posix_wrapper/shared_memory_object/shared_memory.hpp
Outdated
Show resolved
Hide resolved
...yx_hoofs/include/iceoryx_hoofs/internal/posix_wrapper/shared_memory_object/shared_memory.hpp
Outdated
Show resolved
Hide resolved
@@ -89,7 +89,7 @@ NamedPipe::NamedPipe(const IpcChannelName_t& name, | |||
// m_messages. when we add the alignment it is guaranteed that enough memory should be available. | |||
sizeof(MessageQueue_t) + alignof(MessageQueue_t), | |||
AccessMode::READ_WRITE, | |||
(channelSide == IpcChannelSide::SERVER) ? OwnerShip::MINE : OwnerShip::OPEN_EXISTING_SHM, | |||
(channelSide == IpcChannelSide::SERVER) ? OpenMode::OPEN_OR_CREATE : OpenMode::OPEN_EXISTING, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why OPEN_OR_CREATE
? It's different from our current IpcChannel
implementations
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is correct but it is absolutely no problem to support multiple readers and writes for named pipes and therefore I wanted to use this advantage right from the beginning. I felt that restricting this to single server multiple clients would gain nothing.
The restriction would require more code (for the error handling when a named pipe already exists and you would like to create a server) and would have less flexibility and this seemed just weird.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How does the shm behave i unlink is called even if there are other applications which have it still mapped into address space? Can they sill use the shm or do they crash?
Oh, and with this approach it is also possible to "steal" messages from the server without him even noticing it. The message queue has the same problem though, not sure about the unix domain socket.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can they sill use the shm or do they crash?
They will crash and burn. Yeah this is maybe dangerous to use but when we restrict this I would restrict this on a higher level - for instance in a real IpcChannel abstraction. The posix wrappers do not restrict functionality they provide the developer with what is possible (with a safe API) so that they can decide howto handle it with logic or restrictions.
"steal" messages?
Actually we can solve this problem easily with ACLs. Then only the trustworthy applications have read/write access. Also every client can steal messages from a named pipe since the server and the client requires write access.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's a good point. It might be quite difficult to prevent stealing with the NamedPipe. I guess it should not be used in environments where this is a problem.
iceoryx_hoofs/source/posix_wrapper/shared_memory_object/shared_memory.cpp
Outdated
Show resolved
Hide resolved
iceoryx_hoofs/source/posix_wrapper/shared_memory_object/shared_memory.cpp
Outdated
Show resolved
Hide resolved
- corrected OpenMode translation - added doxygen docu to Shared Memory - cleaned up unlinkIfExists in SharedMemory - oflags translation adjusted - unlink() always resets the SharedMemory directly - removing possible shm in SetUp of shared memory moduletests - tested further side conditions for different OpenModes Signed-off-by: Christian Eltzschig <me@elchris.org>
Signed-off-by: Christian Eltzschig <me@elchris.org>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
almost there
Signed-off-by: Christian Eltzschig <me@elchris.org>
iceoryx_posh/include/iceoryx_posh/roudi/memory/posix_shm_memory_provider.hpp
Show resolved
Hide resolved
Signed-off-by: Christian Eltzschig <me@elchris.org>
Pre-Review Checklist for the PR Author
iox-#123-this-is-a-branch
)iox-#123 commit text
)git commit -s
)task-list-completed
)Notes for Reviewer
Checklist for the PR Reviewer
Post-review Checklist for the PR Author
References