Skip to content

Commit

Permalink
Use 'rcutils_get_executable_name' to get the name of the process (#94) (
Browse files Browse the repository at this point in the history
#97)

Signed-off-by: Simon Hoinkis <simon.hoinkis@apex.ai>
  • Loading branch information
mossmaurice authored Sep 18, 2023
1 parent 6567d29 commit 4936431
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions rmw_iceoryx_cpp/src/rmw_init.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
#include "iceoryx_posh/runtime/posh_runtime.hpp"

#include "rcutils/error_handling.h"
#include "rcutils/process.h"

#include "rmw/error_handling.h"
#include "rmw/impl/cpp/macros.hpp"
Expand Down Expand Up @@ -95,8 +96,9 @@ rmw_init(const rmw_init_options_t * options, rmw_context_t * context)
context->impl = nullptr;

// create a name for the process to register with the RouDi daemon
extern char * __progname;
auto progName = std::string(__progname);
rcutils_allocator_t allocator = rcutils_get_default_allocator();
auto progam_name = rcutils_get_executable_name(allocator);
auto progName = std::string(progam_name);
/// @todo we could check with the introspection topics beforehand if the name is already used
auto name = progName + "_" + std::to_string(getpid());

Expand Down

0 comments on commit 4936431

Please sign in to comment.