Commit 045863aa authored by Eric Cano's avatar Eric Cano
Browse files

Added thread naming in taped.

The different processes of taped can now be identified as in this exemple:
[eric@localhost ~]$ ps -ax -o "pid comm cmd"  | grep /usr/bin/cta-taped
[...]
32593 cta-taped-main  /usr/bin/cta-taped -fl /cta-taped.log
32800 cta-tpd-VDSTK11 /usr/bin/cta-taped -fl /cta-taped.log
32801 cta-taped-gc    /usr/bin/cta-taped -fl /cta-taped.log
parent be53ba7c
......@@ -38,6 +38,7 @@
#include <signal.h>
#include <sys/wait.h>
#include <set>
#include <sys/prctl.h>
namespace cta { namespace tape { namespace daemon {
......@@ -843,6 +844,11 @@ int DriveHandler::runChild() {
// Otherwise, this session will run a regular data transfer session which will
// schedule itself info an empty drive probe, archive, retrieve or label session.
// Set the thread name for process ID:
std::string threadName = "cta-tpd-";
threadName+=m_configLine.unitName;
prctl(PR_SET_NAME, threadName.c_str());
// Create the channel to talk back to the parent process.
cta::tape::daemon::DriveHandlerProxy driveHandlerProxy(*m_socketPair);
......
......@@ -32,6 +32,7 @@
#include <signal.h>
#include <sys/wait.h>
#include <sys/prctl.h>
namespace cta { namespace tape { namespace daemon {
......@@ -245,6 +246,9 @@ int GarbageCollectorHandler::runChild() {
// We do not have to care for previous crashed sessions as we will garbage
// collect them like any other crashed agent.
// Set the thread name for process ID:
prctl(PR_SET_NAME, "cta-taped-gc");
// Before anything, we will check for access to the scheduler's central storage.
// If we fail to access it, we cannot work. We expect the drive processes to
// fail likewise, so we just wait for shutdown signal (no feedback to main
......
......@@ -26,6 +26,7 @@
#include "GarbageCollectorHandler.hpp"
#include <google/protobuf/service.h>
#include <limits.h>
#include <sys/prctl.h>
namespace cta { namespace tape { namespace daemon {
......@@ -90,6 +91,8 @@ void cta::tape::daemon::TapeDaemon::exceptionThrowingMain() {
// future
setProcessCapabilities("cap_sys_rawio+p");
// Set the name of the (unique) thread for easy process identification.
prctl(PR_SET_NAME, "cta-taped-main");
mainEventLoop();
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment