mirror of
https://github.com/ceph/ceph
synced 2024-12-28 14:34:13 +00:00
global/signale_handler: print thread name in signal handle.
Now most thread has own thread name. So print thread name in signal handle. Signed-off-by: Jianpeng Ma <jianpeng.ma@intel.com>
This commit is contained in:
parent
22cac93ec7
commit
b50caa4b10
@ -91,14 +91,18 @@ static void handle_fatal_signal(int signum)
|
||||
// case, SA_RESETHAND specifies that the default signal handler--
|
||||
// presumably dump core-- will handle it.
|
||||
char buf[1024];
|
||||
char pthread_name[16] = {0}; //limited by 16B include terminating null byte.
|
||||
int r = pthread_getname_np(pthread_self(), pthread_name, sizeof(pthread_name));
|
||||
#if defined(__sun)
|
||||
char message[SIG2STR_MAX];
|
||||
sig2str(signum,message);
|
||||
snprintf(buf, sizeof(buf), "*** Caught signal (%s) **\n "
|
||||
"in thread %llx\n", message, (unsigned long long)pthread_self());
|
||||
"in thread %llx thread_name:%s\n", message, (unsigned long long)pthread_self(),
|
||||
pthread_name);
|
||||
#else
|
||||
snprintf(buf, sizeof(buf), "*** Caught signal (%s) **\n "
|
||||
"in thread %llx\n", sig_str(signum), (unsigned long long)pthread_self());
|
||||
"in thread %llx thread_name:%s\n", sig_str(signum), (unsigned long long)pthread_self(),
|
||||
pthread_name);
|
||||
#endif
|
||||
dout_emergency(buf);
|
||||
pidfile_remove();
|
||||
|
Loading…
Reference in New Issue
Block a user