In Red Hat Enterprise Linux Server 5.4 (Linux kernel 2.6.18) For tests like dmtcp5, forkexec (tests with child processes), the child process may have a name "NAME (deleted)". This is arguably a bug in the kernel.
| 50 | // the child process may have a name "NAME (deleted)". |
| 51 | // This is arguably a bug in the kernel. |
| 52 | dmtcp::string |
| 53 | _GetProgramExe() |
| 54 | { |
| 55 | dmtcp::string exe = "/proc/self/exe"; |
| 56 | |
| 57 | // NOTE: ResolveSymlink is returning string on stack. Hopefully |
| 58 | // C++ dmtcp::string is smart enough to copy it. |
| 59 | dmtcp::string exeRes = jalib::Filesystem::ResolveSymlink(exe); |
| 60 | |
| 61 | JASSERT(exe != exeRes) (exe).Text("problem with /proc/self/exe"); |
| 62 | |
| 63 | // Bug fix for Linux 2.6.19 |
| 64 | if (jalib::strEndsWith(exeRes.c_str(), DELETED_FILE_SUFFIX)) { |
| 65 | exeRes.erase(exeRes.length() - strlen(DELETED_FILE_SUFFIX)); |
| 66 | } |
| 67 | |
| 68 | return exeRes; |
| 69 | } |
| 70 | |
| 71 | // Set buf, and return length read (including all null characters) |
| 72 | int |
no test coverage detected