Process name retrieval on apple.

This commit is contained in:
Bartosz Taudul 2019-02-20 13:13:29 +01:00
parent 8f75839d66
commit 9c966b6224

View File

@ -27,6 +27,11 @@
# include <sys/syscall.h>
#endif
#ifdef __APPLE__
# include <unistd.h>
# include <libproc.h>
#endif
#include <atomic>
#include <assert.h>
#include <chrono>
@ -219,6 +224,10 @@ static const char* GetProcessName()
# endif
#elif defined _GNU_SOURCE || defined __CYGWIN__
processName = program_invocation_short_name;
#elif defined __APPLE__
static char buf[1024];
proc_name( getpid(), buf, 1024 );
processName = buf;
#endif
return processName;
}