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.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
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.
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
32 * Revision 1.5 1999/04/30 14:50:52 green
33 * support for changing from hex to base10 for queue configurations
35 * Revision 1.4 1998/10/26 19:24:09 green
36 * use the DQS_EXIT macro to determine exit value of ancillaries
38 * Revision 1.3 1998/10/21 14:42:52 green
39 * Red Hat Alpha Port - ADDRLEN incorporated
40 * SETPGRP/GETPGRP macros redefined
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...
45 * Revision 1.1.1.1 1998/08/18 14:39:10 green
46 * DQS 3.2.0.5 WIP Import
48 * Revision 1.5 1997/10/21 15:51:19 decker
49 * Expanded MAX_STRING_SIZE and TOKEN_SIZE to 2048
51 * Revision 1.4 1997/09/04 16:39:05 decker
52 * Ron Lee's Patch for VALID,SETBIT,CLEARBIT added
54 * Revision 1.3 1997/08/08 15:17:14 decker
55 * Added David Geldreich Patch:
57 * Revision 1.2 1997/04/10 21:51:49 green
58 * added def for rindex
60 * Revision 1.1.1.1 1997/04/10 15:10:31 green
61 * DQS 3.1.3.4.1 Distribution
63 * Revision 3.60 1996/08/26 14:20:45 nrl
64 * Incorporated SCRI scheduling changes
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.
70 * Revision 3.58 1996/07/09 19:53:12 nrl
71 * Added SOLARIS2.5 parameters
73 * Revision 3.57 1996/06/27 01:55:37 nrl
74 * changes to accomodate osf gcc
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.
80 * Revision 3.54 1996/06/26 14:03:19 nrl
81 * Added pvmcleanup.sh to install.. added osf2.3 detection
83 * Revision 3.53 1996/06/17 02:28:36 nrl
84 * Updtaes from Guntram Wolski, Ron Lee, John Makosky and
87 * Revision 3.52 1996/04/01 21:35:38 nrl
88 * removed absolte path from DEBUG313,txt file name
90 * Revision 3.51 1996/03/25 16:28:26 nrl
91 * Repaired parameter scanning for qidle
93 * Revision 3.50 1996/03/21 17:06:37 nrl
94 * added fortran and "c" syntax to resource requests
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
100 * Revision 3.48 1996/03/17 00:57:28 nrl
101 * merge in qsub prevalidation scheme and consumable restoration
103 * Revision 3.47 1996/03/14 03:15:57 nrl
104 * merge in subordinate queues and consumable resource changes
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
111 * Revision 3.45 1996/02/07 13:07:37 nrl
112 * Added "process leader" and TMP_FILES link capability
114 * Revision 3.44 1996/01/19 20:58:36 nrl
115 * merged SCRI code and new job and queue structure changes
117 * Revision 3.43 1995/10/23 18:51:37 nrl
118 * Added fix for setpgrp (once more) for Solaris 2.4, recommended by
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.
126 * Revision 3.41 1995/07/12 18:47:48 nrl
127 * Fixed numerous problmes with Irix 5.3 and 6.0 systems
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.
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
139 * Revision 3.38 1995/06/15 17:20:51 nrl
140 * Mike Iglesias solved the setpriority problem on OSF platforms
142 * Revision 3.37 1995/06/15 14:20:54 nrl
143 * changed SETPGRP for OSF systems to use setpgid
145 * Revision 3.36 1995/06/13 12:06:11 nrl
146 * Updated count of variables for fscanf testing
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
152 * Revision 3.34 1995/05/28 16:44:35 nrl
153 * Fixes for solaris2.3 and solaris 2.4 and mailer default recipients
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
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.
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.
168 * Revision 3.30 1995/02/20 01:02:59 nrl
169 * corrected SUN changes for bcmp,bcopy and bzero
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
175 * Revision 3.28 1995/02/17 02:56:51 nrl
176 * Added formal skeletons for PVM and TCGMSG parallel modes
178 * Revision 3.27 1995/02/09 12:48:57 nrl
179 * Added "delete complex" and "modify complex"
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.
185 * Revision 3.25 1995/01/17 16:31:57 nrl
186 * completed mailer feature
188 * Revision 3.24 1994/11/14 13:56:36 green
191 * < #define SETPRIORITY(niceval) nice(GETPGRP,niceval)
193 * > #define SETPRIORITY(niceval) nice(niceval)
194 * --------------------------------------------------------------------
196 * Revision 3.23 1994/08/02 23:11:05 green
197 * added support for a crude job staging mechanism
199 * Revision 3.22 1994/07/05 14:22:27 green
200 * added James MacKinnon's NeXT ports
202 * Revision 3.21 1994/06/12 23:18:00 green
205 * Revision 3.20 1994/06/12 21:04:56 green
206 * expanded DQS_MAXNAMELEN to MAX_STRING_SIZE in def.h
208 * utilize DQS_MAXNAMELEN for command size in dqs_dshd.c
210 * Revision 3.19 1994/06/09 18:38:20 green
211 * had some problems with nonre-entrant gethostbyX in dqs_sec.c - fixed
213 * #def overload for "GENERIC" in def.h - fixed
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
220 * pulled out some sloaris #defs - maybe one day SUN will ship me my
223 * Revision 3.17 1994/06/08 17:48:00 green
224 * added P4 support(with the help of Ralph Butler - Thanks Ralph!)
226 * backed down to Rev. 3.3 of dqs_check_to_do_list.c
228 * Revision 3.16 1994/06/07 16:45:37 green
229 * more "sloaris" porting...
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
235 * added dqs_read_stats() to dqs_ck_to_do_list.c
237 * Revision 3.14 1994/06/06 01:23:01 green
238 * added "dqs_dshd_service" to the DQS config
240 * add "-par pvm" - though we do NOT intend to support it
241 * (see dqs_start_pvm.c for a more thorough discussion)
243 * Revision 3.13 1994/06/04 15:24:28 green
244 * added "-par parallel_packge" support
246 * Revision 3.12 1994/06/04 14:49:41 green
247 * added necessary P4/MPI defs
249 * Revision 3.11 1994/06/02 13:44:26 green
250 * attempt to port to Sloaris...
251 * Work In Progress(WIPed)
253 * Revision 3.10 1994/05/31 12:23:32 green
254 * modified #define for GETPGRP such that __osf__ doesn't utilize args
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
260 * removed "#include "h.h"" in defined.c
262 * yanked ANSI prototyping in dsh.c/dshd.c as some(sic) C compilers can't
265 * #ifdef'ed fcntl(F_SETOWN) out for HPUX in dsh.c as HPUX doesn't define
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
272 * Revision 3.8 1994/05/31 10:30:36 green
273 * some OSes define NCARGS, some don't - handle with ifndef...
275 * Revision 3.7 1994/05/31 00:52:40 green
276 * added dsh.c dshd.c to Makefile.proto
278 * added MAXNAMELEN and NCARGS to def.h
280 * type casting in dqs_reauth.c, dqs_sec.c, dqs_setup.c to hush gcc
283 * added jmp_buf to globals.h, changed Revision number in globals.h
285 * added dsh and dshd tp prognames.h
287 * Revision 3.6 1994/05/30 23:56:16 green
288 * added necessary defs for DCMD/DSH to def.h
290 * added notes on necessary hooks to dqs_execd.c reqd for direct execing
293 * added "#include <setjmp.h>" to h.h
295 * Revision 3.5 1994/05/04 17:54:53 green
296 * added FreeBSD support(Pedro A M Vazquez)
298 * Revision 3.4 1994/04/01 02:59:28 green
299 * added "qalter" support
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
305 * dqs_list.c:dqs_insert(TAIL) had a bug wheninserting to a NULL head
307 * may "Last Minute Hack" to dqs_list.c:dqs_showlist() really screwed up
308 * some things - yanked...
310 * Revision 3.2 1994/03/26 16:33:33 green
311 * added "-srl" support.
313 * dqs_resolve.c:dqs_read_resolve_file() now returns the primary qmaster
314 * name for fields marked as "none"
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"
319 * write generic queue configuration in common_dir
321 * Revision 3.0 1994/03/07 04:13:02 green
324 * Revision 1.8 1994/02/25 23:13:17 green
325 * added "PID_FILE" to def.h to log process id.
327 * modified dqs_execd.c and qmaster.c to log pids to a file
329 * added dqs_log_pid() to dqs_utility.c
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.
336 * Revision 1.7 1994/02/24 01:10:01 green
337 * added default compile flags in Makefile.proto
339 * modified GETPGRP() and SETPGRP() in def.h for IRIX 5.1.1.1 support
341 * changed "st_mtime" to "st_m_time" in dqs_reauth.cand dqs_sec.c
342 * for IRIX 5.1.1.1 support
344 * Revision 1.6 1994/02/23 16:19:16 green
345 * added "QUSAGE" to def.h
347 * Revision 1.5 1994/02/17 14:48:57 green
348 * added MAX_KLOG_TIME to def.h
350 * added some strategic dqs_set_coresize_2_0() as CYAs
352 * nuked some dqs_set_coresize_back_normal()
354 * dinked with ALRM handlers for "robustness"
356 * NOTE: HPUX does not support core limit size --- sad...
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
361 * fixed "-Passwd passwd_file" option
363 * Revision 1.3 1994/02/09 19:47:58 green
364 * syncing source with docs
366 * Revision 1.2 1994/02/02 20:22:05 green
367 * cleaned up "qconf.c" to sync with docs
369 * Revision 1.1.1.1 1994/02/01 17:57:36 green
372 *--------------------------------------------------*/
385 /* DQS_COMPILE_DEBUG inserts debugging macros
386 * LEAVE THEM IN!(or don't call if ya need help)
389 #define DQS_COMPILE_DEBUG
390 #define DEBUG_FILE stderr
392 #define DEFAULT_EDITOR "vi"
393 #define DQS_MAX_FD 600
394 #define MAX_SEQNUM 999999
395 #define MAX_PATH 2048
397 /*********************************************************/
400 #define u_long32 u_int
402 #define u_long32 u_long
405 /*********************************************************/
409 /* Batch Services Summary */
411 #define JOB_EXECUTION 300
412 #define JOB_ROUTING 301
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
433 #define STARTING_UP 321 /* NOT PART OF P1003.15D12! */
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 */
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
448 #define MAIL_TO_ADMINISTRATOR 007
454 /********************************************************************************/
455 /************ scheduling constants *****************************************/
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
464 #define PRIORITY_MASK 0xffff00
465 #define SUBPRIORITY_MASK 0x0000ff
467 #define JOBS_SCANNED_PER_PASS 4000
468 /********************************************************************************/
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 */
475 #define LOG_EXTDEBUG LOG_DEBUG+1
477 /********************************************************************************/
480 #define ASCENDING 600
481 #define DESCENDING 601
485 /********************************************************************************/
487 /* Shell strategies */
489 #define DQS_FIXED_SHELL 700
490 #define DQS_FLOATING_SHELL 701
492 /********************************************************************************/
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
529 /********************************************************************************/
530 /* Symbolic Constants */
534 #define NONE 0x00000000
535 #define ALL 0x77777777
537 /* Checkpoint/Restart Constants */
538 /* use dqs_show_checkpoint() */
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
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
557 #define USER 0x000000080
559 /* Job/Queue State Constants */
560 /* use dqs_show_states() */
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
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
601 /* Mail Option Constants */
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
614 /********************************************************************************/
616 /* User access declarations */
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 */
623 /*******************************************************************************/
624 /* conf file definitions */
625 #define LEAVE_OUTPUT_FILES 800
626 #define COPY_OUTPUT_FILES 801
627 #define LINK_OUTPUT_FILES 802
629 /********************************************************************************/
631 /* misc qsub/qsh stuff */
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 */
639 /* used by the parser */
648 #define GENERIC_SLA 3
649 #define GENERIC_ALL 4
652 /********************************************************************************/
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"
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"
680 /*********************************************************/
681 /*Code via Doug Gibson*/
682 #define MAX_STRING_SIZE 2048
684 #define INTSIZE 4 /* (4) 8 bit bytes */
686 #define INTOFF 4 /* big endian 64-bit machines where sizeof(int) = 8 */
688 #define INTOFF 0 /* the rest of the world; see comments in request.c */
691 #define MAX_DBE_SIZE 4096 /* max (key,content) size in bytes for ndbm(3) */
693 #define REQUESTSIZE 1024 /* BE CAREFUL */
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 */
700 #ifndef MAX_UNLINK_RETRIES
701 #define MAX_UNLINK_RETRIES 50 /* max number of unlink(2) retries */
704 #define CLEAR_EXECD_TIDS 10 /* how often to clear unreaped execd TIDs */
706 /*********************************************************/
707 /* Operating system-specific definitions */
708 /*********************************************************/
710 #if ( defined(SOLARIS23) || defined(SOLARIS24) || defined(SOLARIS25) || defined(SOLARIS26) || defined(SOLARIS27) )
711 #define SOLARIS23_UP TRUE
714 /* Extended sysconf(2) interface macros */
715 #ifdef _SC_EXIT_SIGHUP
716 #define EXIT_SIGHUP sysconf(_SC_EXIT_SIGHUP)
718 #define EXIT_SIGHUP FALSE
721 #define MAX_PROCESS_ID sysconf(_SC_PID_MAX)
723 #define MAX_PROCESS_ID MAXPID
726 #define MAX_USER_ID sysconf(_SC_UID_MAX)
728 #define MAX_USER_ID MAXUID
731 /* FLOCK - lock a file */
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)
737 #define FLOCK(x) flock(x,LOCK_EX)
738 #define FUNLOCK(x) flock(x,LOCK_UN)
742 /* GETPGRP - get a process group */
744 #if (defined(__sgi) || defined(__convex__) || defined(_AIX) || defined(i386) || defined (SVR3) || defined (__osf__) || defined(solaris)|| defined(SOLARIS23_UP) )
745 #define GETPGRP getpgrp()
747 #define GETPGRP getpgrp(getpid())
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()
754 #define SETPGRP setpgid(getpid(), GETPGRP)
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 */
760 #if ( defined(sun) && !(defined(solaris) || defined(SOLARIS23_UP) ))
762 #define SETPGRP setpgrp(0,getpid())
765 #if defined( __FreeBSD__)
767 #define SETPGRP setpgrp(getpid(),getpid())
769 /*This is a patch from David Geldreich*/
770 #if defined (__osf__)
772 #define SETPGRP setpgid(getpid(),getpid())
778 #define SETPGRP setpgrp()
779 #define GETPGRP getpgrp()
782 #if (defined( linux ) && defined(__alpha ) )
785 #define SETPGRP setpgrp()
786 #define GETPGRP getpgrp()
790 #define SETEUID(e1) setresuid (-1, e1, -1)
792 #define SETEUID(e1) seteuid ( e1 )
796 /* SETPRIORITY - set process priority */
797 #if (defined(solaris)||defined(SOLARIS23_UP))
798 #define SETPRIORITY(niceval) nice(niceval-nice(0))
801 #define SETPRIORITY(niceval) nice(niceval)
804 #define SETPRIORITY(niceval) nice(niceval)
807 #define SETPRIORITY(niceval) setpriority(PRIO_PGRP,GETPGRP,niceval)
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]
815 #define STRERROR strerror((int) errno)
818 #if (defined(_UNICOS) || defined(__hpux) || defined(solaris) || defined(SOLARIS23_UP))
819 #define RESOURCES tms
820 #define GETRUSAGE(loc) times(loc)
822 #define CLOCKTICK _SC_CLK_TCK
825 #if (defined(__hpux) || defined(solaris)|| defined(SOLARIS23_UP))
826 #define CLOCKTICK CLK_TCK;
829 #define RESOURCES rusage
830 #define GETRUSAGE(loc) getrusage(RUSAGE_CHILDREN,loc)
834 #if (defined( solaris) || defined(SOLARIS23_UP))
838 #define bcmp(s1, s2, n) memcmp ((s1), (s2), (n))
843 #define bcopy(s, d, n) memcpy ((d), (s), (n))
848 #define bzero(s, n) memset ((s), 0, (n))
853 #define index(s, c) strchr(s, c)
858 #define rindex(s, c) strrchr(s, c)
860 /* this is no longer used in solaris, but then we have no rusage-information */
864 #define wait3(s, o, r) waitpid(-1, s, o)
869 /* Directory structure definitions */
871 #if (defined(_AIX) || defined(__osf__) || defined(_UNICOS) || defined(sun) || defined(solaris) || defined(SOLARIS23_UP))
872 #define DIRENT dirent
873 struct dirent *readdir();
875 #define DIRENT direct
877 struct direct *readdir();
881 /* Temporary filename interface */
883 #define TEMPNAM tmpnam((char *)NULL)
886 #define TEMPNAM tempnam((char *)NULL,(char *)NULL)
890 #if (defined( linux ) && defined(__alpha ) )
891 #define ADDRLEN size_t
900 /*********************************************************/
901 /* Logging macros from hell */
902 /*********************************************************/
904 #define FREE(x) if(x){free( (char *)x); x=NULL;}
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
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;}
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;}
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;}
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;}
927 /* DON'T TOUCH THESE! */
929 #define OFFSET 16*NIBBLE
931 #define NIBBLE_SIZE(x) ((1+((x-1)/NIBBLE))*NIBBLE)
933 #define CHUNK_SIZE(x) ((1+((x-1)/CHUNK))*CHUNK)
935 #define PACK_MACRO_DEFS int STR_LEN;char STRING[MAX_STRING_SIZE];u_long32 J
938 PACKINT(head_ptr,cur_ptr,int,bytes_packed,mem_size);
941 #define PACKINT(a,b,c,d,e)\
948 CRITICAL((DQS_EVENT,"dqs_realloc() failure in PACKINT()"));\
955 bcopy(&J,b,INTSIZE);\
961 PACKSTR(head_ptr,cur_ptr,str,bytes_packed,mem_size);
965 #define PACKSTR(a,b,c,d,e)\
976 CRITICAL((DQS_EVENT,"dqs_realloc() failure in PACKSTR()"));\
982 if (c) bcopy(c,b,STR_LEN);\
983 else bcopy(&dqs_zero,b,STR_LEN); \
988 PACKBUF(head_ptr,cur_ptr,buf_ptr,buf_size,bytes_packed,mem_size);
991 #define PACKBUF(a,b,c,d,e,f)\
998 CRITICAL((DQS_EVENT,"dqs_realloc() failure in PACKBUF()"));\
1010 UNPACKINT(cur_ptr,int,bytes_unpacked,bytes_packed);
1012 #define UNPACKINT(a,b,c,d)\
1015 CRITICAL((DQS_EVENT,"error in UNPACKINT()"));\
1018 bcopy(a,&b,INTSIZE);\
1025 UNPACKSTR(cur_ptr,str,bytes_unpacked,bytes_packed);
1027 #define UNPACKSTR(a,b,c,d)\
1028 if (!a[0]) STR_LEN=1; \
1035 CRITICAL((DQS_EVENT,"error in UNPACKSTR()"));\
1040 bcopy(a,STRING,STR_LEN);\
1041 b=dqs_string_insert(NULL,STRING); } \
1047 UNPACKBUF(cur_ptr,buf_ptr,buf_size,bytes_unpacked,bytes_packed);
1050 #define UNPACKBUF(a,b,c,d,e)\
1053 CRITICAL((DQS_EVENT,"error in UNPACKBUF()"));\
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__)
1068 #ifdef DQS_COMPILE_DEBUG
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; \
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;} \
1088 strcpy(DQS_FUNC,DQS_EVENT);\
1089 DQS_OINDENT=DEBUG_INDENT;\
1091 sprintf(DQS_EVENT,"--> %s()",DQS_FUNC);\
1092 dqs_log(LOG_LEVEL,DQS_EVENT,__FILE__,DQS_FUNC,__LINE__);\
1096 int LOG_LEVEL=LOG_DEBUG,DQS_OINDENT; \
1097 string DQS_FUNC,DQS_EVENT,ACK_EVENT; \
1098 dqs_list_type LISTEL; \
1100 if (EXT_DEBUG_ON|DEBUG_ON)\
1103 strcpy(DQS_FUNC,DQS_EVENT);\
1104 DQS_OINDENT=DEBUG_INDENT;\
1106 sprintf(DQS_EVENT,"--> %s()",DQS_FUNC);\
1107 dqs_log(LOG_LEVEL,DQS_EVENT,__FILE__,DQS_FUNC,__LINE__);\
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; \
1115 if (EXT_DEBUG_ON|DEBUG_ON)\
1118 strcpy(DQS_FUNC,DQS_EVENT);\
1119 DQS_OINDENT=DEBUG_INDENT;\
1121 sprintf(DQS_EVENT,"--> %s()",DQS_FUNC);\
1122 dqs_log(LOG_LEVEL,DQS_EVENT,__FILE__,DQS_FUNC,__LINE__);\
1129 dqs_log(LOG_LEVEL,DQS_EVENT,__FILE__,DQS_FUNC,__LINE__);\
1135 sprintf(DQS_EVENT,"TRACE");\
1136 dqs_log(LOG_LEVEL,DQS_EVENT,__FILE__,DQS_FUNC,__LINE__);\
1142 sprintf(DQS_EVENT,"TRACE");\
1143 dqs_log(LOG_ERR,DQS_EVENT,__FILE__,DQS_FUNC,__LINE__);\
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);
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);
1163 sprintf(DQS_EVENT,"<-- %s()",DQS_FUNC);\
1164 dqs_log(LOG_LEVEL,DQS_EVENT,__FILE__,DQS_FUNC,__LINE__);\
1165 DEBUG_INDENT=DQS_OINDENT;\
1171 sprintf(DQS_EVENT,"<-- %s() *** ERROR ***",DQS_FUNC);dqs_log(LOG_LEVEL,DQS_EVENT,__FILE__,DQS_FUNC,__LINE__);\
1172 DEBUG_INDENT=DQS_OINDENT;\
1176 #define DENTER(x) {}
1178 #define DPRINTF(x){}
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();}
1186 #define DQS_ASSERT(x) if x ; else {dqs_log(LOG_CRIT,"unrecoverable error - contact systems manager",__FILE__,DQS_FUNC,__LINE__);abort();}
1189 #define DQS_EXIT(x)\
1195 /******************************************************************************/
1196 /* misc flags/attribute defines */
1215 #define master_OPT 17
1229 #define verify_OPT 31
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
1243 #define reauth_OPT 45
1244 #define notify_OPT 46
1245 #define passwd_OPT 47
1246 #define Passwd_OPT 48
1249 #define hold_jid_OPT 51
1268 #define mconf_OPT 118
1270 #define qmon_OPT 120
1273 #define sconf_OPT 123
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 */
1313 #define DQS_EXECD 17
1314 #define MAX_ANCILLARY 17
1317 /* Note: do not include QUSAGE before ALL_OPT! */
1318 /* ALL_OPT is used by "dqs_options" while "qusage" */
1319 /* is part of "XSRC" */
1325 /* macros used in parsing */
1326 #define VALID_OPT(opt,who) (dqs_options[opt][who])
1328 /****************************************************************/
1329 /* DQS list types */
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
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
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));
1363 /****************************************************************/
1364 /* DQS "op" types */
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 /****************************************************************/
1383 #define MIN_BACKOFF_TIME 2
1384 #define MAX_BACKOFF_TIME 10
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
1395 /****************************************************************/
1396 /* DQS Format Macros */
1398 #define STATFILE_FPRINTF_FORMAT "%d:%s:%s:%d:%d:%d:%s:%s\n"
1400 #define STATFILE_FSCANF_FORMAT "\n%d:%[^:]:%[^:]:%d:%d:%d:%[^:]:%[^:\n]"
1402 #define STATFILE_FSCANF_COUNT 8
1404 #define STATFILE_FSCANF_VARS \
1410 &Stats->qty_active, \
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"
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"
1420 #define ACTFILE_FSCANF_COUNT 33
1422 #define ACTFILE_FPRINTF_VARS \
1434 d->submission_time, \
1457 #define ACTFILE_FSCANF_VARS \
1469 &d->submission_time, \
1492 /****************************************************************/
1493 /* DQS Development Macros */
1495 #define GETFD(a) close(creat("RMME",0755));a=open("RMME",O_RDWR)
1497 #define RESETFD(a) lseek(a,0,SEEK_SET)
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! */
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
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...
1528 course the SunPro demo compiler I saw doesn't define "__svr4__"
1530 funny how it only takes a hour to port to every other arc,
1531 (all totalled!) then you spend days porting to SunOSes