MCPcopy Create free account
hub / github.com/chen3feng/toft / BinaryName

Method BinaryName

system/process/this_process.cpp:75–92  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

73}
74
75std::string ThisProcess::BinaryName()
76{
77 std::string binary_name;
78
79 char path[PATH_MAX] = {0};
80 FILE* fp = fopen("/proc/self/cmdline", "r");
81 if (fp != NULL) {
82 if (fgets(path, sizeof(path) - 1, fp))
83 binary_name = Path::GetBaseName(path);
84 fclose(fp);
85 }
86 // If fopen failed or the process is defunct,
87 // read binary name from exe softlink.
88 if (binary_name.empty()) {
89 binary_name = Path::GetBaseName(BinaryPath());
90 }
91 return binary_name;
92}
93
94std::string ThisProcess::BinaryDirectory()
95{

Callers

nothing calls this directly

Calls 1

emptyMethod · 0.45

Tested by

no test coverage detected