]>
Commit | Line | Data |
---|---|---|
5f71eac1 | 1 | static char def_rcsid[]="$Id$"; |
2 | ||
3 | /*---------------------------------------------------- | |
4 | * def.h Tom Green Mon Jan 31 10:44:27 1994 | |
5 | * | |
6 | * Copyright 1993 | |
7 | * | |
8 | * SUPER COMPUTER COMPUTATIONS RESEARCH INSTITUTE | |
9 | * FLORIDA STATE UNIVERSITY | |
10 | * | |
11 | * | |
12 | * SCRI representatives make no claims about the | |
13 | * suitability of this software for any purpose. | |
14 | * It is provided "as is" without express or | |
15 | * implied warranty. | |
16 | * | |
17 | * $Log$ | |
f0656be4 | 18 | * Revision 1.1 2001/03/19 20:45:31 dobrek |
19 | * -3f2839b879f378e29cfee71b2738b8ec DQS-3.3.1.tgz | |
20 | * -And related stuff | |
21 | * | |
5f71eac1 | 22 | * Revision 1.8 2000/03/09 03:56:07 chuck |
23 | * Modified FLOCK macro for lockf on System 5 hosts and flock on | |
24 | * BSD hosts. FLOCK now only locks. New macro FUNLOCK is now used | |
25 | * to unlock. | |
26 | * | |
27 | * Revision 1.7 2000/03/09 03:51:22 chuck | |
28 | * Fixed a memory leak in the UNPACKSTR macro. | |
29 | * An input argument was overwritten without first releasing | |
30 | * the memory it pointed to. | |
31 | * | |
32 | * Revision 1.6 1999/04/30 16:46:26 green | |
33 | * reworked file locking in dqs_log.c to use MACRO FLOCK defined in def.h | |
34 | * so that AIX doesn't have to include -lbsd | |
35 | * | |
36 | * Revision 1.5 1999/04/30 14:50:52 green | |
37 | * support for changing from hex to base10 for queue configurations | |
38 | * | |
39 | * Revision 1.4 1998/10/26 19:24:09 green | |
40 | * use the DQS_EXIT macro to determine exit value of ancillaries | |
41 | * | |
42 | * Revision 1.3 1998/10/21 14:42:52 green | |
43 | * Red Hat Alpha Port - ADDRLEN incorporated | |
44 | * SETPGRP/GETPGRP macros redefined | |
45 | * | |
46 | * Revision 1.2 1998/10/13 15:08:48 green | |
47 | * Solaris 2.6 support - hopefully, as I don't have access to one... | |
48 | * | |
49 | * Revision 1.1.1.1 1998/08/18 14:39:10 green | |
50 | * DQS 3.2.0.5 WIP Import | |
51 | * | |
52 | * Revision 1.5 1997/10/21 15:51:19 decker | |
53 | * Expanded MAX_STRING_SIZE and TOKEN_SIZE to 2048 | |
54 | * | |
55 | * Revision 1.4 1997/09/04 16:39:05 decker | |
56 | * Ron Lee's Patch for VALID,SETBIT,CLEARBIT added | |
57 | * | |
58 | * Revision 1.3 1997/08/08 15:17:14 decker | |
59 | * Added David Geldreich Patch: | |
60 | * | |
61 | * Revision 1.2 1997/04/10 21:51:49 green | |
62 | * added def for rindex | |
63 | * | |
64 | * Revision 1.1.1.1 1997/04/10 15:10:31 green | |
65 | * DQS 3.1.3.4.1 Distribution | |
66 | * | |
67 | * Revision 3.60 1996/08/26 14:20:45 nrl | |
68 | * Incorporated SCRI scheduling changes | |
69 | * | |
70 | * Revision 3.59 1996/08/16 17:44:42 nrl | |
71 | * Added SETEUID macro to def.h to provide differentiation | |
72 | * for HP from the rest of the pack. | |
73 | * | |
74 | * Revision 3.58 1996/07/09 19:53:12 nrl | |
75 | * Added SOLARIS2.5 parameters | |
76 | * | |
77 | * Revision 3.57 1996/06/27 01:55:37 nrl | |
78 | * changes to accomodate osf gcc | |
79 | * | |
80 | * Revision 3.55 1996/06/26 19:08:44 nrl | |
81 | * set JOBS_SCANNED_PER_PASS to very large number to force | |
82 | * a relook at the entire queue each time. | |
83 | * | |
84 | * Revision 3.54 1996/06/26 14:03:19 nrl | |
85 | * Added pvmcleanup.sh to install.. added osf2.3 detection | |
86 | * | |
87 | * Revision 3.53 1996/06/17 02:28:36 nrl | |
88 | * Updtaes from Guntram Wolski, Ron Lee, John Makosky and | |
89 | * Bodo Beckebach | |
90 | * | |
91 | * Revision 3.52 1996/04/01 21:35:38 nrl | |
92 | * removed absolte path from DEBUG313,txt file name | |
93 | * | |
94 | * Revision 3.51 1996/03/25 16:28:26 nrl | |
95 | * Repaired parameter scanning for qidle | |
96 | * | |
97 | * Revision 3.50 1996/03/21 17:06:37 nrl | |
98 | * added fortran and "c" syntax to resource requests | |
99 | * | |
100 | * Revision 3.49 1996/03/19 23:27:01 nrl | |
101 | * added capability to clean up consumable resources whenthey | |
102 | * get out of sync with reality | |
103 | * | |
104 | * Revision 3.48 1996/03/17 00:57:28 nrl | |
105 | * merge in qsub prevalidation scheme and consumable restoration | |
106 | * | |
107 | * Revision 3.47 1996/03/14 03:15:57 nrl | |
108 | * merge in subordinate queues and consumable resource changes | |
109 | * | |
110 | * Revision 3.46 1996/03/12 17:11:45 nrl | |
111 | * removed aborts and replaced with an error messaging scheme | |
112 | * to send email to the dqs adminsitrator and wait for | |
113 | * actions by that administrator | |
114 | * | |
115 | * Revision 3.45 1996/02/07 13:07:37 nrl | |
116 | * Added "process leader" and TMP_FILES link capability | |
117 | * | |
118 | * Revision 3.44 1996/01/19 20:58:36 nrl | |
119 | * merged SCRI code and new job and queue structure changes | |
120 | * | |
121 | * Revision 3.43 1995/10/23 18:51:37 nrl | |
122 | * Added fix for setpgrp (once more) for Solaris 2.4, recommended by | |
123 | * Ron Lee | |
124 | * | |
125 | * Revision 3.42 1995/07/13 20:51:06 nrl | |
126 | * This is the contribution of that almost anonymous fellow | |
127 | * Ron lee from a company which does not its name mentioned.. | |
128 | * which finally!! (we hope) solves ALL the Solaris 2.4 problems. | |
129 | * | |
130 | * Revision 3.41 1995/07/12 18:47:48 nrl | |
131 | * Fixed numerous problmes with Irix 5.3 and 6.0 systems | |
132 | * | |
133 | * Revision 3.40 1995/06/22 19:31:07 nrl | |
134 | * Added kludgie "subpriority" field to differentiate jobs from the | |
135 | * same user. Also fixed MAXUJOBS and added "MAXU" warning to | |
136 | * the "qstat" command. | |
137 | * | |
138 | * Revision 3.39 1995/06/21 16:57:28 nrl | |
139 | * Major scheduling changes... added a subpriority field to manage | |
140 | * things within the user submitted priority. Added priority info to the | |
141 | * accounting file. | |
142 | * | |
143 | * Revision 3.38 1995/06/15 17:20:51 nrl | |
144 | * Mike Iglesias solved the setpriority problem on OSF platforms | |
145 | * | |
146 | * Revision 3.37 1995/06/15 14:20:54 nrl | |
147 | * changed SETPGRP for OSF systems to use setpgid | |
148 | * | |
149 | * Revision 3.36 1995/06/13 12:06:11 nrl | |
150 | * Updated count of variables for fscanf testing | |
151 | * | |
152 | * Revision 3.35 1995/05/29 18:08:44 nrl | |
153 | * More solaris stuff GAGGHH had to differentiate more cases of | |
154 | * solaris2.3 and solaris2.4 stuff | |
155 | * | |
156 | * Revision 3.34 1995/05/28 16:44:35 nrl | |
157 | * Fixes for solaris2.3 and solaris 2.4 and mailer default recipients | |
158 | * | |
159 | * Revision 3.33 1995/05/14 18:28:46 nrl | |
160 | * Plugged one hole in dqs_execd and qmaster handhsaking... | |
161 | * added gethostbyname calls to overcome problems with some | |
162 | * systems | |
163 | * | |
164 | * Revision 3.32 1995/03/05 03:46:56 nrl | |
165 | * Included Axel Brandes job scheduling mechanism to keep one | |
166 | * user from hawging the queue. | |
167 | * | |
168 | * Revision 3.31 1995/02/22 14:29:13 nrl | |
169 | * added "FREE" macro to make sure all freed pointers are NULL, | |
170 | * replaced all calls to free( ) with FREE. | |
171 | * | |
172 | * Revision 3.30 1995/02/20 01:02:59 nrl | |
173 | * corrected SUN changes for bcmp,bcopy and bzero | |
174 | * | |
175 | * Revision 3.29 1995/02/19 22:37:48 nrl | |
176 | * Simplified pvm and tcgmsg interface to a minimalist scheme requiring | |
177 | * user scripts to start the daemons | |
178 | * | |
179 | * Revision 3.28 1995/02/17 02:56:51 nrl | |
180 | * Added formal skeletons for PVM and TCGMSG parallel modes | |
181 | * | |
182 | * Revision 3.27 1995/02/09 12:48:57 nrl | |
183 | * Added "delete complex" and "modify complex" | |
184 | * | |
185 | * Revision 3.26 1995/02/06 16:31:48 nrl | |
186 | * Added "account" info to rusage structure and to the "acc_file" | |
187 | * for analysis by user. | |
188 | * | |
189 | * Revision 3.25 1995/01/17 16:31:57 nrl | |
190 | * completed mailer feature | |
191 | * | |
192 | * Revision 3.24 1994/11/14 13:56:36 green | |
193 | * fixed hpux "nice" | |
194 | * 536c536 | |
195 | * < #define SETPRIORITY(niceval) nice(GETPGRP,niceval) | |
196 | * --- | |
197 | * > #define SETPRIORITY(niceval) nice(niceval) | |
198 | * -------------------------------------------------------------------- | |
199 | * | |
200 | * Revision 3.23 1994/08/02 23:11:05 green | |
201 | * added support for a crude job staging mechanism | |
202 | * | |
203 | * Revision 3.22 1994/07/05 14:22:27 green | |
204 | * added James MacKinnon's NeXT ports | |
205 | * | |
206 | * Revision 3.21 1994/06/12 23:18:00 green | |
207 | * yanked NCARGS | |
208 | * | |
209 | * Revision 3.20 1994/06/12 21:04:56 green | |
210 | * expanded DQS_MAXNAMELEN to MAX_STRING_SIZE in def.h | |
211 | * | |
212 | * utilize DQS_MAXNAMELEN for command size in dqs_dshd.c | |
213 | * | |
214 | * Revision 3.19 1994/06/09 18:38:20 green | |
215 | * had some problems with nonre-entrant gethostbyX in dqs_sec.c - fixed | |
216 | * | |
217 | * #def overload for "GENERIC" in def.h - fixed | |
218 | * | |
219 | * Revision 3.18 1994/06/09 14:25:04 green | |
220 | * yanked PVM after further digging through the PVM code decided there | |
221 | * might be potential problems(let somebody else worry with pvm if they | |
222 | * want it...) | |
223 | * | |
224 | * pulled out some sloaris #defs - maybe one day SUN will ship me my | |
225 | * compiler | |
226 | * | |
227 | * Revision 3.17 1994/06/08 17:48:00 green | |
228 | * added P4 support(with the help of Ralph Butler - Thanks Ralph!) | |
229 | * | |
230 | * backed down to Rev. 3.3 of dqs_check_to_do_list.c | |
231 | * | |
232 | * Revision 3.16 1994/06/07 16:45:37 green | |
233 | * more "sloaris" porting... | |
234 | * | |
235 | * Revision 3.15 1994/06/07 12:37:55 green | |
236 | * moved some format descriptors out of dqs_ck_to_do_list.c and | |
237 | * dqs_job_exeit.c and into def.h | |
238 | * | |
239 | * added dqs_read_stats() to dqs_ck_to_do_list.c | |
240 | * | |
241 | * Revision 3.14 1994/06/06 01:23:01 green | |
242 | * added "dqs_dshd_service" to the DQS config | |
243 | * | |
244 | * add "-par pvm" - though we do NOT intend to support it | |
245 | * (see dqs_start_pvm.c for a more thorough discussion) | |
246 | * | |
247 | * Revision 3.13 1994/06/04 15:24:28 green | |
248 | * added "-par parallel_packge" support | |
249 | * | |
250 | * Revision 3.12 1994/06/04 14:49:41 green | |
251 | * added necessary P4/MPI defs | |
252 | * | |
253 | * Revision 3.11 1994/06/02 13:44:26 green | |
254 | * attempt to port to Sloaris... | |
255 | * Work In Progress(WIPed) | |
256 | * | |
257 | * Revision 3.10 1994/05/31 12:23:32 green | |
258 | * modified #define for GETPGRP such that __osf__ doesn't utilize args | |
259 | * | |
260 | * Revision 3.9 1994/05/31 12:03:45 green | |
261 | * some OSes define MAXNAMELEN - some don't | |
262 | * handled with an ifndef in def.h | |
263 | * | |
264 | * removed "#include "h.h"" in defined.c | |
265 | * | |
266 | * yanked ANSI prototyping in dsh.c/dshd.c as some(sic) C compilers can't | |
267 | * swallow them | |
268 | * | |
269 | * #ifdef'ed fcntl(F_SETOWN) out for HPUX in dsh.c as HPUX doesn't define | |
270 | * it | |
271 | * | |
272 | * #ifdef'ed "#include <sys/select.h>" out of h.h #ifdefed | |
273 | * __hpux/bsd_4_2/SVR3/__osf__.(taken care of in types.h in most of | |
274 | * these.) | |
275 | * | |
276 | * Revision 3.8 1994/05/31 10:30:36 green | |
277 | * some OSes define NCARGS, some don't - handle with ifndef... | |
278 | * | |
279 | * Revision 3.7 1994/05/31 00:52:40 green | |
280 | * added dsh.c dshd.c to Makefile.proto | |
281 | * | |
282 | * added MAXNAMELEN and NCARGS to def.h | |
283 | * | |
284 | * type casting in dqs_reauth.c, dqs_sec.c, dqs_setup.c to hush gcc | |
285 | * warnings | |
286 | * | |
287 | * added jmp_buf to globals.h, changed Revision number in globals.h | |
288 | * | |
289 | * added dsh and dshd tp prognames.h | |
290 | * | |
291 | * Revision 3.6 1994/05/30 23:56:16 green | |
292 | * added necessary defs for DCMD/DSH to def.h | |
293 | * | |
294 | * added notes on necessary hooks to dqs_execd.c reqd for direct execing | |
295 | * of dsh | |
296 | * | |
297 | * added "#include <setjmp.h>" to h.h | |
298 | * | |
299 | * Revision 3.5 1994/05/04 17:54:53 green | |
300 | * added FreeBSD support(Pedro A M Vazquez) | |
301 | * | |
302 | * Revision 3.4 1994/04/01 02:59:28 green | |
303 | * added "qalter" support | |
304 | * | |
305 | * Revision 3.3 1994/03/27 05:59:44 green | |
306 | * def.h:UNPACKSTR() modified to force a NULL as realloc() doesn't | |
307 | * necessarily return clean memory | |
308 | * | |
309 | * dqs_list.c:dqs_insert(TAIL) had a bug wheninserting to a NULL head | |
310 | * | |
311 | * may "Last Minute Hack" to dqs_list.c:dqs_showlist() really screwed up | |
312 | * some things - yanked... | |
313 | * | |
314 | * Revision 3.2 1994/03/26 16:33:33 green | |
315 | * added "-srl" support. | |
316 | * | |
317 | * dqs_resolve.c:dqs_read_resolve_file() now returns the primary qmaster | |
318 | * name for fields marked as "none" | |
319 | * | |
320 | * Revision 3.1 1994/03/26 15:29:14 green | |
321 | * allowed for "qconf -sq [dest_id_list]" vs "qconf -sq dest_id_list" | |
322 | * | |
323 | * write generic queue configuration in common_dir | |
324 | * | |
325 | * Revision 3.0 1994/03/07 04:13:02 green | |
326 | * 3.0 freeze | |
327 | * | |
328 | * Revision 1.8 1994/02/25 23:13:17 green | |
329 | * added "PID_FILE" to def.h to log process id. | |
330 | * | |
331 | * modified dqs_execd.c and qmaster.c to log pids to a file | |
332 | * | |
333 | * added dqs_log_pid() to dqs_utility.c | |
334 | * | |
335 | * remade func.h | |
336 | * | |
337 | * forced insertion of "green" into Man_head -- this needs to be removed | |
338 | * and a def in dqs.h if running as non-root. | |
339 | * | |
340 | * Revision 1.7 1994/02/24 01:10:01 green | |
341 | * added default compile flags in Makefile.proto | |
342 | * | |
343 | * modified GETPGRP() and SETPGRP() in def.h for IRIX 5.1.1.1 support | |
344 | * | |
345 | * changed "st_mtime" to "st_m_time" in dqs_reauth.cand dqs_sec.c | |
346 | * for IRIX 5.1.1.1 support | |
347 | * | |
348 | * Revision 1.6 1994/02/23 16:19:16 green | |
349 | * added "QUSAGE" to def.h | |
350 | * | |
351 | * Revision 1.5 1994/02/17 14:48:57 green | |
352 | * added MAX_KLOG_TIME to def.h | |
353 | * | |
354 | * added some strategic dqs_set_coresize_2_0() as CYAs | |
355 | * | |
356 | * nuked some dqs_set_coresize_back_normal() | |
357 | * | |
358 | * dinked with ALRM handlers for "robustness" | |
359 | * | |
360 | * NOTE: HPUX does not support core limit size --- sad... | |
361 | * | |
362 | * Revision 1.4 1994/02/10 20:58:37 green | |
363 | * moved "LOG_FILE" and "ERR_FILE" out of def.h to dqs.h | |
364 | * | |
365 | * fixed "-Passwd passwd_file" option | |
366 | * | |
367 | * Revision 1.3 1994/02/09 19:47:58 green | |
368 | * syncing source with docs | |
369 | * | |
370 | * Revision 1.2 1994/02/02 20:22:05 green | |
371 | * cleaned up "qconf.c" to sync with docs | |
372 | * | |
373 | * Revision 1.1.1.1 1994/02/01 17:57:36 green | |
374 | * DQS 3.0 ALPHA | |
375 | * | |
376 | *--------------------------------------------------*/ | |
377 | ||
378 | /* logicals */ | |
379 | ||
380 | #ifndef FALSE | |
381 | #define FALSE 0 | |
382 | #endif | |
383 | #ifndef TRUE | |
384 | #define TRUE 1 | |
385 | #endif | |
386 | ||
387 | ||
388 | ||
389 | /* DQS_COMPILE_DEBUG inserts debugging macros | |
390 | * LEAVE THEM IN!(or don't call if ya need help) | |
391 | */ | |
392 | ||
393 | #define DQS_COMPILE_DEBUG | |
394 | #define DEBUG_FILE stderr | |
395 | ||
396 | #define DEFAULT_EDITOR "vi" | |
397 | #define DQS_MAX_FD 600 | |
398 | #define MAX_SEQNUM 999999 | |
399 | #define MAX_PATH 2048 | |
400 | ||
401 | /*********************************************************/ | |
402 | ||
403 | #ifdef __alpha | |
404 | #define u_long32 u_int | |
405 | #else | |
406 | #define u_long32 u_long | |
407 | #endif | |
408 | ||
409 | /*********************************************************/ | |
410 | /* Job states */ | |
411 | #define IDLE 0 | |
412 | ||
413 | /* Batch Services Summary */ | |
414 | ||
415 | #define JOB_EXECUTION 300 | |
416 | #define JOB_ROUTING 301 | |
417 | #define JOB_EXIT 302 | |
418 | #define BATCH_SERVER_RESTART 303 | |
419 | #define JOB_ABORTS 304 | |
420 | #define QUEUE_JOB_REQUEST 305 | |
421 | #define MODIFY_JOB_REQUEST 306 | |
422 | #define DELETE_JOB_REQUEST 307 | |
423 | #define JOB_MESSAGE_REQUEST 308 | |
424 | #define RERUN_JOB_REQUEST 309 | |
425 | #define SIGNAL_JOB_REQUEST 310 | |
426 | #define JOB_STATUS_REQUEST 311 | |
427 | #define QUEUE_STATUS_REQUEST 312 | |
428 | #define SERVER_STATUS_REQUEST 313 | |
429 | #define SELECT_JOBS_REQUEST 314 | |
430 | #define MOVE_JOB_REQUEST 315 | |
431 | #define HOLD_JOB_REQUEST 316 | |
432 | #define RELEASE_JOB_REQUEST 317 | |
433 | #define SERVER_SHUTDOWN_REQUEST 318 | |
434 | #define LOCATE_JOB_REQUEST 319 | |
435 | #define SIGNAL_QUEUE_REQUEST 320 | |
436 | ||
437 | #define STARTING_UP 321 /* NOT PART OF P1003.15D12! */ | |
438 | #define DQS_ACK 500 | |
439 | #define DQS_NAK 501 | |
440 | #define LOAD_AVG 322 | |
441 | ||
442 | #define QMASTER_ACTION_REQUEST 323 /* sent to the qmaster for help */ | |
443 | #define DQS_EXECD_ACTION_REQUEST 344 /* sent to the dqs_execd by the qmaster */ | |
444 | ||
445 | /* Action sub fields */ | |
446 | #define SYNCHRONIZE 001 | |
447 | #define ERROR_REPORT 002 | |
448 | #define SLAVE_PROCESS_ALERT 003 | |
449 | #define KILL_SLAVE_PROCESS 004 | |
450 | #define REFRESH 005 | |
451 | #define SHUTDOWN 006 | |
452 | #define MAIL_TO_ADMINISTRATOR 007 | |
453 | ||
454 | /* return codes */ | |
455 | #define DENIED 400 | |
456 | #define ACCEPTED 401 | |
457 | ||
458 | /********************************************************************************/ | |
459 | /************ scheduling constants *****************************************/ | |
460 | ||
461 | #define BASE_PRIORITY 1024 | |
462 | #define PRIORITY_OFFSET 8 | |
463 | #define NEWCOMER_FLAG 0x1000000 | |
464 | /* forced negative sign bit */ | |
465 | #define MAX_JOBS_EXCEEDED 0x8000000 | |
466 | #define ALREADY_SCANNED 0x4000000 | |
467 | ||
468 | #define PRIORITY_MASK 0xffff00 | |
469 | #define SUBPRIORITY_MASK 0x0000ff | |
470 | ||
471 | #define JOBS_SCANNED_PER_PASS 4000 | |
472 | /********************************************************************************/ | |
473 | ||
474 | /* Event logging controls */ | |
475 | #define LOG_VIA_SYSLOG 500 /* log via syslogd */ | |
476 | #define LOG_VIA_FILE 501 /* log via logfile */ | |
477 | #define LOG_VIA_COMBO 502 /* log messages both ways */ | |
478 | ||
479 | #define LOG_EXTDEBUG LOG_DEBUG+1 | |
480 | ||
481 | /********************************************************************************/ | |
482 | ||
483 | /* misc */ | |
484 | #define ASCENDING 600 | |
485 | #define DESCENDING 601 | |
486 | #define HEAD 602 | |
487 | #define TAIL 603 | |
488 | ||
489 | /********************************************************************************/ | |
490 | ||
491 | /* Shell strategies */ | |
492 | ||
493 | #define DQS_FIXED_SHELL 700 | |
494 | #define DQS_FLOATING_SHELL 701 | |
495 | ||
496 | /********************************************************************************/ | |
497 | ||
498 | /* remap signals */ | |
499 | ||
500 | #define DQS_SIGHUP 901 | |
501 | #define DQS_SIGINT 902 | |
502 | #define DQS_SIGQUIT 903 | |
503 | #define DQS_SIGILL 904 | |
504 | #define DQS_SIGTRAP 905 | |
505 | #define DQS_SIGABRT 906 | |
506 | #define DQS_SIGIOT 907 | |
507 | #define DQS_SIGEMT 908 | |
508 | #define DQS_SIGFPE 909 | |
509 | #define DQS_SIGKILL 910 | |
510 | #define DQS_SIGBUS 911 | |
511 | #define DQS_SIGSEGV 912 | |
512 | #define DQS_SIGSYS 913 | |
513 | #define DQS_SIGPIPE 914 | |
514 | #define DQS_SIGALRM 915 | |
515 | #define DQS_SIGTERM 916 | |
516 | #define DQS_SIGURG 917 | |
517 | #define DQS_SIGSTOP 918 | |
518 | #define DQS_SIGTSTP 919 | |
519 | #define DQS_SIGCONT 920 | |
520 | #define DQS_SIGCHLD 921 | |
521 | #define DQS_SIGTTIN 922 | |
522 | #define DQS_SIGTTOU 923 | |
523 | #define DQS_SIGIO 924 | |
524 | #define DQS_SIGXCPU 925 | |
525 | #define DQS_SIGXFSZ 926 | |
526 | #define DQS_SIGVTALRM 927 | |
527 | #define DQS_SIGPROF 928 | |
528 | #define DQS_SIGWINCH 929 | |
529 | #define DQS_SIGLOST 930 | |
530 | #define DQS_SIGUSR1 931 | |
531 | #define DQS_SIGUSR2 932 | |
532 | ||
533 | /********************************************************************************/ | |
534 | /* Symbolic Constants */ | |
535 | ||
536 | /* misc */ | |
537 | ||
538 | #define NONE 0x00000000 | |
539 | #define ALL 0x77777777 | |
540 | ||
541 | /* Checkpoint/Restart Constants */ | |
542 | /* use dqs_show_checkpoint() */ | |
543 | ||
544 | #define CHECKPOINT_AT_MINIMUM_INTERVAL_SYM 'm' | |
545 | #define CHECKPOINT_AT_MINIMUM_INTERVAL 0x00000001 | |
546 | #define CHECKPOINT_AT_SHUTDOWN_SYM 's' | |
547 | #define CHECKPOINT_AT_SHUTDOWN 0x00000002 | |
548 | #define CHECKPOINT_AT_UNSPECIFIED_SYM 'u' | |
549 | #define CHECKPOINT_AT_UNSPECIFIED 0x00000004 | |
550 | #define NO_CHECKPOINT_SYM 'n' | |
551 | #define NO_CHECKPOINT 0x00000008 | |
552 | ||
553 | /* Hold Type Constants */ | |
554 | #define NO_HOLD_SYM 'n' | |
555 | #define NO_HOLD 0x000000010 | |
556 | #define OTHER_SYM 'o' | |
557 | #define OTHER 0x000000020 | |
558 | #define SYSTEM_SYM 's' | |
559 | #define SYSTEM 0x000000040 | |
560 | #define USER_SYM 'u' | |
561 | #define USER 0x000000080 | |
562 | ||
563 | /* Job/Queue State Constants */ | |
564 | /* use dqs_show_states() */ | |
565 | ||
566 | #define ALARM_SYM 'a' | |
567 | #define ALARM 0x000000001 | |
568 | #define SUSPEND_ON_COMP_SYM 'c' /* NOT PART OF P1003.15D12! */ | |
569 | #define SUSPEND_ON_COMP 0x000000002 | |
570 | #define DISABLED_SYM 'd' | |
571 | #define DISABLED 0x000000004 | |
572 | #define ENABLED_SYM 'e' | |
573 | #define ENABLED 0x000000008 | |
574 | #define HELD_SYM 'h' | |
575 | #define HELD 0x000000010 | |
576 | #define MIGRATING_SYM 'm' /* NOT PART OF P1003.15D12! */ | |
577 | #define MIGRATING 0x000000020 | |
578 | #define QUEUED_SYM 'q' | |
579 | #define QUEUED 0x000000040 | |
580 | #define RUNNING_SYM 'r' | |
581 | #define RUNNING 0x000000080 | |
582 | #define SUSPENDED_SYM 's' /* NOT PART OF P1003.15D12! */ | |
583 | #define SUSPENDED 0x000000100 | |
584 | #define TRANSISTING_SYM 't' | |
585 | #define TRANSISTING 0x000000200 | |
586 | #define UNKNOWN_SYM 'u' | |
587 | #define UNKNOWN 0x000000400 | |
588 | #define WAITING_SYM 'w' | |
589 | #define WAITING 0x000000800 | |
590 | #define EXITING_SYM 'x' /* NOT P1003.15D12 compliant! 'e' */ | |
591 | #define EXITING 0x000001000 | |
592 | #define XSUSPEND_ON_COMP 0x000002000 | |
593 | #define HANDOFF_ERROR_SYM 'H' /* NOT PART OF P1003.15D12! */ | |
594 | #define HANDOFF_ERROR 0x000004000 | |
595 | #define SUBORDINATED_SYM 'S' /* NOT PART OF P1003.15D12! */ | |
596 | #define SUBORDINATED 0x000008000 | |
597 | /* Keep_list Constants */ | |
598 | #define KEEP_NONE_SYM 'n' | |
599 | #define KEEP_NONE 0x00000000 | |
600 | #define KEEP_STD_ERROR_SYM 'e' | |
601 | #define KEEP_STD_ERROR 0x000010000 | |
602 | #define KEEP_STD_OUTPUT_SYM 'o' | |
603 | #define KEEP_STD_OUTPUT 0x000020000 | |
604 | ||
605 | /* Mail Option Constants */ | |
606 | ||
607 | #define MAIL_AT_ABORT_SYM 'a' | |
608 | #define MAIL_AT_ABORT 0x000040000 | |
609 | #define MAIL_AT_BEGINNING_SYM 'b' | |
610 | #define MAIL_AT_BEGINNING 0x000080000 | |
611 | #define MAIL_AT_EXIT_SYM 'e' | |
612 | #define MAIL_AT_EXIT 0x000100000 | |
613 | #define NO_MAIL_SYM 'n' | |
614 | #define NO_MAIL 0x000200000 | |
615 | #define MAIL_AT_SUSPENSION_SYM 's' /* NOT PART OF P1003.15D12! */ | |
616 | #define MAIL_AT_SUSPENSION 0x000400000 | |
617 | ||
618 | /********************************************************************************/ | |
619 | ||
620 | /* User access declarations */ | |
621 | ||
622 | #define GLOBAL_ACCESS_LIST "GLOBAL" /* global access list name */ | |
623 | #define ACCESS_FREE 1 /* access free w/o exclusions */ | |
624 | #define ACCESS_OPEN 2 /* access open w/ exclusions */ | |
625 | #define ACCESS_RESTRICTED 3 /* access restricted, some */ | |
626 | /* users allowed */ | |
627 | /*******************************************************************************/ | |
628 | /* conf file definitions */ | |
629 | #define LEAVE_OUTPUT_FILES 800 | |
630 | #define COPY_OUTPUT_FILES 801 | |
631 | #define LINK_OUTPUT_FILES 802 | |
632 | ||
633 | /********************************************************************************/ | |
634 | ||
635 | /* misc qsub/qsh stuff */ | |
636 | ||
637 | /* Resource request types */ | |
638 | #define GENERIC 0 /* resource requested by DQS group */ | |
639 | #define HARD 0 /* request must be satisfied */ | |
640 | #define SOFT 2 /* request need not be satisfied */ | |
641 | #define SPECIFIC 3 /* specific queue requested */ | |
642 | ||
643 | /* used by the parser */ | |
644 | #define MASTER 0 | |
645 | #define H_SPECIFIC 1 | |
646 | #define H_GENERIC 2 | |
647 | #define S_SPECIFIC 3 | |
648 | #define S_GENERIC 4 | |
649 | ||
650 | #define P4 1 | |
651 | #define MPI 2 | |
652 | #define GENERIC_SLA 3 | |
653 | #define GENERIC_ALL 4 | |
f0656be4 | 654 | #define DQSPVM 5 |
5f71eac1 | 655 | #define TCGMSG 6 |
656 | /********************************************************************************/ | |
657 | ||
658 | /* misc directories */ | |
659 | /* these are all relative to the SPOOL_DIR */ | |
660 | #define COMMON_DIR "common_dir" | |
661 | #define EXEC_DIR "exec_dir" | |
662 | #define JOB_DIR "job_dir" | |
663 | #define QUEUE_DIR "queue_dir" | |
664 | #define RUSAGE_DIR "rusage_dir" | |
665 | #define TID_DIR "tid_dir" | |
666 | ||
667 | /* misc files */ | |
668 | /* these are all relative to the SPOOL_DIR */ | |
669 | #define ACL_FILE "common_dir/acl_file" | |
670 | #define ACT_FILE "act_file" | |
671 | #define PID_FILE "pid_file" | |
672 | #define COMPLEX_FILE "common_dir/complex_file" | |
673 | #define CONSUMABLE_FILE "common_dir/consumable_file" | |
674 | #define COOKIE_FILE "common_dir/cookie_file" | |
675 | #define DEFAULT_COMPLEX_FILE "common_dir/default_complex_file" | |
676 | #define DEFAULT_QCONF_FILE "common_dir/default_qconf_file" | |
677 | #define GENERIC_QUEUE "common_dir/generic_queue" | |
678 | #define HOST_FILE "common_dir/host_file" | |
679 | #define MAN_FILE "common_dir/man_file" | |
680 | #define OP_FILE "common_dir/op_file" | |
681 | #define SEQ_NUM_FILE "common_dir/seq_num_file" | |
682 | #define STAT_FILE "stat_file" | |
683 | ||
684 | /*********************************************************/ | |
685 | /*Code via Doug Gibson*/ | |
686 | #define MAX_STRING_SIZE 2048 | |
687 | ||
688 | #define INTSIZE 4 /* (4) 8 bit bytes */ | |
689 | #if _UNICOS | |
690 | #define INTOFF 4 /* big endian 64-bit machines where sizeof(int) = 8 */ | |
691 | #else | |
692 | #define INTOFF 0 /* the rest of the world; see comments in request.c */ | |
693 | #endif | |
694 | ||
695 | #define MAX_DBE_SIZE 4096 /* max (key,content) size in bytes for ndbm(3) */ | |
696 | ||
697 | #define REQUESTSIZE 1024 /* BE CAREFUL */ | |
698 | ||
699 | #define HASH_BUCKET_SIZE 128 | |
700 | #define QMASTER_HASH_BUCKET_SIZE 256 | |
701 | #ifndef MAX_NIS_RETRIES | |
702 | #define MAX_NIS_RETRIES 10 /* max number of retries for slow NIS servers */ | |
703 | #endif | |
704 | #ifndef MAX_UNLINK_RETRIES | |
705 | #define MAX_UNLINK_RETRIES 50 /* max number of unlink(2) retries */ | |
706 | #endif | |
707 | ||
708 | #define CLEAR_EXECD_TIDS 10 /* how often to clear unreaped execd TIDs */ | |
709 | ||
710 | /*********************************************************/ | |
711 | /* Operating system-specific definitions */ | |
712 | /*********************************************************/ | |
713 | ||
714 | #if ( defined(SOLARIS23) || defined(SOLARIS24) || defined(SOLARIS25) || defined(SOLARIS26) || defined(SOLARIS27) ) | |
715 | #define SOLARIS23_UP TRUE | |
716 | #endif | |
717 | ||
718 | /* Extended sysconf(2) interface macros */ | |
719 | #ifdef _SC_EXIT_SIGHUP | |
720 | #define EXIT_SIGHUP sysconf(_SC_EXIT_SIGHUP) | |
721 | #else | |
722 | #define EXIT_SIGHUP FALSE | |
723 | #endif | |
724 | #ifdef _SC_PID_MAX | |
725 | #define MAX_PROCESS_ID sysconf(_SC_PID_MAX) | |
726 | #else | |
727 | #define MAX_PROCESS_ID MAXPID | |
728 | #endif | |
729 | #ifdef _SC_UID_MAX | |
730 | #define MAX_USER_ID sysconf(_SC_UID_MAX) | |
731 | #else | |
732 | #define MAX_USER_ID MAXUID | |
733 | #endif | |
734 | ||
735 | /* FLOCK - lock a file */ | |
736 | ||
737 | #if (defined(_AIX) || defined(__hpux) || defined(sun)) | |
738 | #define FLOCK(x) lockf(x,F_LOCK,0) | |
739 | #define FUNLOCK(x) lockf(x,F_ULOCK,0) | |
740 | #else | |
741 | #define FLOCK(x) flock(x,LOCK_EX) | |
742 | #define FUNLOCK(x) flock(x,LOCK_UN) | |
743 | #endif | |
744 | ||
745 | ||
746 | /* GETPGRP - get a process group */ | |
747 | ||
748 | #if (defined(__sgi) || defined(__convex__) || defined(_AIX) || defined(i386) || defined (SVR3) || defined (__osf__) || defined(solaris)|| defined(SOLARIS23_UP) ) | |
749 | #define GETPGRP getpgrp() | |
750 | #else | |
751 | #define GETPGRP getpgrp(getpid()) | |
752 | #endif | |
753 | ||
754 | /* SETPGRP - set process group */ | |
755 | #if (defined(__sgi) || defined(i386) || defined(_UNICOS) || defined (SVR3)|| defined (__osf__) || defined (_AIX) || defined(solaris) || defined(SOLARIS23_UP) ) | |
756 | #define SETPGRP setpgrp() | |
757 | #else | |
758 | #define SETPGRP setpgid(getpid(), GETPGRP) | |
759 | #endif | |
760 | ||
761 | /* SunOS 4.1.X Specific SETPGRP, Required for Proper Signal Handling. */ | |
762 | /* Assign calling process, PID=0, the Process Group ID, pgrp, to the actual */ | |
763 | /* PID number. */ | |
764 | #if ( defined(sun) && !(defined(solaris) || defined(SOLARIS23_UP) )) | |
765 | #undef SETPGRP | |
766 | #define SETPGRP setpgrp(0,getpid()) | |
767 | #endif | |
768 | ||
769 | #if defined( __FreeBSD__) | |
770 | #undef SETPGRP | |
771 | #define SETPGRP setpgrp(getpid(),getpid()) | |
772 | #endif | |
773 | /*This is a patch from David Geldreich*/ | |
774 | #if defined (__osf__) | |
775 | #undef SETPGRP | |
776 | #define SETPGRP setpgid(getpid(),getpid()) | |
777 | #endif | |
778 | /*End patch*/ | |
779 | #if defined __hpux | |
780 | #undef SETPGRP | |
781 | #undef GETPGRP | |
782 | #define SETPGRP setpgrp() | |
783 | #define GETPGRP getpgrp() | |
784 | #endif | |
785 | ||
786 | #if (defined( linux ) && defined(__alpha ) ) | |
787 | #undef SETPGRP | |
788 | #undef GETPGRP | |
789 | #define SETPGRP setpgrp() | |
790 | #define GETPGRP getpgrp() | |
791 | #endif | |
792 | ||
793 | #if defined __hpux | |
794 | #define SETEUID(e1) setresuid (-1, e1, -1) | |
795 | #else | |
796 | #define SETEUID(e1) seteuid ( e1 ) | |
797 | #endif | |
798 | ||
799 | ||
800 | /* SETPRIORITY - set process priority */ | |
801 | #if (defined(solaris)||defined(SOLARIS23_UP)) | |
802 | #define SETPRIORITY(niceval) nice(niceval-nice(0)) | |
803 | #endif | |
804 | #ifdef __hpux | |
805 | #define SETPRIORITY(niceval) nice(niceval) | |
806 | #endif | |
807 | #ifdef _UNICOS | |
808 | #define SETPRIORITY(niceval) nice(niceval) | |
809 | #endif | |
810 | #ifndef SETPRIORITY | |
811 | #define SETPRIORITY(niceval) setpriority(PRIO_PGRP,GETPGRP,niceval) | |
812 | #endif | |
813 | ||
814 | /* SunOS 4.1.X DOES NOT HAVE "strerror()" routine defined. */ | |
815 | /* Forces the use of the "sys_errlist[]" structure defined in "<errno.h>". */ | |
816 | #if ( defined(sun) && !(defined(solaris) || defined(SOLARIS23_UP) )) | |
817 | #define STRERROR sys_errlist[(int) errno] | |
818 | #else | |
819 | #define STRERROR strerror((int) errno) | |
820 | #endif | |
821 | ||
822 | #if (defined(_UNICOS) || defined(__hpux) || defined(solaris) || defined(SOLARIS23_UP)) | |
823 | #define RESOURCES tms | |
824 | #define GETRUSAGE(loc) times(loc) | |
825 | #if _UNICOS | |
826 | #define CLOCKTICK _SC_CLK_TCK | |
827 | #endif | |
828 | ||
829 | #if (defined(__hpux) || defined(solaris)|| defined(SOLARIS23_UP)) | |
830 | #define CLOCKTICK CLK_TCK; | |
831 | #endif | |
832 | #else | |
833 | #define RESOURCES rusage | |
834 | #define GETRUSAGE(loc) getrusage(RUSAGE_CHILDREN,loc) | |
835 | #define CLOCKTICK | |
836 | #endif | |
837 | ||
838 | #if (defined( solaris) || defined(SOLARIS23_UP)) | |
839 | #ifdef bcmp | |
840 | #undef bcmp | |
841 | #endif | |
842 | #define bcmp(s1, s2, n) memcmp ((s1), (s2), (n)) | |
843 | ||
844 | #ifdef bcopy | |
845 | #undef bcopy | |
846 | #endif | |
847 | #define bcopy(s, d, n) memcpy ((d), (s), (n)) | |
848 | ||
849 | #ifdef bzero | |
850 | #undef bzero | |
851 | #endif | |
852 | #define bzero(s, n) memset ((s), 0, (n)) | |
853 | ||
854 | #ifdef index | |
855 | #undef index | |
856 | #endif | |
857 | #define index(s, c) strchr(s, c) | |
858 | ||
859 | #ifdef rindex | |
860 | #undef rindex | |
861 | #endif | |
862 | #define rindex(s, c) strrchr(s, c) | |
863 | ||
864 | /* this is no longer used in solaris, but then we have no rusage-information */ | |
865 | #ifdef wait3 | |
866 | #undef wait3 | |
867 | #endif | |
868 | #define wait3(s, o, r) waitpid(-1, s, o) | |
869 | ||
870 | #endif | |
871 | ||
872 | ||
873 | /* Directory structure definitions */ | |
874 | ||
875 | #if (defined(_AIX) || defined(__osf__) || defined(_UNICOS) || defined(sun) || defined(solaris) || defined(SOLARIS23_UP)) | |
876 | #define DIRENT dirent | |
877 | struct dirent *readdir(); | |
878 | #else | |
879 | #define DIRENT direct | |
880 | #ifndef NeXT | |
881 | struct direct *readdir(); | |
882 | #endif | |
883 | #endif | |
884 | ||
885 | /* Temporary filename interface */ | |
886 | #if __convex__ | |
887 | #define TEMPNAM tmpnam((char *)NULL) | |
888 | char *tmpnam(); | |
889 | #else | |
890 | #define TEMPNAM tempnam((char *)NULL,(char *)NULL) | |
891 | char *tempnam(); | |
892 | #endif | |
893 | ||
894 | #if (defined( linux ) && defined(__alpha ) ) | |
895 | #define ADDRLEN size_t | |
896 | #else | |
897 | #define ADDRLEN int | |
898 | #endif | |
899 | ||
900 | #ifndef _NFILE | |
901 | #define _NFILE 32 | |
902 | #endif | |
903 | ||
904 | /*********************************************************/ | |
905 | /* Logging macros from hell */ | |
906 | /*********************************************************/ | |
907 | ||
908 | #define FREE(x) if(x){free( (char *)x); x=NULL;} | |
909 | ||
910 | #define READ_WRITE_MACRO_DEFS int str_len=0;int bytes_written=0;\ | |
911 | int ii=0;int bytes_read=0;string tmpp_str | |
912 | ||
913 | #define WRITE_INT(x,y) if (dqs_writenbytes(x,y,INTSIZE)!=INTSIZE) {\ | |
914 | WARNING((DQS_EVENT,"dqs_writenbytes() returned an error"));\ | |
915 | DEXITE;return(-1);}else{bytes_written+=INTSIZE;} | |
916 | ||
917 | #define WRITE_STR(x,y) str_len=strlen(y);str_len++;\ | |
918 | WRITE_INT(x,&str_len);ii=dqs_writenbytes(x,y,str_len);\ | |
919 | DPRINTF((DQS_EVENT,"dqs_writenbytes returned %d str_len = %d",ii,str_len))\ | |
920 | if (ii!=str_len) {WARNING((DQS_EVENT,"error writting string"));\ | |
921 | DEXITE;return(-1);}else{bytes_written+=str_len;} | |
922 | ||
923 | #define READ_INT(x,y) if (dqs_readnbytes(x,y,INTSIZE)!=INTSIZE) {\ | |
924 | WARNING((DQS_EVENT,"dqs_readnbytes() returned an error"));DEXITE;return(NULL);}\ | |
925 | else{bytes_read+=INTSIZE;} | |
926 | ||
927 | #define READ_STR(x,y)READ_INT(x,&str_len);ii=dqs_readnbytes(x,tmpp_str,str_len);if(ii!=str_len){\ | |
928 | WARNING((DQS_EVENT,"error reading string"));DEXITE;return(NULL);}\ | |
929 | else{y=dqs_string_insert(y,tmpp_str);bytes_read+=str_len;} | |
930 | ||
931 | /* DON'T TOUCH THESE! */ | |
932 | #define NIBBLE 8 | |
933 | #define OFFSET 16*NIBBLE | |
934 | #define CHUNK 262144 | |
935 | #define NIBBLE_SIZE(x) ((1+((x-1)/NIBBLE))*NIBBLE) | |
936 | ||
937 | #define CHUNK_SIZE(x) ((1+((x-1)/CHUNK))*CHUNK) | |
938 | ||
939 | #define PACK_MACRO_DEFS int STR_LEN;char STRING[MAX_STRING_SIZE];u_long32 J | |
940 | ||
941 | /* a b c d e | |
942 | PACKINT(head_ptr,cur_ptr,int,bytes_packed,mem_size); | |
943 | */ | |
944 | ||
945 | #define PACKINT(a,b,c,d,e)\ | |
946 | if ((d+INTSIZE)>e)\ | |
947 | {\ | |
948 | e+=CHUNK;\ | |
949 | a=dqs_realloc(a,e);\ | |
950 | if (!a)\ | |
951 | {\ | |
952 | CRITICAL((DQS_EVENT,"dqs_realloc() failure in PACKINT()"));\ | |
953 | abort();\ | |
954 | }\ | |
955 | b=(a);\ | |
956 | b+=(d);\ | |
957 | }\ | |
958 | J=htonl(c);\ | |
959 | bcopy(&J,b,INTSIZE);\ | |
960 | b=(b+INTSIZE);\ | |
961 | d+=INTSIZE; | |
962 | ||
963 | ||
964 | /* a b c d e | |
965 | PACKSTR(head_ptr,cur_ptr,str,bytes_packed,mem_size); | |
966 | */ | |
967 | ||
968 | ||
969 | #define PACKSTR(a,b,c,d,e)\ | |
970 | if (!c) STR_LEN=1; \ | |
971 | else { \ | |
972 | STR_LEN=strlen(c);\ | |
973 | STR_LEN++; } \ | |
974 | if ((d+STR_LEN)>e)\ | |
975 | {\ | |
976 | e+=CHUNK;\ | |
977 | a=dqs_realloc(a,e);\ | |
978 | if (!a)\ | |
979 | {\ | |
980 | CRITICAL((DQS_EVENT,"dqs_realloc() failure in PACKSTR()"));\ | |
981 | abort();\ | |
982 | }\ | |
983 | b=(a);\ | |
984 | b+=(d);\ | |
985 | }\ | |
986 | if (c) bcopy(c,b,STR_LEN);\ | |
987 | else bcopy(&dqs_zero,b,STR_LEN); \ | |
988 | b+=STR_LEN;\ | |
989 | d+=STR_LEN; | |
990 | ||
991 | /* a b c d e f | |
992 | PACKBUF(head_ptr,cur_ptr,buf_ptr,buf_size,bytes_packed,mem_size); | |
993 | */ | |
994 | ||
995 | #define PACKBUF(a,b,c,d,e,f)\ | |
996 | if ((d+e)>f)\ | |
997 | {\ | |
998 | f+=CHUNK_SIZE(d);\ | |
999 | a=dqs_realloc(a,f);\ | |
1000 | if (!a)\ | |
1001 | {\ | |
1002 | CRITICAL((DQS_EVENT,"dqs_realloc() failure in PACKBUF()"));\ | |
1003 | abort();\ | |
1004 | }\ | |
1005 | b=(a);\ | |
1006 | b+=(e);\ | |
1007 | }\ | |
1008 | bcopy(c,b,d);\ | |
1009 | b+=(d);\ | |
1010 | e+=(d); | |
1011 | ||
1012 | ||
1013 | /* a b c d | |
1014 | UNPACKINT(cur_ptr,int,bytes_unpacked,bytes_packed); | |
1015 | */ | |
1016 | #define UNPACKINT(a,b,c,d)\ | |
1017 | if ((c+INTSIZE)>d)\ | |
1018 | {\ | |
1019 | CRITICAL((DQS_EVENT,"error in UNPACKINT()"));\ | |
1020 | abort();\ | |
1021 | }\ | |
1022 | bcopy(a,&b,INTSIZE);\ | |
1023 | b=ntohl(b);\ | |
1024 | a+=INTSIZE;\ | |
1025 | c+=INTSIZE; | |
1026 | ||
1027 | ||
1028 | /* a b c d | |
1029 | UNPACKSTR(cur_ptr,str,bytes_unpacked,bytes_packed); | |
1030 | */ | |
1031 | #define UNPACKSTR(a,b,c,d)\ | |
1032 | if (!a[0]) STR_LEN=1; \ | |
1033 | else { \ | |
1034 | STR_LEN=strlen(a);\ | |
1035 | STR_LEN++;\ | |
1036 | } \ | |
1037 | if ((STR_LEN+c)>d)\ | |
1038 | {\ | |
1039 | CRITICAL((DQS_EVENT,"error in UNPACKSTR()"));\ | |
1040 | abort();\ | |
1041 | }\ | |
1042 | FREE(b); \ | |
1043 | if (a[0]) { \ | |
1044 | bcopy(a,STRING,STR_LEN);\ | |
1045 | b=dqs_string_insert(NULL,STRING); } \ | |
1046 | else b=NULL; \ | |
1047 | a+=STR_LEN;\ | |
1048 | c+=STR_LEN; | |
1049 | ||
1050 | /* a b c d e | |
1051 | UNPACKBUF(cur_ptr,buf_ptr,buf_size,bytes_unpacked,bytes_packed); | |
1052 | */ | |
1053 | ||
1054 | #define UNPACKBUF(a,b,c,d,e)\ | |
1055 | if ((c+d)>e)\ | |
1056 | {\ | |
1057 | CRITICAL((DQS_EVENT,"error in UNPACKBUF()"));\ | |
1058 | abort();\ | |
1059 | }\ | |
1060 | b=dqs_malloc(c);\ | |
1061 | bcopy(a,b,c);\ | |
1062 | a+=c;\ | |
1063 | d+=c; | |
1064 | ||
1065 | ||
1066 | #define CRITICAL(x) sprintf x;dqs_log(LOG_CRIT,DQS_EVENT,__FILE__,DQS_FUNC,__LINE__) | |
1067 | #define ERROR(x) sprintf x;dqs_log(LOG_ERR,DQS_EVENT,__FILE__,DQS_FUNC,__LINE__) | |
1068 | #define WARNING(x) sprintf x;dqs_log(LOG_WARNING,DQS_EVENT,__FILE__,DQS_FUNC,__LINE__) | |
1069 | #define NOTICE(x) sprintf x;dqs_log(LOG_NOTICE,DQS_EVENT,__FILE__,DQS_FUNC,__LINE__) | |
1070 | #define INFO(x) sprintf x;dqs_log(LOG_INFO,DQS_EVENT,__FILE__,DQS_FUNC,__LINE__) | |
1071 | ||
1072 | #ifdef DQS_COMPILE_DEBUG | |
1073 | ||
1074 | #define DENTER_MAIN(x) \ | |
1075 | int LOG_LEVEL=LOG_DEBUG,DQS_OINDENT; \ | |
1076 | string DQS_FUNC,DQS_EVENT,ACK_EVENT; \ | |
1077 | dqs_list_type LISTEL; \ | |
1078 | bzero((char *)&conf,sizeof(conf)); \ | |
1079 | bzero((char *)&me,sizeof(me)); \ | |
1080 | conf.logfacility=LOGFACILITY; \ | |
1081 | DQS_FUNC[0]=0;\ | |
1082 | dqs_mini_setup(argv[0]); \ | |
1083 | if (getenv("EXT_DEBUG")) \ | |
1084 | {DEBUG_LOGLEVEL=LOG_EXTDEBUG;DEBUG_ON=TRUE;} \ | |
1085 | else if (getenv("DEBUG")) \ | |
1086 | {DEBUG_LOGLEVEL=LOG_DEBUG;DEBUG_ON=TRUE;} \ | |
1087 | else \ | |
1088 | DEBUG_LOGLEVEL=0; \ | |
1089 | if (DEBUG_ON)\ | |
1090 | {\ | |
1091 | strcpy x;\ | |
1092 | strcpy(DQS_FUNC,DQS_EVENT);\ | |
1093 | DQS_OINDENT=DEBUG_INDENT;\ | |
1094 | DEBUG_INDENT+=8;\ | |
1095 | sprintf(DQS_EVENT,"--> %s()",DQS_FUNC);\ | |
1096 | dqs_log(LOG_LEVEL,DQS_EVENT,__FILE__,DQS_FUNC,__LINE__);\ | |
1097 | } | |
1098 | ||
1099 | #define DENTER(x)\ | |
1100 | int LOG_LEVEL=LOG_DEBUG,DQS_OINDENT; \ | |
1101 | string DQS_FUNC,DQS_EVENT,ACK_EVENT; \ | |
1102 | dqs_list_type LISTEL; \ | |
1103 | DQS_FUNC[0]=0;\ | |
1104 | if (EXT_DEBUG_ON|DEBUG_ON)\ | |
1105 | {\ | |
1106 | strcpy x;\ | |
1107 | strcpy(DQS_FUNC,DQS_EVENT);\ | |
1108 | DQS_OINDENT=DEBUG_INDENT;\ | |
1109 | DEBUG_INDENT+=8;\ | |
1110 | sprintf(DQS_EVENT,"--> %s()",DQS_FUNC);\ | |
1111 | dqs_log(LOG_LEVEL,DQS_EVENT,__FILE__,DQS_FUNC,__LINE__);\ | |
1112 | } | |
1113 | ||
1114 | #define DENTER_EXT(x)\ | |
1115 | int LOG_LEVEL=LOG_EXTDEBUG,DQS_OINDENT; \ | |
1116 | string DQS_FUNC,DQS_EVENT,ACK_EVENT; \ | |
1117 | dqs_list_type LISTEL; \ | |
1118 | DQS_FUNC[0]=0;\ | |
1119 | if (EXT_DEBUG_ON|DEBUG_ON)\ | |
1120 | {\ | |
1121 | strcpy x;\ | |
1122 | strcpy(DQS_FUNC,DQS_EVENT);\ | |
1123 | DQS_OINDENT=DEBUG_INDENT;\ | |
1124 | DEBUG_INDENT+=8; \ | |
1125 | sprintf(DQS_EVENT,"--> %s()",DQS_FUNC);\ | |
1126 | dqs_log(LOG_LEVEL,DQS_EVENT,__FILE__,DQS_FUNC,__LINE__);\ | |
1127 | } | |
1128 | ||
1129 | #define DPRINTF(x)\ | |
1130 | if (DEBUG_ON)\ | |
1131 | {\ | |
1132 | sprintf x;\ | |
1133 | dqs_log(LOG_LEVEL,DQS_EVENT,__FILE__,DQS_FUNC,__LINE__);\ | |
1134 | } | |
1135 | ||
1136 | #define DTRACE\ | |
1137 | if (DEBUG_ON)\ | |
1138 | {\ | |
1139 | sprintf(DQS_EVENT,"TRACE");\ | |
1140 | dqs_log(LOG_LEVEL,DQS_EVENT,__FILE__,DQS_FUNC,__LINE__);\ | |
1141 | } | |
1142 | ||
1143 | #define DTRACEE\ | |
1144 | if (1)\ | |
1145 | {\ | |
1146 | sprintf(DQS_EVENT,"TRACE");\ | |
1147 | dqs_log(LOG_ERR,DQS_EVENT,__FILE__,DQS_FUNC,__LINE__);\ | |
1148 | } | |
1149 | ||
1150 | #define ACK(x)\ | |
1151 | sprintf x;\ | |
1152 | bzero((char *)&LISTEL,sizeof(LISTEL));\ | |
1153 | LISTEL.status=DQS_ACK;\ | |
1154 | LISTEL.str0=dqs_string_insert(NULL,ACK_EVENT);\ | |
1155 | reply_head=dqs_insert(DQS_STR0,TAIL,reply_head,&LISTEL); | |
1156 | ||
1157 | #define NAK(x)\ | |
1158 | sprintf x;\ | |
1159 | bzero((char *)&LISTEL,sizeof(LISTEL));\ | |
1160 | LISTEL.status=DQS_NAK;\ | |
1161 | LISTEL.str0=dqs_string_insert(NULL,ACK_EVENT);\ | |
1162 | reply_head=dqs_insert(DQS_STR0,TAIL,reply_head,&LISTEL); | |
1163 | ||
1164 | #define DEXIT\ | |
1165 | if (DEBUG_ON)\ | |
1166 | {\ | |
1167 | sprintf(DQS_EVENT,"<-- %s()",DQS_FUNC);\ | |
1168 | dqs_log(LOG_LEVEL,DQS_EVENT,__FILE__,DQS_FUNC,__LINE__);\ | |
1169 | DEBUG_INDENT=DQS_OINDENT;\ | |
1170 | } | |
1171 | ||
1172 | #define DEXITE\ | |
1173 | if (DEBUG_ON)\ | |
1174 | {\ | |
1175 | sprintf(DQS_EVENT,"<-- %s() *** ERROR ***",DQS_FUNC);dqs_log(LOG_LEVEL,DQS_EVENT,__FILE__,DQS_FUNC,__LINE__);\ | |
1176 | DEBUG_INDENT=DQS_OINDENT;\ | |
1177 | } | |
1178 | ||
1179 | #else | |
1180 | #define DENTER(x) {} | |
1181 | #define DTRACE {} | |
1182 | #define DPRINTF(x){} | |
1183 | #define DEXIT {} | |
1184 | #endif | |
1185 | ||
1186 | ||
1187 | #if defined(_AIX) || defined(SVR3) | |
1188 | #define DQS_ASSERT(x) if x ; else {dqs_log(LOG_CRIT, # x ,__FILE__,DQS_FUNC,__LINE__);dqs_log(LOG_CRIT,"unrecoverable error - contact systems manager",__FILE__,DQS_FUNC,__LINE__);abort();} | |
1189 | #else | |
1190 | #define DQS_ASSERT(x) if x ; else {dqs_log(LOG_CRIT,"unrecoverable error - contact systems manager",__FILE__,DQS_FUNC,__LINE__);abort();} | |
1191 | #endif | |
1192 | ||
1193 | #define DQS_EXIT(x)\ | |
1194 | if (x==DQS_ACK)\ | |
1195 | exit(0);\ | |
1196 | else\ | |
1197 | exit(-1); | |
1198 | ||
1199 | /******************************************************************************/ | |
1200 | /* misc flags/attribute defines */ | |
1201 | ||
1202 | #define NO_OPT 0 | |
1203 | #define a_OPT 1 | |
1204 | #define A_OPT 2 | |
1205 | #define B_OPT 3 | |
1206 | #define c_OPT 4 | |
1207 | #define cell_OPT 5 | |
1208 | #define C_OPT 6 | |
1209 | #define e_OPT 7 | |
1210 | #define par_OPT 8 | |
1211 | #define E_OPT 9 | |
1212 | #define f_OPT 10 | |
1213 | #define h_OPT 11 | |
1214 | #define hard_OPT 12 | |
1215 | #define j_OPT 13 | |
1216 | #define k_OPT 14 | |
1217 | #define l_OPT 15 | |
1218 | #define m_OPT 16 | |
1219 | #define master_OPT 17 | |
1220 | #define M_OPT 18 | |
1221 | #define N_OPT 19 | |
1222 | #define o_OPT 20 | |
1223 | #define O_OPT 21 | |
1224 | #define p_OPT 22 | |
1225 | #define q_OPT 23 | |
1226 | #define Q_OPT 24 | |
1227 | #define r_OPT 25 | |
1228 | #define s_OPT 26 | |
1229 | #define soft_OPT 27 | |
1230 | #define S_OPT 28 | |
1231 | #define u_OPT 29 | |
1232 | #define v_OPT 30 | |
1233 | #define verify_OPT 31 | |
1234 | #define V_OPT 32 | |
1235 | #define z_OPT 33 | |
1236 | #define DESTIN_OPR 34 | |
1237 | #define JOB_ID_OPR 35 | |
1238 | #define MESSAGE_OPR 36 | |
1239 | #define SCRIPT_OPR 37 | |
1240 | #define SRVR_NM_OPR 38 | |
1241 | #define soc_OPT 39 | |
1242 | #define xsoc_OPT 40 | |
1243 | #define help_OPT 41 | |
1244 | #define cwd_OPT 42 | |
1245 | #define ext_OPT 43 | |
1246 | #define ul_OPT 44 | |
1247 | #define reauth_OPT 45 | |
1248 | #define notify_OPT 46 | |
1249 | #define passwd_OPT 47 | |
1250 | #define Passwd_OPT 48 | |
1251 | #define d_OPT 49 | |
1252 | #define us_OPT 50 | |
1253 | #define hold_jid_OPT 51 | |
1254 | ||
1255 | #define ac_OPT 101 | |
1256 | #define ah_OPT 102 | |
1257 | #define am_OPT 103 | |
1258 | #define ao_OPT 104 | |
1259 | #define aq_OPT 105 | |
1260 | #define au_OPT 106 | |
1261 | #define Aq_OPT 107 | |
1262 | #define cq_OPT 108 | |
1263 | #define dc_OPT 109 | |
1264 | #define dh_OPT 110 | |
1265 | #define dm_OPT 111 | |
1266 | #define do_OPT 112 | |
1267 | #define dq_OPT 113 | |
1268 | #define du_OPT 114 | |
1269 | #define kq_OPT 115 | |
1270 | #define kqs_OPT 116 | |
1271 | #define mc_OPT 117 | |
1272 | #define mconf_OPT 118 | |
1273 | #define mq_OPT 119 | |
1274 | #define qmon_OPT 120 | |
1275 | #define sc_OPT 121 | |
1276 | #define scl_OPT 122 | |
1277 | #define sconf_OPT 123 | |
1278 | #define sh_OPT 124 | |
1279 | #define sm_OPT 125 | |
1280 | #define so_OPT 126 | |
1281 | #define sq_OPT 127 | |
1282 | #define sql_OPT 128 | |
1283 | #define su_OPT 129 | |
1284 | #define sul_OPT 130 | |
1285 | #define srl_OPT 131 | |
1286 | #define jid_OPT 132 | |
1287 | #define clean_OPT 133 | |
1288 | #define gc_OPT 134 /* dummy from qconf to qmasster to get complex */ | |
1289 | #define acons_OPT 135 /* add consumable */ | |
1290 | #define mcons_OPT 136 /* modify consumable */ | |
1291 | #define dcons_OPT 137 /* delete consumable */ | |
1292 | #define scons_OPT 138 | |
1293 | #define sconsl_OPT 139 | |
1294 | #define gcons_OPT 140 | |
1295 | #define refr_OPT 141 /* refresh dqs_execd */ | |
1296 | #define shutd_OPT 142 /* shutdown dqs_execd */ | |
1297 | #define rc_OPT 143 /* return consumable */ | |
1298 | #define F_OPT 144 /* force submission of a job (qsub ) */ | |
1299 | #define g_OPT 145 /* geometry option */ | |
1300 | /* who */ | |
1301 | #define QALTER 1 | |
1302 | #define QCONF 2 | |
1303 | #define QDEL 3 | |
1304 | #define QHOLD 4 | |
1305 | #define QIDLE 5 | |
1306 | #define QMASTER 6 | |
1307 | #define QMOD 7 | |
1308 | #define QMOVE 8 | |
1309 | #define QMSG 9 | |
1310 | #define QRERUN 10 | |
1311 | #define QRLS 11 | |
1312 | #define QSELECT 12 | |
1313 | #define QSH 13 | |
1314 | #define QSIG 14 | |
1315 | #define QSTAT 15 | |
1316 | #define QSUB 16 | |
1317 | #define DQS_EXECD 17 | |
1318 | #define MAX_ANCILLARY 17 | |
1319 | #define ALL_OPT 19 | |
1320 | ||
1321 | /* Note: do not include QUSAGE before ALL_OPT! */ | |
1322 | /* ALL_OPT is used by "dqs_options" while "qusage" */ | |
1323 | /* is part of "XSRC" */ | |
1324 | ||
1325 | #define QUSAGE 20 | |
1326 | #define DCMD 21 | |
1327 | #define DSH 22 | |
1328 | ||
1329 | /* macros used in parsing */ | |
1330 | #define VALID_OPT(opt,who) (dqs_options[opt][who]) | |
1331 | ||
1332 | /****************************************************************/ | |
1333 | /* DQS list types */ | |
1334 | ||
1335 | #define DQS_TYPE 0x00000001 | |
1336 | #define DQS_INT0 0x00000002 | |
1337 | #define DQS_INT1 0x00000004 | |
1338 | #define DQS_INT2 0x00000010 | |
1339 | #define DQS_INT3 0x00000020 | |
1340 | #define DQS_STR0 0x00000040 | |
1341 | #define DQS_STR1 0x00000100 | |
1342 | #define DQS_STR2 0x00000200 | |
1343 | #define DQS_STR3 0x00000400 | |
1344 | #define DQS_RUSAGE 0x00001000 | |
1345 | #define DQS_QUEUE 0x00002000 | |
1346 | #define DQS_CONF 0x00004000 | |
1347 | #define DQS_JOB 0x00010000 | |
1348 | #define DQS_ME 0x00020000 | |
1349 | #define DQS_CHAIN 0x00040000 | |
1350 | ||
1351 | #define DQS_STDIN 0x00100000 | |
1352 | #define DQS_STDOUT 0x00200000 | |
1353 | #define DQS_STDERR 0x00400000 | |
1354 | #define DQS_DEBUG 0x01000000 | |
1355 | #define DQS_HOSTS 0x02000000 | |
1356 | #define DQS_SHELL 0x04000000 | |
1357 | #define DQS_ACCOUNT 0x10000000 | |
1358 | #define DQS_PAR_STDOUT 0x20000000 | |
1359 | #define DQS_PAR_STDERR 0x40000000 | |
1360 | ||
1361 | /*patch from Ron Lee*/ | |
1362 | #define VALID(a,b) ((a)&(b)) | |
1363 | #define SETBIT(a,b) ((b)=(a)|(b)); | |
1364 | #define CLEARBIT(a,b) ((b)=~(a)&(b)); | |
1365 | ||
1366 | ||
1367 | /****************************************************************/ | |
1368 | /* DQS "op" types */ | |
1369 | ||
1370 | #define EQ_OP 0x00000001 | |
1371 | #define GE_OP 0x00000002 | |
1372 | #define GT_OP 0x00000004 | |
1373 | #define LT_OP 0x00000008 | |
1374 | #define LE_OP 0x00000010 | |
1375 | #define NE_OP 0x00000020 | |
1376 | #define NOT_OP 0x00000040 | |
1377 | #define AND_OP 0x00000080 | |
1378 | #define OR_OP 0x00000100 | |
1379 | #define STREQ_OP 0x00000200 | |
1380 | #define END_OP 0x00001000 | |
1381 | /****************************************************************/ | |
1382 | /* misc */ | |
1383 | ||
1384 | #define GRANTED 0 | |
1385 | #define REAPED 3 | |
1386 | #define SLAVE 1 | |
1387 | #define MIN_BACKOFF_TIME 2 | |
1388 | #define MAX_BACKOFF_TIME 10 | |
1389 | #define ABORT -1 | |
1390 | #define NEGATE_CLASS '^' | |
1391 | /*Code via Doug Gibson*/ | |
1392 | #define TOKEN_SIZE 2048 | |
1393 | #define MAX_KEY_SIZE 100 | |
1394 | #define DQS_NRETRIES 3 | |
1395 | #define MAX_KLOG_TIME 15 | |
1396 | #define DQS_MAXNAMELEN MAX_STRING_SIZE /* Max str length allowed in dsh/dshd */ | |
1397 | #define MAX_RLIMIT 0x7fffffff | |
1398 | ||
1399 | /****************************************************************/ | |
1400 | /* DQS Format Macros */ | |
1401 | ||
1402 | #define STATFILE_FPRINTF_FORMAT "%d:%s:%s:%d:%d:%d:%s:%s\n" | |
1403 | ||
1404 | #define STATFILE_FSCANF_FORMAT "\n%d:%[^:]:%[^:]:%d:%d:%d:%[^:]:%[^:\n]" | |
1405 | ||
1406 | #define STATFILE_FSCANF_COUNT 8 | |
1407 | ||
1408 | #define STATFILE_FSCANF_VARS \ | |
1409 | &Stats->time, \ | |
1410 | Stats->qname, \ | |
1411 | Stats->hostname, \ | |
1412 | &Stats->load_avg, \ | |
1413 | &Stats->qty, \ | |
1414 | &Stats->qty_active, \ | |
1415 | qcomplex_str, \ | |
1416 | Stats->states | |
1417 | ||
1418 | #define ACTFILE_FPRINTF_FORMAT \ | |
1419 | "%s:%s:%ld:%s:%s:%s:%s:%s:%s:%ld:%ld:%ld:%ld:%ld:%ld:%ld:%ld:%ld:%ld:%ld:%ld:%ld:%ld:%ld:%ld:%ld:%ld:%ld:%ld:%ld:%ld:%ld:%ld\n" | |
1420 | ||
1421 | #define ACTFILE_FSCANF_FORMAT \ | |
1422 | "\n%[^:]:%[^:]:%ld:%[^:]:%[^:]:%[^:]:%[^:]:%[^:]:%[^:]:%ld:%ld:%ld:%ld:%ld:%ld:%ld:%ld:%ld:%ld:%ld:%ld:%ld:%ld:%ld:%ld:%ld:%ld:%ld:%ld:%ld:%ld:%ld:%ld" | |
1423 | ||
1424 | #define ACTFILE_FSCANF_COUNT 33 | |
1425 | ||
1426 | #define ACTFILE_FPRINTF_VARS \ | |
1427 | d->qname, \ | |
1428 | d->hostname, \ | |
1429 | d->master, \ | |
1430 | qcomplex_str, \ | |
1431 | d->group, \ | |
1432 | d->owner, \ | |
1433 | d->job_name, \ | |
1434 | d->dqs_job_name, \ | |
1435 | d->account, \ | |
1436 | d->priority, \ | |
1437 | d->job_number, \ | |
1438 | d->submission_time, \ | |
1439 | d->start_time, \ | |
1440 | d->end_time, \ | |
1441 | d->exit_status, \ | |
1442 | d->ru_wallclock, \ | |
1443 | d->ru_utime, \ | |
1444 | d->ru_stime, \ | |
1445 | d->ru_maxrss, \ | |
1446 | d->ru_ixrss, \ | |
1447 | d->ru_ismrss, \ | |
1448 | d->ru_idrss, \ | |
1449 | d->ru_isrss, \ | |
1450 | d->ru_minflt, \ | |
1451 | d->ru_majflt, \ | |
1452 | d->ru_nswap, \ | |
1453 | d->ru_inblock, \ | |
1454 | d->ru_oublock, \ | |
1455 | d->ru_msgsnd, \ | |
1456 | d->ru_msgrcv, \ | |
1457 | d->ru_nsignals, \ | |
1458 | d->ru_nvcsw, \ | |
1459 | d->ru_nivcsw | |
1460 | ||
1461 | #define ACTFILE_FSCANF_VARS \ | |
1462 | d->qname, \ | |
1463 | d->hostname, \ | |
1464 | &d->master, \ | |
1465 | qcomplex_str, \ | |
1466 | d->group, \ | |
1467 | d->owner, \ | |
1468 | d->job_name, \ | |
1469 | d->dqs_job_name, \ | |
1470 | d->account, \ | |
1471 | &d->priority, \ | |
1472 | &d->job_number, \ | |
1473 | &d->submission_time, \ | |
1474 | &d->start_time, \ | |
1475 | &d->end_time, \ | |
1476 | &d->exit_status, \ | |
1477 | &d->ru_wallclock, \ | |
1478 | &d->ru_utime, \ | |
1479 | &d->ru_stime, \ | |
1480 | &d->ru_maxrss, \ | |
1481 | &d->ru_ixrss, \ | |
1482 | &d->ru_ismrss, \ | |
1483 | &d->ru_idrss, \ | |
1484 | &d->ru_isrss, \ | |
1485 | &d->ru_minflt, \ | |
1486 | &d->ru_majflt, \ | |
1487 | &d->ru_nswap, \ | |
1488 | &d->ru_inblock, \ | |
1489 | &d->ru_oublock, \ | |
1490 | &d->ru_msgsnd, \ | |
1491 | &d->ru_msgrcv, \ | |
1492 | &d->ru_nsignals, \ | |
1493 | &d->ru_nvcsw, \ | |
1494 | &d->ru_nivcsw | |
1495 | ||
1496 | /****************************************************************/ | |
1497 | /* DQS Development Macros */ | |
1498 | ||
1499 | #define GETFD(a) close(creat("RMME",0755));a=open("RMME",O_RDWR) | |
1500 | ||
1501 | #define RESETFD(a) lseek(a,0,SEEK_SET) | |
1502 | ||
1503 | #if (defined(sun) || defined(solaris) || defined(SOLARIS23_UP)) | |
1504 | #define volatile /* comment this out if a real compiler */ | |
1505 | #define labs abs /* ditto - way to go SUN! */ | |
1506 | #endif | |
1507 | ||
1508 | #ifdef NeXT | |
1509 | #define sigaction sigvec | |
1510 | #define sa_handler sv_handler | |
1511 | #define sa_mask sv_mask | |
1512 | #define sa_flags sv_flags | |
1513 | #define sigset_t int | |
1514 | #endif | |
1515 | ||
1516 | #ifndef pid_t | |
1517 | #define pid_t int | |
1518 | #endif | |
1519 | ||
1520 | #ifndef gid_t | |
1521 | #define gid_t int | |
1522 | #endif | |
1523 | ||
1524 | #ifndef mode_t | |
1525 | #define mode_t int | |
1526 | #endif | |
1527 | ||
1528 | /* | |
1529 | this isn't the way to do it but since I've yet to figure out | |
1530 | how you are suppose to differentiate SunOS 4/5... | |
1531 | ||
1532 | course the SunPro demo compiler I saw doesn't define "__svr4__" | |
1533 | ||
1534 | funny how it only takes a hour to port to every other arc, | |
1535 | (all totalled!) then you spend days porting to SunOSes | |
1536 | */ | |
1537 | ||
1538 | #ifdef __svr4__ | |
1539 | #ifdef sun | |
1540 | #define sloaris | |
1541 | #endif | |
1542 | #endif |