File: repl_sem.h

package info (click to toggle)
fis-gtm 7.1-006-1
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 32,908 kB
  • sloc: ansic: 344,906; asm: 5,184; csh: 4,859; sh: 2,000; awk: 294; makefile: 73; sed: 13
file content (78 lines) | stat: -rwxr-xr-x 2,658 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
75
76
77
78
/****************************************************************
 *								*
 * Copyright (c) 2006-2018 Fidelity National Information	*
 * Services, Inc. and/or its subsidiaries. All rights reserved.	*
 *								*
 *	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 REPL_SEM_H_INCLUDED
#define REPL_SEM_H_INCLUDED

#include "repl_sem_sp.h"

#define ASSERT_SET_INDEX	assert (NUM_SEM_SETS > set_index)

enum
{
	SOURCE,
	RECV,
	NUM_SEM_SETS
};

typedef enum
{
	JNL_POOL_ACCESS_SEM,	/* For Startup / Shutdown / Options-change */
	SRC_SERV_COUNT_SEM,	/* Source sever holds it while alive */
	RECV_SERV_STARTUP_SEM,	/* records the # of MUPIP REPLIC -RECEIV -START commands in progress at any point in time */
	DUMMY_SEM1,		/* added just to make the number of semaphores same as in recvpool */
	SOURCE_ID_SEM,
	NUM_SRC_SEMS
} source_sem_type;

/* The need for the options semaphore is documented towards the end of Section 6.2.6 of the design spec for C9F06-002729 */
typedef enum
{
	RECV_POOL_ACCESS_SEM,	/* For Startup / Shutdown */
	RECV_SERV_COUNT_SEM,	/* Receiver sever holds it while alive */
	UPD_PROC_COUNT_SEM,	/* Update process holds it while alive */
	RECV_SERV_OPTIONS_SEM,	/* For options change, since it is done through the shared memory */
	RECV_ID_SEM,
	NUM_RECV_SEMS
} recv_sem_type;

typedef enum
{
	SEM_INFO_VAL,
	SEM_INFO_PID,
	SEM_NUM_INFOS
} sem_info_type;

int		grab_sem(int set_index, int sem_num);	/* set_index can be SOURCE or RECV  */
int		grab_sem_immediate(int set_index, int sem_num);
int		rel_sem(int set_index, int sem_num);
int		rel_sem_immediate(int set_index, int sem_num);
int		get_sem_info(int set_index, int sem_num, sem_info_type info_id);
int		remove_sem_set(int set_index);
boolean_t	sem_set_exists(int which_set);

#ifdef UNIX
void 		rel_recvpool_ftok_sems(boolean_t, boolean_t);
void 		rel_jnlpool_ftok_sems(boolean_t, boolean_t);
void 		lock_recvpool_ftok_sems(boolean_t, boolean_t);
void 		lock_jnlpool_ftok_sems(boolean_t, boolean_t);
void 		get_lock_recvpool_ftok_sems(boolean_t, boolean_t);
void 		get_lock_jnlpool_ftok_sems(boolean_t, boolean_t);
void 		set_sem_set_src(int semid);
void 		set_sem_set_recvr(int semid);
int 		grab_sem_all_source(void);	/* rollback needs this */
int 		grab_sem_all_receive(void);	/* rollback needs this */
int		incr_sem(int set_index, int sem_num);
int		decr_sem(int set_index, int sem_num);
#endif

#endif /* _REPL_SEM_H */