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