File: cce_start.c

package info (click to toggle)
fis-gtm 6.2-000-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 30,784 kB
  • ctags: 42,554
  • sloc: ansic: 358,483; asm: 4,847; csh: 4,574; sh: 2,261; awk: 200; makefile: 86; sed: 13
file content (75 lines) | stat: -rw-r--r-- 2,156 bytes parent folder | download
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
75
/****************************************************************
 *								*
 *	Copyright 2001, 2009 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 <ssdef.h>
#include <secdef.h>
#include <descrip.h>
#include <prvdef.h>
#include <prcdef.h>
#include <rms.h>
#include "util.h"
#include "cli.h"

void cce_start(void)
{
	int4 status;
	uint4	prvadr[2], prvprv[2];
	static readonly $DESCRIPTOR(proc,"GT.CX_CONTROL");
	static readonly $DESCRIPTOR(image,"GTM$DIST:CCP.EXE");
	static readonly	uic = 65540; /* uic = [1,4] */
	$DESCRIPTOR(ccp,"");
	unsigned char success[] = "GT.CX Cluster controller started with PID =        ";
	uint4 pid;
	uint4 baspri;
	struct FAB ccp_fab;
	struct NAM ccp_nam;
	unsigned char ccp_namebuf[63];	/* max image name allowable for creprc */

	prvadr[1] = 0;
	prvadr[0] = PRV$M_DETACH | PRV$M_OPER | PRV$M_SYSNAM | PRV$M_SYSLCK | PRV$M_TMPMBX;
	status = sys$setprv(TRUE, &prvadr[0], FALSE, &prvprv[0]);
	if (status == SS$_NORMAL)
	{
		baspri = 5;
		cli_get_num("PRIORITY",&baspri);

		ccp_fab = cc$rms_fab;
		ccp_fab.fab$l_fna = image.dsc$a_pointer;
		ccp_fab.fab$b_fns = image.dsc$w_length;
		ccp_fab.fab$l_nam = &ccp_nam;
		ccp_nam = cc$rms_nam;
		ccp_nam.nam$l_esa = ccp_namebuf;
		ccp_nam.nam$b_ess = SIZEOF(ccp_namebuf);
		ccp_nam.nam$b_nop = NAM$M_SYNCHK;
		status = sys$parse (&ccp_fab);
		if (!(status & 1))
		{	lib$signal(status);
			return;
		}
		ccp.dsc$a_pointer = ccp_namebuf;
		ccp.dsc$w_length = ccp_nam.nam$b_esl;

		status = sys$creprc(&pid, &ccp, 0, 0, 0, &prvadr, 0, &proc, baspri, uic, 0, PRC$M_DETACH);
		sys$setprv(FALSE, &prvprv[0], FALSE, 0);
		if (status != SS$_NORMAL)
		{	lib$signal(status);
			return;
		}
		util_out_open(0);
		i2hex(pid, &success[ SIZEOF(success) - 8], 8);
		util_out_write(&success[0], SIZEOF(success));
		util_out_close();
	}
	else
		lib$signal(status);
}