summaryrefslogtreecommitdiff
path: root/src/tet3/apilib/tdiscon.c
blob: 975c428732607924a7b458a54202337b306c53c3 (plain)
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
79
80
/*
 *      SCCS:  @(#)tdiscon.c	1.7 (98/08/28) 
 *
 * (C) Copyright 1994 UniSoft Ltd., London, England
 *
 * All rights reserved.  No part of this source code may be reproduced,
 * stored in a retrieval system, or transmitted, in any form or by any
 * means, electronic, mechanical, photocopying, recording or otherwise,
 * except as stated in the end-user licence agreement, without the prior
 * permission of the copyright owners.
 */

#ifdef HAVE_CONFIG_H
#include <config.h>
#endif

/************************************************************************

SCCS:   	@(#)tdiscon.c	1.7 98/08/28 TETware release 3.3
NAME:		tdiscon.c
PRODUCT:	TETware
AUTHOR:		Andrew Dingwall, UniSoft Ltd.
DATE CREATED:	December 1993

DESCRIPTION:
	tet_disconnect() must be called in a child process after a fork()
	If this is not done, chaos will break out if the parent and child
	perform overlapping server requests.

MODIFICATIONS:
	Geoff Clare, UniSoft Ltd., Sept 1996
	Changes for TETWare-Lite.

	Andrew Dingwall, UniSoft Ltd., July 1998
	Added support for shared API libraries.
 
************************************************************************/

#ifndef TET_LITE /* -START-LITE-CUT- */

#include "dtmac.h"
#include "tet_api.h"
#include "dtmsg.h"
#include "ptab.h"
#include "tslib.h"
#include "apilib.h"


/*
**	tet_disconnect() - disconnect from all servers without first
**		logging off
**
**	this function should be called in a child TCM process after a fork()
**
**	the ptab information is retained and the server is unaware that
**	the calling process has called this function (because the server
**	doesn't tell the difference between parent and child)
*/

void tet_disconnect()
{
	register struct ptab *pp;
	extern struct ptab *tet_ptab;

	/* disconnect from TCCDs */
	for (pp = tet_ptab; pp; pp = pp->pt_next)
		tet_ts_disconnect(pp);

	/* disconnect from sync and xresd */
	tet_ts_disconnect(tet_sdptab);
	tet_ts_disconnect(tet_xdptab);
}

#else /* -END-LITE-CUT- */

/* avoid "empty" file */
int tet_tdiscon_not_needed;

#endif /* -LITE-CUT-LINE- */