File: gtm_c_stack_trace.h

package info (click to toggle)
fis-gtm 6.3-014-3
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 36,680 kB
  • sloc: ansic: 333,039; asm: 5,180; csh: 4,956; sh: 1,924; awk: 291; makefile: 66; sed: 13
file content (74 lines) | stat: -rw-r--r-- 2,593 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
/****************************************************************
 *								*
 *	Copyright 2009, 2012 Fidelity Information Services, Inc	*
 *								*
 *	This source code contains the intellectual property	*
 *	of its copyright holder(s), and is made available	*
 *	under a license.  If you do not know the terms of	*
 *	the license, please stop and do not read further.	*
 *								*
 ****************************************************************/
#ifndef GTM_C_STACK_TRACE_H
#define GTM_C_STACK_TRACE_H

#define ONCE 1
#define TWICE 2

#ifdef VMS
#define GET_C_STACK_MULTIPLE_PIDS(MESSAGE, CNL_PID_ARRAY, MAX_PID_SLOTS, STUCK_CNT)
#define GET_C_STACK_FROM_SCRIPT(MESSAGE, WAITINGPID, BLOCKINGPID, COUNT)
#define GET_C_STACK_FOR_KIP(KIP_PIDS_ARR_PTR, TRYNUM, MAX_TRY, STUCK_CNT, MAX_PID_SLOTS)
#elif defined(UNIX)

void gtm_c_stack_trace(char *message, pid_t waiting_pid, pid_t blocking_pid, uint4 count);

#define GET_C_STACK_MULTIPLE_PIDS(MESSAGE, CNL_PID_ARRAY, MAX_PID_SLOTS, STUCK_CNT)				\
{														\
	uint4		index;											\
	pid_t		pid;											\
	GBLREF uint4	process_id;										\
														\
	for (index = 0; MAX_PID_SLOTS > index; index++)								\
	{													\
		pid = CNL_PID_ARRAY[index];									\
		if (0 != pid)											\
			GET_C_STACK_FROM_SCRIPT(MESSAGE, process_id, pid, STUCK_CNT);				\
	}													\
}

#define GET_C_STACK_FROM_SCRIPT(MESSAGE, WAITINGPID, BLOCKINGPID, COUNT)					\
{														\
	gtm_c_stack_trace(MESSAGE, WAITINGPID, BLOCKINGPID, COUNT);						\
}

#define GET_C_STACK_FOR_KIP(KIP_PIDS_ARR_PTR, TRYNUM, MAX_TRY, STUCK_CNT, MAX_PID_SLOTS)			\
{														\
	boolean_t	invoke_c_stack = FALSE;									\
	char		*kip_wait_string = NULL;								\
														\
	DEBUG_ONLY(												\
		/* If we had waited for half the max time, get a C stack trace on the processes currently 	\
		 * doing the kill 										\
		 */												\
		if ((MAX_TRY / 2) == TRYNUM)									\
		{												\
			invoke_c_stack = TRUE;									\
			kip_wait_string = "KILL_IN_PROG_HALFWAIT";						\
		}												\
	)													\
	/* If we had waited for max time, get a C stack trace on the processes currently doing the kill		\
	 * irrespective of whether it's pro or dbg 								\
	 */													\
	if (MAX_TRY <= TRYNUM)											\
	{													\
		invoke_c_stack = TRUE;										\
		kip_wait_string = "KILL_IN_PROG_WAIT";								\
	}													\
	if (invoke_c_stack)											\
		GET_C_STACK_MULTIPLE_PIDS(kip_wait_string, KIP_PIDS_ARR_PTR, MAX_PID_SLOTS, STUCK_CNT);		\
}

#else
#error UNSUPPORTED PLATFORM
#endif
#endif