-
Notifications
You must be signed in to change notification settings - Fork 402
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 #1054 unix platform support #1055
Iox #1054 unix platform support #1055
Conversation
0dccc80
to
11e262a
Compare
Codecov Report
@@ Coverage Diff @@
## master #1055 +/- ##
==========================================
- Coverage 77.78% 76.24% -1.54%
==========================================
Files 343 343
Lines 12957 12953 -4
Branches 1864 1863 -1
==========================================
- Hits 10078 9876 -202
- Misses 2262 2463 +201
+ Partials 617 614 -3
Flags with carried forward coverage won't be shown. Click here to find out more.
|
@@ -204,8 +204,8 @@ cxx::expected<std::string, IpcChannelError> MessageQueue::receive() const noexce | |||
return cxx::success<std::string>(std::string(&(message[0]))); | |||
} | |||
|
|||
cxx::expected<int32_t, IpcChannelError> MessageQueue::open(const IpcChannelName_t& name, | |||
const IpcChannelSide channelSide) noexcept | |||
cxx::expected<mqd_t, IpcChannelError> MessageQueue::open(const IpcChannelName_t& name, |
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.
Hint: mqd_t
is not a file descriptor and therefore not convertable to an int32_t
this worked just by accident.
@@ -323,13 +323,7 @@ cxx::expected<IpcChannelError> MessageQueue::timedSend(const std::string& msg, | |||
|
|||
cxx::expected<bool, IpcChannelError> MessageQueue::isOutdated() noexcept | |||
{ | |||
struct stat sb = {}; |
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.
Hint: fstat
requires as first input parameter a file descriptor. According to the posix manual mqd_t
is a message queue descriptor and not a file descriptor. This was just a happy little accident that in linux there was actually a file descriptor used in the implementation.
But this could change from one linux version to another and then the whole code breaks.
In the end we exploited undefined behavior.
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.
In this case this function could be removed or we need to find another way how to check whether the MessageQueue is outdated. On the other hand, this was a workaround to fix a startup race with RouDi and the applications and since we do not use the MessageQueue anymore, it is probably no harm to remove this.
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.
We already have a ticket and I added this as a task into the ticket #832
@@ -138,7 +138,7 @@ TEST_F(SemaphoreCreate_test, OpenNamedSemaphore) | |||
{ | |||
::testing::Test::RecordProperty("TEST_ID", "349cdf0d-987e-4e2f-aa35-98a40fdf979b"); | |||
auto semaphore = iox::posix::Semaphore::create(iox::posix::CreateNamedSemaphore, "/fuuSem", S_IRUSR | S_IWUSR, 10); | |||
auto semaphore2 = iox::posix::Semaphore::create(iox::posix::OpenNamedSemaphore, "/fuuSem", S_IRUSR | S_IWUSR); | |||
auto semaphore2 = iox::posix::Semaphore::create(iox::posix::OpenNamedSemaphore, "/fuuSem", O_CREAT); |
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.
Hint: Another bug uncovered by a unix posix system. The second parameter are the oflags
and not mode_t
.
By accident the mode_t
values were compatible to the oflag
values in this test. But who knows what they meant here.
67c9d83
to
f8af3af
Compare
1c0251d
to
6f19f94
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.
Looks good. Just a minor issue. I wish we could use pragma once
iceoryx_hoofs/platform/unix/include/iceoryx_hoofs/platform/acl.hpp
Outdated
Show resolved
Hide resolved
@@ -323,13 +323,7 @@ cxx::expected<IpcChannelError> MessageQueue::timedSend(const std::string& msg, | |||
|
|||
cxx::expected<bool, IpcChannelError> MessageQueue::isOutdated() noexcept | |||
{ | |||
struct stat sb = {}; |
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.
In this case this function could be removed or we need to find another way how to check whether the MessageQueue is outdated. On the other hand, this was a workaround to fix a startup race with RouDi and the applications and since we do not use the MessageQueue anymore, it is probably no harm to remove this.
Signed-off-by: Christian Eltzschig <me@elchris.org>
…queue descriptor is not a file descriptor Signed-off-by: Christian Eltzschig <me@elchris.org>
…ementation for unix, link unix with rt 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>
…g /usr/local/bin/bash to /bin/bash Signed-off-by: Christian Eltzschig <me@elchris.org>
Signed-off-by: Christian Eltzschig <me@elchris.org>
…o on unix Signed-off-by: Christian Eltzschig <me@elchris.org>
Signed-off-by: Christian Eltzschig <me@elchris.org>
…message queue from isOutdatedTest Signed-off-by: Christian Eltzschig <me@elchris.org>
…o zero in test Signed-off-by: Christian Eltzschig <me@elchris.org>
Signed-off-by: Christian Eltzschig <me@elchris.org>
400c30f
to
9571a90
Compare
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
IOX_UDS_SOCKET_MAX_MESSAGE_SIZE
was reduced to 1024 inplatform_settings.hpp
#include <unistd.h>
ingrp.cpp
.#define PTHREAD_MUTEX_RECURSIVE_NP PTHREAD_MUTEX_RECURSIVE
and#define PTHREAD_MUTEX_FAST_NP PTHREAD_MUTEX_DEFAULT
inpthread.hpp
since our implementation is not POSIX conformmqd_t
message queue descriptor. A message queue descriptor is NOT a file descriptor. Stated even as a warning in the posix manual! But we use it nevertheless as a filedescriptor for instance in combination withfstat
or when defining an invalid version. This was corrected mainly in the message queue posix wrapper.mode_t
andoflags
in the semaphore wrapper. The values are somehow compatible in linux, in FreeBSD we get luckily an invalid argument error.I am feeling lucky
warning.Checklist for the PR Reviewer
Post-review Checklist for the PR Author
References