~ubuntu-branches/ubuntu/jaunty/pvm/jaunty

1 by Drake Diedrich
Import upstream version 3.4.2
1
static char rcsid[] =
2
	"$Id: lpvmglob.c,v 1.19 2004/01/14 18:50:57 pvmsrc Exp $";
1.1.1 by Steinar H. Gunderson
Import upstream version 3.4.5
3
1 by Drake Diedrich
Import upstream version 3.4.2
4
/*
5
 *         PVM version 3.4:  Parallel Virtual Machine System
6
 *               University of Tennessee, Knoxville TN.
7
 *           Oak Ridge National Laboratory, Oak Ridge TN.
8
 *                   Emory University, Atlanta GA.
9
 *      Authors:  J. J. Dongarra, G. E. Fagg, M. Fischer
10
 *          G. A. Geist, J. A. Kohl, R. J. Manchek, P. Mucci,
11
 *         P. M. Papadopoulos, S. L. Scott, and V. S. Sunderam
12
 *                   (C) 1997 All Rights Reserved
13
 *
14
 *                              NOTICE
15
 *
16
 * Permission to use, copy, modify, and distribute this software and
17
 * its documentation for any purpose and without fee is hereby granted
18
 * provided that the above copyright notice appear in all copies and
19
 * that both the copyright notice and this permission notice appear in
20
 * supporting documentation.
21
 *
22
 * Neither the Institutions (Emory University, Oak Ridge National
23
 * Laboratory, and University of Tennessee) nor the Authors make any
24
 * representations about the suitability of this software for any
25
 * purpose.  This software is provided ``as is'' without express or
26
 * implied warranty.
27
 *
28
 * PVM version 3 was funded in part by the U.S. Department of Energy,
29
 * the National Science Foundation and the State of Tennessee.
30
 */
31
32
/*
33
 *	lpvmglob.c
34
 *
35
 *	Libpvm Globals.
36
 *
37
 * $Log: lpvmglob.c,v $
38
 * Revision 1.19  2004/01/14 18:50:57  pvmsrc
1.1.1 by Steinar H. Gunderson
Import upstream version 3.4.5
39
 * Added new AIX5* arches.
40
 * (Spanker=kohl)
41
 *
42
 * Revision 1.18  2001/02/07 23:14:08  pvmsrc
43
 * First Half of CYGWIN Check-ins...
44
 * (Spanker=kohl)
45
 *
46
 * Revision 1.17  2000/06/15 17:51:52  pvmsrc
47
 * Fixed bug in WIN32 direct routing.
48
 * 	- stupid #endif in the wrong place, pvm_fd_add() call whacked.
49
 * 	- turned back on direct routing default and setopt.
50
 * (Spanker=kohl)
51
 *
52
 * Revision 1.16  2000/02/17 23:12:15  pvmsrc
53
 * *** Changes for new BEOLIN port ***
54
 * 	- MPP-like, similar to SP2, etc.
55
 * 	- submitted by Paul Springer <pls@smokeymt.jpl.nasa.gov>.
56
 * 	- format-checked & cleaned up by Jeembo...  :-)
57
 * (Spanker=kohl)
58
 *
59
 * Revision 1.15  2000/02/16 22:01:00  pvmsrc
60
 * Added #ifndef NO_NETINET_TCP_H around <netinet/tcp.h> for
61
 * 	archs that can't handle it...  :-)
62
 * (Spanker=kohl)
63
 *
64
 * Revision 1.14  1999/07/08 18:59:59  kohl
1 by Drake Diedrich
Import upstream version 3.4.2
65
 * Fixed "Log" keyword placement.
66
 * 	- indent with " * " for new CVS.
67
 *
68
 * Revision 1.13  1999/03/12  20:55:37  pvmsrc
69
 * Don't allow direct routing in WIN32 until we fix it.  Shit.
70
 * (Spanker=kohl)
71
 *
72
 * Revision 1.12  1998/11/20  20:04:07  pvmsrc
73
 * Changes so that win32 will compile & build. Also, common
74
 * Changes so that compiles & builds on NT. Also
75
 * common source on win32 & unix.
76
 * (Spanker=sscott)
77
 *
78
 * Revision 1.11  1997/09/22  21:13:32  pvmsrc
79
 * Added new pvmsettaskname() linkage (for shell-spawned tasks only!).
80
 * 	- call pvmsettaskname() before joining PVM, sends task name
81
 * 		(stored in new char *pvmmytaskname global) to pvmd in
82
 * 		TM_CONN2 message.
83
 * 	- appears in trace events and console ps.
84
 * (Spanker=kohl)
85
 *
86
 * Revision 1.10  1997/08/06  22:43:18  pvmsrc
87
 * Added new SGI6 and SGIMP6 arches.
88
 *
89
 * Revision 1.9  1997/06/27  19:53:56  pvmsrc
90
 * Fixed polltype/polltime bug in AIX4MP.
91
 *
92
 * Revision 1.8  1997/06/27  17:32:25  pvmsrc
93
 * Updated for WIN32 header files & Authors.
94
 *
95
 * Revision 1.7  1997/05/29  15:13:06  pvmsrc
96
 * Moved decl (init) of pvmrouteopt inside MPP/SHMEM vs. "normal" defines.
97
 * 	- for MPP/SHMEM -> PvmDontRoute, "normal" -> PvmAllowDirect.
98
 *
99
 * Revision 1.6  1997/05/21  16:01:52  pvmsrc
100
 * Updated ifdefs to include AIX4MP arch type.
101
 *
102
 * Revision 1.5  1997/03/06  21:08:28  pvmsrc
103
 * 		Added includes:
104
 * 		<netinet/in.h>, <netinet/tcp.h> "host.h" "pvmmimd.h"
105
 *
106
 * Revision 1.4  1997/02/13  23:35:54  pvmsrc
107
 * Added new PvmNoReset setopt/getopt option.
108
 * 	- added new pvmnoreset, pvmnoresetindex globals in lpvm.[ch].
109
 * 	- to set use pvm_putinfo() -> PVMNORESETCLASS first avail w/lock,
110
 * 		save index in pvmnoresetindex.
111
 * 	- to unset use pvm_delinfo().
112
 *
113
 * Revision 1.3  1997/01/28  19:26:28  pvmsrc
114
 * New Copyright Notice & Authors.
115
 *
116
 * Revision 1.2  1996/12/18  22:28:55  pvmsrc
117
 * Added new FILE *logfp decl.
118
 * 	- only #ifdef LOG.  (previously only in shmem stuff)
119
 * 	- needed for now shared pvmlogerror() routine.
120
 *
121
 * Revision 1.1  1996/10/24  19:43:39  pvmsrc
122
 * Initial revision
123
 *
124
 *
125
 */
126
127
128
#include <stdio.h>
129
#include <pvm3.h>
130
1.1.1 by Steinar H. Gunderson
Import upstream version 3.4.5
131
#if defined(WIN32) || defined(CYGWIN)
132
#include "..\xdr\types.h"
1 by Drake Diedrich
Import upstream version 3.4.2
133
#include "..\xdr\xdr.h"
134
#else
135
#include <rpc/types.h>
136
#include <rpc/xdr.h>
137
#endif
1.1.1 by Steinar H. Gunderson
Import upstream version 3.4.5
138
139
#ifndef WIN32
140
#include <netinet/in.h>
1 by Drake Diedrich
Import upstream version 3.4.2
141
#ifndef NO_NETINET_TCP_H
1.1.1 by Steinar H. Gunderson
Import upstream version 3.4.5
142
#include <netinet/tcp.h>
1 by Drake Diedrich
Import upstream version 3.4.2
143
#endif
144
#endif
1.1.1 by Steinar H. Gunderson
Import upstream version 3.4.5
145
1 by Drake Diedrich
Import upstream version 3.4.2
146
#include "pmsg.h"
147
#include <pvmtev.h>
148
#include "tevmac.h"
149
#include "host.h"
150
#include "waitc.h"
151
#include "global.h"
152
153
154
155
/***************
156
 **  Globals  **
157
 **           **
158
 ***************/
159
160
int pvmautoerr = 1;						/* whether auto print err msg */
161
162
struct Pvmtracer pvmctrc =				/* child tracer info */
163
	{ 0, 0, 0, 0, 0, 0, 0, 0, "" };
164
165
struct Pvmtracer pvmtrc =				/* task tracer info */
166
	{ 0, 0, 0, 0, 0, 0, 0, 0, "" };
167
168
int pvmmyptid = -1;						/* parent task id */
169
int pvmmytid = -1;						/* this task id */
170
int pvmmyupid = -1;						/* process unix pid */
171
int pvm_useruid = -1;					/* user's unix uid */
172
int pvmmydsig = 0;						/* native data enc, init XDR */
173
int pvmschedtid = 0;					/* scheduler task */
174
int pvmrescode = 0;						/* allow reserved tids, tags */
175
int pvmshowtaskid = 1;					/* catchout shows task ids */
176
int pvmtoplvl = 1;						/* funct called outside lib */
177
int pvmdebmask = 0;						/* which debugging info */
178
int pvmnoreset = 0;						/* task reset override */
179
int pvmnoresetindex = -1;				/* task reset overrd mb index */
180
181
char *pvmmytaskname = (char *) NULL;	/* task name */
182
183
#if defined(IMA_CM5) || defined(IMA_CUBE) || defined(IMA_I860) \
184
  || defined(IMA_PGON) || defined(IMA_SP2MPI) || defined(IMA_ALPHAMP) \
185
  || defined(IMA_CSPP) || defined(IMA_HPPAMP) || defined(IMA_RS6KMP) \
186
  || defined(IMA_SGIMP) || defined(IMA_SGIMP6) || defined(IMA_SGIMP64) \
187
  || defined(IMA_SUNMP) || defined(IMA_AIX4MP) || defined(IMA_AIX5MP) \
1.1.1 by Steinar H. Gunderson
Import upstream version 3.4.5
188
  || defined(AIX4SP2) || defined(IMA_AIX5SP2) || defined(IMA_BEOLIN)
189
#include "pvmmimd.h"
1 by Drake Diedrich
Import upstream version 3.4.2
190
int pvmrouteopt = PvmDontRoute;			/* task-task routing style */
191
int pvmfrgsiz = MAXFRAGSIZE;			/* msg frag length (to pack) */
192
int pvmudpmtu = MAXFRAGSIZE;			/* local UDP MTU */
193
#else
194
int pvmrouteopt = PvmAllowDirect;		/* task-task routing style */
195
int pvmfrgsiz = UDPMAXLEN;				/* msg frag length (to pack) */
196
int pvmudpmtu = UDPMAXLEN;				/* local UDP MTU */
197
#endif
198
199
int pvmmyctx = 0;						/* current message context */
200
int pvmnsibs = -1;						/* number in our spawn group */
201
int *pvmsibtids = 0;					/* tids in our spawn group */
202
203
struct pmsg *pvmrxlist = 0;				/* not-recvd msg list */
204
205
struct pmsg *pvmrbuf = 0;				/* current recv/unpack msg */
206
struct pmsg *pvmsbuf = 0;				/* current send/pack msg */
207
208
209
#if defined(IMA_ALPHAMP) || defined(IMA_CSPP) || defined(IMA_HPPAMP) \
210
	|| defined(IMA_RS6KMP) || defined(IMA_SGIMP) \
1.1.1 by Steinar H. Gunderson
Import upstream version 3.4.5
211
	|| defined(IMA_SGIMP6) || defined(IMA_SGIMP64) \
212
	|| defined(IMA_AIX4MP) || defined(IMA_AIX5MP) \
213
	|| defined(IMA_SUNMP)
214
int pvmpolltype = PvmPollSleep;			/* memory polling style */
1 by Drake Diedrich
Import upstream version 3.4.2
215
int pvmpolltime = BUSYWAIT;				/* time value for poll wait */
216
#endif
217
218
219
#ifdef LOG
220
FILE *logfp = 0;						/* my own log file */
221
#endif
222
223
224
/* General Trace Globals */
225
226
struct pvmtrcencvec *pvmtrccodef;		/* trace packing vector */
227
228
struct timeval pvmtrcztv = { 0, 0 };	/* trace zero time value */
229
230
struct pmsg *pvmtrcmp;					/* trace record buffer mesg */
231
232
int pvmtrcsbfsave = 0;					/* trace save send buffer */
233
int pvmtrcsbf = 0;						/* trace record buffer */
234
235
int pvmtrcdesc;							/* trace descriptor status */
236
int pvmtrctmp;							/* trace temporary storage */
237
238
int pvmtrcsavekind;						/* trace event kind for fin */
239
240