Skip to content

Commit

Permalink
CA-404658: Print thread ID at startup
Browse files Browse the repository at this point in the history
Print all threads' ID in the xha.log at startup.

Signed-off-by: Bengang Yuan <[email protected]>
  • Loading branch information
BengangY committed Feb 18, 2025
1 parent c5682d4 commit be67a8c
Show file tree
Hide file tree
Showing 8 changed files with 18 additions and 0 deletions.
2 changes: 2 additions & 0 deletions daemon/bond_mon.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
#include <limits.h>
#include <pthread.h>
#include <signal.h>
#include <sys/syscall.h>


//
Expand Down Expand Up @@ -374,6 +375,7 @@ bm(
static MTC_BOND_STATUS bond_status = BOND_STATUS_NOERR;
PCOM_DATA_BM pbm;

log_message(MTC_LOG_INFO, "BM: thread ID: %ld.\n", syscall(SYS_gettid));
do
{
log_maskable_debug_message(TRACE, "BM: bonding monitor thread activity log.\n");
Expand Down
3 changes: 3 additions & 0 deletions daemon/heartbeat.c
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
#include <string.h>
#include <unistd.h>
#include <stdio.h>
#include <sys/syscall.h>


//
Expand Down Expand Up @@ -761,6 +762,7 @@ hb_receive(
MTC_BOOLEAN term = FALSE;
MTC_CLOCK last, now;

log_message(MTC_LOG_INFO, "HB_receive: thread ID: %ld.\n", syscall(SYS_gettid));
now = last = _getms();
do
{
Expand Down Expand Up @@ -855,6 +857,7 @@ hb_send(
MTC_BOOLEAN term = FALSE;
MTC_CLOCK last, now, wait;

log_message(MTC_LOG_INFO, "HB_send: thread ID: %ld.\n", syscall(SYS_gettid));
do
{
// check fist
Expand Down
2 changes: 2 additions & 0 deletions daemon/lock_mgr.c
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@
#include <pthread.h>
#include <signal.h>
#include <string.h>
#include <sys/syscall.h>


//
Expand Down Expand Up @@ -592,6 +593,7 @@ lock_mgr(
PCOM_DATA_SF psf;
MTC_S32 index;

log_message(MTC_LOG_INFO, "LM: thread ID: %ld.\n", syscall(SYS_gettid));
while (TRUE)
{
// wait until state-file is updated or request status is changed
Expand Down
2 changes: 2 additions & 0 deletions daemon/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@
#include <pthread.h>
#include <sched.h>
#include <sys/mman.h>
#include <sys/syscall.h>

#include "log.h"
#include "mtcerrno.h"
Expand Down Expand Up @@ -720,6 +721,7 @@ MTC_STATIC void *
main_sighandler(
void *ignore)
{
log_message(MTC_LOG_INFO, "Main_sighandler: thread ID: %ld.\n", syscall(SYS_gettid));
while (!daemon_vars.terminate_requested)
{
main_sleep (MAIN_SIGHANDLER_INTERVAL);
Expand Down
2 changes: 2 additions & 0 deletions daemon/sc_sv.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
#include <pthread.h>
#include <signal.h>
#include <assert.h>
#include <sys/syscall.h>



Expand Down Expand Up @@ -305,6 +306,7 @@ script_service_thread(
service_func_num = ((SCRIPT_SERVICE_THREAD_PARAM *) param)->funcnum;
service_func = ((SCRIPT_SERVICE_THREAD_PARAM *) param)->func;

log_message(MTC_LOG_INFO, "SC: thread ID: %ld.\n", syscall(SYS_gettid));
do
{
fd_set fds;
Expand Down
3 changes: 3 additions & 0 deletions daemon/sm.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
#include <signal.h>
#include <unistd.h>
#include <stdlib.h>
#include <sys/syscall.h>



Expand Down Expand Up @@ -715,6 +716,7 @@ sm(
MTC_STATUS status;
MTC_U32 weight;

log_message(MTC_LOG_INFO, "SM: thread ID: %ld.\n", syscall(SYS_gettid));
// commit initial weight
weight = commit_weight();
log_message(MTC_LOG_INFO, "Initial weight = %d.\n", weight);
Expand Down Expand Up @@ -1654,6 +1656,7 @@ MTC_STATIC void *
sm_worker(
void *ignore)
{
log_message(MTC_LOG_INFO, "SM_Worker: thread ID: %ld.\n", syscall(SYS_gettid));
while (!smvar.terminate)
{
mssleep(SM_WORKER_INTERVAL);
Expand Down
2 changes: 2 additions & 0 deletions daemon/statefile.c
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
#include <sys/stat.h>
#include <fcntl.h>
#include <stdlib.h>
#include <sys/syscall.h>

//
//
Expand Down Expand Up @@ -502,6 +503,7 @@ sfthread(
#define PSTATUS_SUCCESS 1
#define PSTATUS_ERROR 2

log_message(MTC_LOG_INFO, "SF: thread ID: %ld.\n", syscall(SYS_gettid));
int print_status = PSTATUS_NONE;

last = _getms();
Expand Down
2 changes: 2 additions & 0 deletions daemon/xapi_mon.c
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <sys/syscall.h>


//
Expand Down Expand Up @@ -300,6 +301,7 @@ xapimon(
PMTC_S8 perr_string = err_string;
MTC_STATUS status;

log_message(MTC_LOG_INFO, "Xapimon: thread ID: %ld.\n", syscall(SYS_gettid));
while (!terminate)
{
log_maskable_debug_message(TRACE, "Xapimon: Xapi monitor thread activity log.\n");
Expand Down

0 comments on commit be67a8c

Please sign in to comment.