Skip to content

Commit

Permalink
usdt: add hint when pid is not running
Browse files Browse the repository at this point in the history
  • Loading branch information
javierhonduco committed Mar 25, 2019
1 parent 86c9461 commit 9edb3e1
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/list.cpp
@@ -1,3 +1,4 @@
#include <signal.h>
#include <sys/types.h>
#include <dirent.h>
#include <fstream>
Expand Down Expand Up @@ -148,6 +149,9 @@ void list_probes(const std::string &search_input, int pid)
void *ctx = bcc_usdt_new_frompid(pid, nullptr);
if (ctx == nullptr) {
std::cerr << "failed to initialize usdt context for pid: " << pid << std::endl;
if (kill(pid, 0) == -1 && errno == ESRCH) {
std::cerr << "hint: process not running" << std::endl;
}
return;
}
bcc_usdt_foreach(ctx, usdt_each);
Expand Down

0 comments on commit 9edb3e1

Please sign in to comment.