| 244 | #endif |
| 245 | |
| 246 | Status PstackWatcher::RunStackDump(const vector<string>& argv) { |
| 247 | printf("************************ BEGIN STACKS **************************\n"); |
| 248 | if (fflush(stdout) == EOF) { |
| 249 | return Status::IOError("Unable to flush stdout", ErrnoToString(errno), errno); |
| 250 | } |
| 251 | Subprocess pstack_proc(argv); |
| 252 | RETURN_NOT_OK_PREPEND(pstack_proc.Start(), "RunStackDump proc.Start() failed"); |
| 253 | int ret; |
| 254 | RETRY_ON_EINTR(ret, ::close(pstack_proc.ReleaseChildStdinFd())); |
| 255 | if (ret == -1) { |
| 256 | return Status::IOError("Unable to close child stdin", ErrnoToString(errno), errno); |
| 257 | } |
| 258 | RETURN_NOT_OK_PREPEND(pstack_proc.Wait(), "RunStackDump proc.Wait() failed"); |
| 259 | int exit_code; |
| 260 | string exit_info; |
| 261 | RETURN_NOT_OK_PREPEND(pstack_proc.GetExitStatus(&exit_code, &exit_info), |
| 262 | "RunStackDump proc.GetExitStatus() failed"); |
| 263 | if (exit_code != 0) { |
| 264 | return Status::RuntimeError("RunStackDump proc.Wait() error", exit_info); |
| 265 | } |
| 266 | printf("************************* END STACKS ***************************\n"); |
| 267 | if (fflush(stdout) == EOF) { |
| 268 | return Status::IOError("Unable to flush stdout", ErrnoToString(errno), errno); |
| 269 | } |
| 270 | |
| 271 | return Status::OK(); |
| 272 | } |
| 273 | |
| 274 | } // namespace kudu |
nothing calls this directly
no test coverage detected