File: continue_handler.c

package info (click to toggle)
fis-gtm 6.3-007-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 36,284 kB
  • sloc: ansic: 328,861; asm: 5,182; csh: 5,102; sh: 1,918; awk: 291; makefile: 69; sed: 13
file content (66 lines) | stat: -rwxr-xr-x 2,252 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
/****************************************************************
 *								*
 *	Copyright 2001, 2013 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.	*
 *								*
 ****************************************************************/

#include <mdef.h>

#include <signal.h>
#ifdef GTM_PTHREAD
#  include <pthread.h>
#endif
#include "gtm_syslog.h"
#include "gtm_limits.h"

#include "gtmsiginfo.h"
#include "io.h"
#include "send_msg.h"
#include "setterm.h"
#include "continue_handler.h"
#include "gtmsecshr.h"

GBLREF volatile int	suspend_status;
GBLREF io_pair		io_std_device;
GBLREF uint4		process_id;

error_def(ERR_REQ2RESUME);

void continue_handler(int sig, siginfo_t *info, void *context)
{
	gtmsiginfo_t	sig_info;
	DCL_THREADGBL_ACCESS;

	SETUP_THREADGBL_ACCESS;
	FORWARD_SIG_TO_MAIN_THREAD_IF_NEEDED(sig);
	/* Count how many times we get a continue-process signal (in DEBUG) */
	DEBUG_ONLY(DBGGSSHR((LOGFLAGS, "continue_handler: pid %d, continue_proc_cnt bumped from %d to %d\n",
			     process_id, TREF(continue_proc_cnt), TREF(continue_proc_cnt) + 1)));
	DEBUG_ONLY((TREF(continue_proc_cnt))++);
 	assert(SIGCONT == sig);
	extract_signal_info(sig, info, context, &sig_info);
	switch(suspend_status)
	{
		case NOW_SUSPEND:
			/* Don't bother checking if user info is available. If info isn't available,
			 * the value zero will be printed for pid and uid. Note that the following
			 * message was previously put out even when the process was not suspended but
			 * with the changes in spin locks that send continue messages "just in case",
			 * I thought it better to restrict this message to when the process was actually
			 * suspended and being continued. SE 7/01
			 */
			send_msg(VARLSTCNT(4) ERR_REQ2RESUME, 2, sig_info.send_pid, sig_info.send_uid);
			if (NULL != io_std_device.in && tt == io_std_device.in->type)
				setterm(io_std_device.in);
			/* Fall through */
		case DEFER_SUSPEND:
			/* If suspend was deferred, this continue/resume overrides/cancels it */
			suspend_status = NO_SUSPEND;
			break;
	}
}