extern "C" {
#include <dlfcn.h>
+#include <errno.h>
#include <fcntl.h>
#include <getopt.h>
-#include <libgen.h>
#include <limits.h>
#include <sys/stat.h>
#include <sys/types.h>
using namespace std;
-static const char* program = "stapdyn";
-
struct stapdyn_uprobe_probe {
uint64_t index, offset, semaphore;
}
catch (runtime_error& e)
{
- clog << program << ": dlsym " << e.what() << endl;
+ clog << program_invocation_short_name
+ << ": dlsym " << e.what() << endl;
return targets;
}
}
catch (runtime_error& e)
{
- clog << program << ": dlsym " << e.what() << endl;
+ clog << program_invocation_short_name
+ << ": dlsym " << e.what() << endl;
return 1;
}
int rc = session_init();
if (rc)
{
- clog << program << ": stp_dyninst_session_init returned " << rc << endl;
+ clog << program_invocation_short_name
+ << ": stp_dyninst_session_init returned " << rc << endl;
return 1;
}
if (!module)
usage (1);
- program = basename(argv[0]);
-
(void)dlerror(); // clear previous errors
void* dlmodule = dlopen(module, RTLD_NOW);
if (!dlmodule)
{
- clog << program << ": dlopen " << dlerror() << endl;
+ clog << program_invocation_short_name
+ << ": dlopen " << dlerror() << endl;
return 1;
}