-
-
Notifications
You must be signed in to change notification settings - Fork 74
/
Copy pathros-noetic-rosmon-core.patch
98 lines (90 loc) · 2.7 KB
/
ros-noetic-rosmon-core.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 7441df6..9bff2c0 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -11,12 +11,11 @@ find_package(catkin REQUIRED COMPONENTS
rospack
diagnostic_msgs
)
+find_package(fmt REQUIRED)
catkin_package()
include_directories(${catkin_INCLUDE_DIRS})
-set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Werror")
-
find_package(TinyXML REQUIRED)
find_package(Curses REQUIRED)
@@ -107,6 +107,7 @@ target_link_libraries(rosmon
yaml-cpp
util
rosmon_launch_config
+ fmt::fmt
)
add_dependencies(rosmon ${catkin_EXPORTED_TARGETS})
@@ -126,6 +125,7 @@ add_executable(dump_param
)
target_link_libraries(dump_param
${catkin_LIBRARIES}
+ fmt::fmt
)
add_executable(abort_really_long_executable
diff --git a/src/monitor/shim.cpp b/src/monitor/shim.cpp
index 7dec1cc..da51913 100644
--- a/src/monitor/shim.cpp
+++ b/src/monitor/shim.cpp
@@ -15,6 +15,19 @@
#include <sys/resource.h>
#include <sys/prctl.h>
+// **NOTE: Adapted from https://reviews.llvm.org/D39717 **
+// Sufficiently old kernel headers don't provide this value, but we can still
+// call prctl with it. If the runtime kernel is new enough, the prctl call will
+// have the desired effect; if the kernel is too old, the call will error and we
+// can ignore said error.
+#ifndef PR_SET_PTRACER
+#define PR_SET_PTRACER 0x59616d61
+#endif
+
+#ifndef PR_SET_PTRACER_ANY
+#define PR_SET_PTRACER_ANY ((unsigned long)-1)
+#endif
+
static const struct option OPTIONS[] = {
{"help", no_argument, nullptr, 'h'},
{"namespace", required_argument, nullptr, 'n'},
diff --git a/src/logger.cpp b/src/logger.cpp
index 881339c..9d9fb5f 100644
--- a/src/logger.cpp
+++ b/src/logger.cpp
@@ -4,6 +4,7 @@
#include "logger.h"
#include "fmt/format.h"
+#include <array>
#include <cerrno>
#include <cstdio>
#include <cstring>
diff --git a/src/main.cpp b/src/main.cpp
index ae0e733..3422d76 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -45,7 +45,7 @@ static fs::path findFile(const fs::path& base, const std::string& name)
if(!p.empty())
return p;
}
- else if(it->path().leaf() == name)
+ else if(it->path().filename() == name)
return *it;
}
@@ -373,12 +373,12 @@ int main(int argc, char** argv)
// Try systemd journal first
try
{
- logger.reset(new rosmon::SystemdLogger(fs::basename(launchFilePath)));
+ logger.reset(new rosmon::SystemdLogger(fs::path(launchFilePath).stem().string()));
}
catch(rosmon::SystemdLogger::NotAvailable& e)
{
fmt::print(stderr, "Systemd Journal not available: {}\n", e.what());
- logger.reset(new rosmon::SyslogLogger(fs::basename(launchFilePath)));
+ logger.reset(new rosmon::SyslogLogger(fs::path(launchFilePath).stem().string()));
}
}
else