1 static char def_rcsid[]="$Id$";
3 /*----------------------------------------------------
4 * def.h Tom Green Mon Jan 31 10:44:27 1994
8 * SUPER COMPUTER COMPUTATIONS RESEARCH INSTITUTE
9 * FLORIDA STATE UNIVERSITY
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
18 * Revision 1.1 2001/03/19 20:45:31 dobrek
19 * -3f2839b879f378e29cfee71b2738b8ec DQS-3.3.1.tgz
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
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.
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
36 * Revision 1.5 1999/04/30 14:50:52 green
37 * support for changing from hex to base10 for queue configurations
39 * Revision 1.4 1998/10/26 19:24:09 green
40 * use the DQS_EXIT macro to determine exit value of ancillaries
42 * Revision 1.3 1998/10/21 14:42:52 green
43 * Red Hat Alpha Port - ADDRLEN incorporated
44 * SETPGRP/GETPGRP macros redefined
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...
49 * Revision 1.1.1.1 1998/08/18 14:39:10 green
50 * DQS 3.2.0.5 WIP Import
52 * Revision 1.5 1997/10/21 15:51:19 decker
53 * Expanded MAX_STRING_SIZE and TOKEN_SIZE to 2048
55 * Revision 1.4 1997/09/04 16:39:05 decker
56 * Ron Lee's Patch for VALID,SETBIT,CLEARBIT added
58 * Revision 1.3 1997/08/08 15:17:14 decker
59 * Added David Geldreich Patch:
61 * Revision 1.2 1997/04/10 21:51:49 green
62 * added def for rindex
64 * Revision 1.1.1.1 1997/04/10 15:10:31 green
65 * DQS 3.1.3.4.1 Distribution
67 * Revision 3.60 1996/08/26 14:20:45 nrl
68 * Incorporated SCRI scheduling changes
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.
74 * Revision 3.58 1996/07/09 19:53:12 nrl
75 * Added SOLARIS2.5 parameters
77 * Revision 3.57 1996/06/27 01:55:37 nrl
78 * changes to accomodate osf gcc
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.
84 * Revision 3.54 1996/06/26 14:03:19 nrl
85 * Added pvmcleanup.sh to install.. added osf2.3 detection
87 * Revision 3.53 1996/06/17 02:28:36 nrl
88 * Updtaes from Guntram Wolski, Ron Lee, John Makosky and
91 * Revision 3.52 1996/04/01 21:35:38 nrl
92 * removed absolte path from DEBUG313,txt file name
94 * Revision 3.51 1996/03/25 16:28:26 nrl
95 * Repaired parameter scanning for qidle
97 * Revision 3.50 1996/03/21 17:06:37 nrl
98 * added fortran and "c" syntax to resource requests
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
104 * Revision 3.48 1996/03/17 00:57:28 nrl
105 * merge in qsub prevalidation scheme and consumable restoration
107 * Revision 3.47 1996/03/14 03:15:57 nrl
108 * merge in subordinate queues and consumable resource changes
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
115 * Revision 3.45 1996/02/07 13:07:37 nrl
116 * Added "process leader" and TMP_FILES link capability
118 * Revision 3.44 1996/01/19 20:58:36 nrl
119 * merged SCRI code and new job and queue structure changes
121 * Revision 3.43 1995/10/23 18:51:37 nrl
122 * Added fix for setpgrp (once more) for Solaris 2.4, recommended by
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.
130 * Revision 3.41 1995/07/12 18:47:48 nrl
131 * Fixed numerous problmes with Irix 5.3 and 6.0 systems
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.
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
143 * Revision 3.38 1995/06/15 17:20:51 nrl
144 * Mike Iglesias solved the setpriority problem on OSF platforms
146 * Revision 3.37 1995/06/15 14:20:54 nrl
147 * changed SETPGRP for OSF systems to use setpgid
149 * Revision 3.36 1995/06/13 12:06:11 nrl
150 * Updated count of variables for fscanf testing
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
156 * Revision 3.34 1995/05/28 16:44:35 nrl
157 * Fixes for solaris2.3 and solaris 2.4 and mailer default recipients
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
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.
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.
172 * Revision 3.30 1995/02/20 01:02:59 nrl
173 * corrected SUN changes for bcmp,bcopy and bzero
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
179 * Revision 3.28 1995/02/17 02:56:51 nrl
180 * Added formal skeletons for PVM and TCGMSG parallel modes
182 * Revision 3.27 1995/02/09 12:48:57 nrl
183 * Added "delete complex" and "modify complex"
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.
189 * Revision 3.25 1995/01/17 16:31:57 nrl
190 * completed mailer feature
192 * Revision 3.24 1994/11/14 13:56:36 green
195 * < #define SETPRIORITY(niceval) nice(GETPGRP,niceval)
197 * > #define SETPRIORITY(niceval) nice(niceval)
198 * --------------------------------------------------------------------
200 * Revision 3.23 1994/08/02 23:11:05 green
201 * added support for a crude job staging mechanism
203 * Revision 3.22 1994/07/05 14:22:27 green
204 * added James MacKinnon's NeXT ports
206 * Revision 3.21 1994/06/12 23:18:00 green
209 * Revision 3.20 1994/06/12 21:04:56 green
210 * expanded DQS_MAXNAMELEN to MAX_STRING_SIZE in def.h
212 * utilize DQS_MAXNAMELEN for command size in dqs_dshd.c
214 * Revision 3.19 1994/06/09 18:38:20 green
215 * had some problems with nonre-entrant gethostbyX in dqs_sec.c - fixed
217 * #def overload for "GENERIC" in def.h - fixed
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
224 * pulled out some sloaris #defs - maybe one day SUN will ship me my
227 * Revision 3.17 1994/06/08 17:48:00 green
228 * added P4 support(with the help of Ralph Butler - Thanks Ralph!)
230 * backed down to Rev. 3.3 of dqs_check_to_do_list.c
232 * Revision 3.16 1994/06/07 16:45:37 green
233 * more "sloaris" porting...
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
239 * added dqs_read_stats() to dqs_ck_to_do_list.c
241 * Revision 3.14 1994/06/06 01:23:01 green
242 * added "dqs_dshd_service" to the DQS config
244 * add "-par pvm" - though we do NOT intend to support it
245 * (see dqs_start_pvm.c for a more thorough discussion)
247 * Revision 3.13 1994/06/04 15:24:28 green
248 * added "-par parallel_packge" support
250 * Revision 3.12 1994/06/04 14:49:41 green
251 * added necessary P4/MPI defs
253 * Revision 3.11 1994/06/02 13:44:26 green
254 * attempt to port to Sloaris...
255 * Work In Progress(WIPed)
257 * Revision 3.10 1994/05/31 12:23:32 green
258 * modified #define for GETPGRP such that __osf__ doesn't utilize args
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
264 * removed "#include "h.h"" in defined.c
266 * yanked ANSI prototyping in dsh.c/dshd.c as some(sic) C compilers can't
269 * #ifdef'ed fcntl(F_SETOWN) out for HPUX in dsh.c as HPUX doesn't define
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
276 * Revision 3.8 1994/05/31 10:30:36 green
277 * some OSes define NCARGS, some don't - handle with ifndef...
279 * Revision 3.7 1994/05/31 00:52:40 green
280 * added dsh.c dshd.c to Makefile.proto
282 * added MAXNAMELEN and NCARGS to def.h
284 * type casting in dqs_reauth.c, dqs_sec.c, dqs_setup.c to hush gcc
287 * added jmp_buf to globals.h, changed Revision number in globals.h
289 * added dsh and dshd tp prognames.h
291 * Revision 3.6 1994/05/30 23:56:16 green
292 * added necessary defs for DCMD/DSH to def.h
294 * added notes on necessary hooks to dqs_execd.c reqd for direct execing
297 * added "#include <setjmp.h>" to h.h
299 * Revision 3.5 1994/05/04 17:54:53 green
300 * added FreeBSD support(Pedro A M Vazquez)
302 * Revision 3.4 1994/04/01 02:59:28 green
303 * added "qalter" support
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
309 * dqs_list.c:dqs_insert(TAIL) had a bug wheninserting to a NULL head
311 * may "Last Minute Hack" to dqs_list.c:dqs_showlist() really screwed up
312 * some things - yanked...
314 * Revision 3.2 1994/03/26 16:33:33 green
315 * added "-srl" support.
317 * dqs_resolve.c:dqs_read_resolve_file() now returns the primary qmaster
318 * name for fields marked as "none"
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"
323 * write generic queue configuration in common_dir
325 * Revision 3.0 1994/03/07 04:13:02 green
328 * Revision 1.8 1994/02/25 23:13:17 green
329 * added "PID_FILE" to def.h to log process id.
331 * modified dqs_execd.c and qmaster.c to log pids to a file
333 * added dqs_log_pid() to dqs_utility.c
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.
340 * Revision 1.7 1994/02/24 01:10:01 green
341 * added default compile flags in Makefile.proto
343 * modified GETPGRP() and SETPGRP() in def.h for IRIX 5.1.1.1 support
345 * changed "st_mtime" to "st_m_time" in dqs_reauth.cand dqs_sec.c
346 * for IRIX 5.1.1.1 support
348 * Revision 1.6 1994/02/23 16:19:16 green
349 * added "QUSAGE" to def.h
351 * Revision 1.5 1994/02/17 14:48:57 green
352 * added MAX_KLOG_TIME to def.h
354 * added some strategic dqs_set_coresize_2_0() as CYAs
356 * nuked some dqs_set_coresize_back_normal()
358 * dinked with ALRM handlers for "robustness"
360 * NOTE: HPUX does not support core limit size --- sad...
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
365 * fixed "-Passwd passwd_file" option
367 * Revision 1.3 1994/02/09 19:47:58 green
368 * syncing source with docs
370 * Revision 1.2 1994/02/02 20:22:05 green
371 * cleaned up "qconf.c" to sync with docs
373 * Revision 1.1.1.1 1994/02/01 17:57:36 green
376 *--------------------------------------------------*/
389 /* DQS_COMPILE_DEBUG inserts debugging macros
390 * LEAVE THEM IN!(or don't call if ya need help)
393 #define DQS_COMPILE_DEBUG
394 #define DEBUG_FILE stderr
396 #define DEFAULT_EDITOR "vi"
397 #define DQS_MAX_FD 600
398 #define MAX_SEQNUM 999999
399 #define MAX_PATH 2048
401 /*********************************************************/
404 #define u_long32 u_int
406 #define u_long32 u_long
409 /*********************************************************/
413 /* Batch Services Summary */
415 #define JOB_EXECUTION 300
416 #define JOB_ROUTING 301
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
437 #define STARTING_UP 321 /* NOT PART OF P1003.15D12! */
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 */
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
452 #define MAIL_TO_ADMINISTRATOR 007
458 /********************************************************************************/
459 /************ scheduling constants *****************************************/
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
468 #define PRIORITY_MASK 0xffff00
469 #define SUBPRIORITY_MASK 0x0000ff
471 #define JOBS_SCANNED_PER_PASS 4000
472 /********************************************************************************/
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 */
479 #define LOG_EXTDEBUG LOG_DEBUG+1
481 /********************************************************************************/
484 #define ASCENDING 600
485 #define DESCENDING 601
489 /********************************************************************************/
491 /* Shell strategies */
493 #define DQS_FIXED_SHELL 700
494 #define DQS_FLOATING_SHELL 701
496 /********************************************************************************/
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
533 /********************************************************************************/
534 /* Symbolic Constants */
538 #define NONE 0x00000000
539 #define ALL 0x77777777
541 /* Checkpoint/Restart Constants */
542 /* use dqs_show_checkpoint() */
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
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
561 #define USER 0x000000080
563 /* Job/Queue State Constants */
564 /* use dqs_show_states() */
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
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
605 /* Mail Option Constants */
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
618 /********************************************************************************/
620 /* User access declarations */
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 */
627 /*******************************************************************************/
628 /* conf file definitions */
629 #define LEAVE_OUTPUT_FILES 800
630 #define COPY_OUTPUT_FILES 801
631 #define LINK_OUTPUT_FILES 802
633 /********************************************************************************/
635 /* misc qsub/qsh stuff */
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 */
643 /* used by the parser */
652 #define GENERIC_SLA 3
653 #define GENERIC_ALL 4
656 /********************************************************************************/
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"
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"
684 /*********************************************************/
685 /*Code via Doug Gibson*/
686 #define MAX_STRING_SIZE 2048
688 #define INTSIZE 4 /* (4) 8 bit bytes */
690 #define INTOFF 4 /* big endian 64-bit machines where sizeof(int) = 8 */
692 #define INTOFF 0 /* the rest of the world; see comments in request.c */
695 #define MAX_DBE_SIZE 4096 /* max (key,content) size in bytes for ndbm(3) */
697 #define REQUESTSIZE 1024 /* BE CAREFUL */
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 */
704 #ifndef MAX_UNLINK_RETRIES
705 #define MAX_UNLINK_RETRIES 50 /* max number of unlink(2) retries */
708 #define CLEAR_EXECD_TIDS 10 /* how often to clear unreaped execd TIDs */
710 /*********************************************************/
711 /* Operating system-specific definitions */
712 /*********************************************************/
714 #if ( defined(SOLARIS23) || defined(SOLARIS24) || defined(SOLARIS25) || defined(SOLARIS26) || defined(SOLARIS27) )
715 #define SOLARIS23_UP TRUE
718 /* Extended sysconf(2) interface macros */
719 #ifdef _SC_EXIT_SIGHUP
720 #define EXIT_SIGHUP sysconf(_SC_EXIT_SIGHUP)
722 #define EXIT_SIGHUP FALSE
725 #define MAX_PROCESS_ID sysconf(_SC_PID_MAX)
727 #define MAX_PROCESS_ID MAXPID
730 #define MAX_USER_ID sysconf(_SC_UID_MAX)
732 #define MAX_USER_ID MAXUID
735 /* FLOCK - lock a file */
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)
741 #define FLOCK(x) flock(x,LOCK_EX)
742 #define FUNLOCK(x) flock(x,LOCK_UN)
746 /* GETPGRP - get a process group */
748 #if (defined(__sgi) || defined(__convex__) || defined(_AIX) || defined(i386) || defined (SVR3) || defined (__osf__) || defined(solaris)|| defined(SOLARIS23_UP) )
749 #define GETPGRP getpgrp()
751 #define GETPGRP getpgrp(getpid())
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()
758 #define SETPGRP setpgid(getpid(), GETPGRP)
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 */
764 #if ( defined(sun) && !(defined(solaris) || defined(SOLARIS23_UP) ))
766 #define SETPGRP setpgrp(0,getpid())
769 #if defined( __FreeBSD__)
771 #define SETPGRP setpgrp(getpid(),getpid())
773 /*This is a patch from David Geldreich*/
774 #if defined (__osf__)
776 #define SETPGRP setpgid(getpid(),getpid())
782 #define SETPGRP setpgrp()
783 #define GETPGRP getpgrp()
786 #if (defined( linux ) && defined(__alpha ) )
789 #define SETPGRP setpgrp()
790 #define GETPGRP getpgrp()
794 #define SETEUID(e1) setresuid (-1, e1, -1)
796 #define SETEUID(e1) seteuid ( e1 )
800 /* SETPRIORITY - set process priority */
801 #if (defined(solaris)||defined(SOLARIS23_UP))
802 #define SETPRIORITY(niceval) nice(niceval-nice(0))
805 #define SETPRIORITY(niceval) nice(niceval)
808 #define SETPRIORITY(niceval) nice(niceval)
811 #define SETPRIORITY(niceval) setpriority(PRIO_PGRP,GETPGRP,niceval)
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]
819 #define STRERROR strerror((int) errno)
822 #if (defined(_UNICOS) || defined(__hpux) || defined(solaris) || defined(SOLARIS23_UP))
823 #define RESOURCES tms
824 #define GETRUSAGE(loc) times(loc)
826 #define CLOCKTICK _SC_CLK_TCK
829 #if (defined(__hpux) || defined(solaris)|| defined(SOLARIS23_UP))
830 #define CLOCKTICK CLK_TCK;
833 #define RESOURCES rusage
834 #define GETRUSAGE(loc) getrusage(RUSAGE_CHILDREN,loc)
838 #if (defined( solaris) || defined(SOLARIS23_UP))
842 #define bcmp(s1, s2, n) memcmp ((s1), (s2), (n))
847 #define bcopy(s, d, n) memcpy ((d), (s), (n))
852 #define bzero(s, n) memset ((s), 0, (n))
857 #define index(s, c) strchr(s, c)
862 #define rindex(s, c) strrchr(s, c)
864 /* this is no longer used in solaris, but then we have no rusage-information */
868 #define wait3(s, o, r) waitpid(-1, s, o)
873 /* Directory structure definitions */
875 #if (defined(_AIX) || defined(__osf__) || defined(_UNICOS) || defined(sun) || defined(solaris) || defined(SOLARIS23_UP))
876 #define DIRENT dirent
877 struct dirent *readdir();
879 #define DIRENT direct
881 struct direct *readdir();
885 /* Temporary filename interface */
887 #define TEMPNAM tmpnam((char *)NULL)
890 #define TEMPNAM tempnam((char *)NULL,(char *)NULL)
894 #if (defined( linux ) && defined(__alpha ) )
895 #define ADDRLEN size_t
904 /*********************************************************/
905 /* Logging macros from hell */
906 /*********************************************************/
908 #define FREE(x) if(x){free( (char *)x); x=NULL;}
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
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;}
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;}
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;}
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;}
931 /* DON'T TOUCH THESE! */
933 #define OFFSET 16*NIBBLE
935 #define NIBBLE_SIZE(x) ((1+((x-1)/NIBBLE))*NIBBLE)
937 #define CHUNK_SIZE(x) ((1+((x-1)/CHUNK))*CHUNK)
939 #define PACK_MACRO_DEFS int STR_LEN;char STRING[MAX_STRING_SIZE];u_long32 J
942 PACKINT(head_ptr,cur_ptr,int,bytes_packed,mem_size);
945 #define PACKINT(a,b,c,d,e)\
952 CRITICAL((DQS_EVENT,"dqs_realloc() failure in PACKINT()"));\
959 bcopy(&J,b,INTSIZE);\
965 PACKSTR(head_ptr,cur_ptr,str,bytes_packed,mem_size);
969 #define PACKSTR(a,b,c,d,e)\
980 CRITICAL((DQS_EVENT,"dqs_realloc() failure in PACKSTR()"));\
986 if (c) bcopy(c,b,STR_LEN);\
987 else bcopy(&dqs_zero,b,STR_LEN); \
992 PACKBUF(head_ptr,cur_ptr,buf_ptr,buf_size,bytes_packed,mem_size);
995 #define PACKBUF(a,b,c,d,e,f)\
1002 CRITICAL((DQS_EVENT,"dqs_realloc() failure in PACKBUF()"));\
1014 UNPACKINT(cur_ptr,int,bytes_unpacked,bytes_packed);
1016 #define UNPACKINT(a,b,c,d)\
1019 CRITICAL((DQS_EVENT,"error in UNPACKINT()"));\
1022 bcopy(a,&b,INTSIZE);\
1029 UNPACKSTR(cur_ptr,str,bytes_unpacked,bytes_packed);
1031 #define UNPACKSTR(a,b,c,d)\
1032 if (!a[0]) STR_LEN=1; \
1039 CRITICAL((DQS_EVENT,"error in UNPACKSTR()"));\
1044 bcopy(a,STRING,STR_LEN);\
1045 b=dqs_string_insert(NULL,STRING); } \
1051 UNPACKBUF(cur_ptr,buf_ptr,buf_size,bytes_unpacked,bytes_packed);
1054 #define UNPACKBUF(a,b,c,d,e)\
1057 CRITICAL((DQS_EVENT,"error in UNPACKBUF()"));\
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__)
1072 #ifdef DQS_COMPILE_DEBUG
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; \
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;} \
1092 strcpy(DQS_FUNC,DQS_EVENT);\
1093 DQS_OINDENT=DEBUG_INDENT;\
1095 sprintf(DQS_EVENT,"--> %s()",DQS_FUNC);\
1096 dqs_log(LOG_LEVEL,DQS_EVENT,__FILE__,DQS_FUNC,__LINE__);\
1100 int LOG_LEVEL=LOG_DEBUG,DQS_OINDENT; \
1101 string DQS_FUNC,DQS_EVENT,ACK_EVENT; \
1102 dqs_list_type LISTEL; \
1104 if (EXT_DEBUG_ON|DEBUG_ON)\
1107 strcpy(DQS_FUNC,DQS_EVENT);\
1108 DQS_OINDENT=DEBUG_INDENT;\
1110 sprintf(DQS_EVENT,"--> %s()",DQS_FUNC);\
1111 dqs_log(LOG_LEVEL,DQS_EVENT,__FILE__,DQS_FUNC,__LINE__);\
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; \
1119 if (EXT_DEBUG_ON|DEBUG_ON)\
1122 strcpy(DQS_FUNC,DQS_EVENT);\
1123 DQS_OINDENT=DEBUG_INDENT;\
1125 sprintf(DQS_EVENT,"--> %s()",DQS_FUNC);\
1126 dqs_log(LOG_LEVEL,DQS_EVENT,__FILE__,DQS_FUNC,__LINE__);\
1133 dqs_log(LOG_LEVEL,DQS_EVENT,__FILE__,DQS_FUNC,__LINE__);\
1139 sprintf(DQS_EVENT,"TRACE");\
1140 dqs_log(LOG_LEVEL,DQS_EVENT,__FILE__,DQS_FUNC,__LINE__);\
1146 sprintf(DQS_EVENT,"TRACE");\
1147 dqs_log(LOG_ERR,DQS_EVENT,__FILE__,DQS_FUNC,__LINE__);\
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);
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);
1167 sprintf(DQS_EVENT,"<-- %s()",DQS_FUNC);\
1168 dqs_log(LOG_LEVEL,DQS_EVENT,__FILE__,DQS_FUNC,__LINE__);\
1169 DEBUG_INDENT=DQS_OINDENT;\
1175 sprintf(DQS_EVENT,"<-- %s() *** ERROR ***",DQS_FUNC);dqs_log(LOG_LEVEL,DQS_EVENT,__FILE__,DQS_FUNC,__LINE__);\
1176 DEBUG_INDENT=DQS_OINDENT;\
1180 #define DENTER(x) {}
1182 #define DPRINTF(x){}
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();}
1190 #define DQS_ASSERT(x) if x ; else {dqs_log(LOG_CRIT,"unrecoverable error - contact systems manager",__FILE__,DQS_FUNC,__LINE__);abort();}
1193 #define DQS_EXIT(x)\
1199 /******************************************************************************/
1200 /* misc flags/attribute defines */
1219 #define master_OPT 17
1233 #define verify_OPT 31
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
1247 #define reauth_OPT 45
1248 #define notify_OPT 46
1249 #define passwd_OPT 47
1250 #define Passwd_OPT 48
1253 #define hold_jid_OPT 51
1272 #define mconf_OPT 118
1274 #define qmon_OPT 120
1277 #define sconf_OPT 123
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 */
1317 #define DQS_EXECD 17
1318 #define MAX_ANCILLARY 17
1321 /* Note: do not include QUSAGE before ALL_OPT! */
1322 /* ALL_OPT is used by "dqs_options" while "qusage" */
1323 /* is part of "XSRC" */
1329 /* macros used in parsing */
1330 #define VALID_OPT(opt,who) (dqs_options[opt][who])
1332 /****************************************************************/
1333 /* DQS list types */
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
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
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));
1367 /****************************************************************/
1368 /* DQS "op" types */
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 /****************************************************************/
1387 #define MIN_BACKOFF_TIME 2
1388 #define MAX_BACKOFF_TIME 10
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
1399 /****************************************************************/
1400 /* DQS Format Macros */
1402 #define STATFILE_FPRINTF_FORMAT "%d:%s:%s:%d:%d:%d:%s:%s\n"
1404 #define STATFILE_FSCANF_FORMAT "\n%d:%[^:]:%[^:]:%d:%d:%d:%[^:]:%[^:\n]"
1406 #define STATFILE_FSCANF_COUNT 8
1408 #define STATFILE_FSCANF_VARS \
1414 &Stats->qty_active, \
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"
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"
1424 #define ACTFILE_FSCANF_COUNT 33
1426 #define ACTFILE_FPRINTF_VARS \
1438 d->submission_time, \
1461 #define ACTFILE_FSCANF_VARS \
1473 &d->submission_time, \
1496 /****************************************************************/
1497 /* DQS Development Macros */
1499 #define GETFD(a) close(creat("RMME",0755));a=open("RMME",O_RDWR)
1501 #define RESETFD(a) lseek(a,0,SEEK_SET)
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! */
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
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...
1532 course the SunPro demo compiler I saw doesn't define "__svr4__"
1534 funny how it only takes a hour to port to every other arc,
1535 (all totalled!) then you spend days porting to SunOSes