File tree Expand file tree Collapse file tree 1 file changed +17
-2
lines changed
Expand file tree Collapse file tree 1 file changed +17
-2
lines changed Original file line number Diff line number Diff line change 77
88#include < unistd.h>
99
10+ #ifdef _OS_MAC
11+ #include < mach-o/dyld.h>
12+ #endif
13+
1014namespace AliceO2
1115{
1216// / ALICE O2 Monitoring system
@@ -28,14 +32,25 @@ inline void ProcessDetails::generatePid()
2832inline void ProcessDetails::generateProcessName ()
2933{
3034 char buff[255 ];
35+ #ifdef _OS_LINUX
3136 ssize_t len = ::readlink (" /proc/self/exe" , buff, sizeof (buff)-1 );
3237 if (len != -1 ) {
3338 buff[len] = ' \0 ' ;
3439 mProcessName = std::string (buff);
35- mProcessName = mProcessName .substr (mProcessName .find_last_of (" /" ) + 1 );
3640 }
37- else {
41+ #endif
42+
43+ #ifdef _OS_MAC
44+ uint32_t size = sizeof (buff);
45+ if (_NSGetExecutablePath (buff, &size) == 0 ) {
46+ mProcessName = std::string (buff);
47+ }
48+ #endif
49+
50+ if (mProcessName .empty ()) {
3851 mProcessName = " !" ;
52+ } else {
53+ mProcessName = mProcessName .substr (mProcessName .find_last_of (" /" ) + 1 );
3954 }
4055}
4156
You can’t perform that action at this time.
0 commit comments