load control (3 of 8)
Keith Muller
muller at sdcc3.UUCP
Tue Feb 12 18:13:49 AEST 1985
This is part 3 of the load control system. Part 1 must be unpacked before
any other part.
Keith Muller
ucbvax!sdcsvax!muller
# This is a shell archive. Remove anything before this line,
# then unpack it by saving it in a file and typing "sh file".
#
# Wrapped by sdcc3!muller on Sat Feb 9 13:48:06 PST 1985
# Contents: h/client.h h/common.h h/control.h h/server.h
echo x - h/client.h
sed 's/^@//' > "h/client.h" <<'@//E*O*F h/client.h//'
/*-----------------------------------------------------------------------
* client.h
*
* definitions used by the client process.
*-----------------------------------------------------------------------
*/
/* $Log$ */
#define MAXPOLLS 5 /* max polls to server from a client if the */
/* server doesnt respond after, just run */
#define WAITTIME 60 /* time (secs) wait for response between each */
/* poll of the server */
#define QUEUETIME 600 /* time (secs) wait before waking up to see if*/
/* if the server is still running */
#define ENVNAME "LDDOPTS" /* name to set in environment, read by client */
#define ONETIME /* When defined once a program passed through */
/* the ldd system and inherits the effective */
/* group id of ldd, all child processes will */
/* be exempt from load control. Can be used */
/* to encourage the use of make. Note that if */
/* make is load controlled a user can bypass */
/* load control by having make create a sh. */
/* A more uesful way to use this is to load */
/* control all passes of a compiler and only */
/* first passes will be queued, all other */
/* passes will be exempt. See client/main.c */
@//E*O*F h/client.h//
chmod u=r,g=r,o=r h/client.h
echo x - h/common.h
sed 's/^@//' > "h/common.h" <<'@//E*O*F h/common.h//'
/*------------------------------------------------------------------------
* common.h
*
* Common definations for all the programs releted to the load control
* system that MUST be EXACTLY the same.
*------------------------------------------------------------------------
*/
/* $Log$ */
#include <sys/types.h>
/*
* The basic datagram package sent TO the server.
*/
#define COMLEN 15 /* buffer for user command */
struct request {
u_long pid; /* pid of client process (socket name) */
u_long uid; /* Usually the uid of the client, not always */
u_long time; /* Usually the submit time of the client */
char com[COMLEN]; /* Part of the command line the user typed */
char type; /* The command identifier (a single char) */
};
/*
* The commands that can be sent to/from the server.
*/
#define CHTIMER 'N' /* change the server interval timer */
#define LOADLIMCMD 'L' /* change the server load average threshold */
#define LISTCMD 'I' /* ask server for a list of queued jobs */
#define MOVECMD 'M' /* ask server to move a job in the queue */
#define MQTIMECMD 'T' /* change the server limit on max queue time */
#define POLLCMD 'P' /* to/from server that request be resent */
#define QCMD 'Q' /* to/from server stating job is queued */
#define PALLCMD 'F' /* ask server to remove ALL queued jobs */
#define PUSRCMD 'U' /* ask server to remove all a users jobs */
#define PJOBCMD 'R' /* ask server to remove a specific job */
#define RUSRCMD 'W' /* ask server to run all a users jobs */
#define RJOBCMD 'X' /* ask server to run a specific job */
#define RUNCMD 'G' /* message to continue execution */
#define STOPCMD 'H' /* message to stop or command invalid */
#define STATUSCMD 'S' /* ask server to list parameters */
#define ABORTCMD 'A' /* ask server to terminate */
#define FULLQUEUE 'D' /* from server that queue is full */
#define QUEUESIZE 'O' /* ask server to change queue full point */
/*
* path names of files used in the system
*/
#define CLIENTPRE "cl" /* client socket prefix */
#define CNTRLPRE "cn" /* control socket prefix */
#define LDDGID 25 /* gid used to protect */
/* REAL binaries this must*/
/* be the gid of the */
/* protected directories */
/*
* Defined paths. If these are altered the onetime script makedirs must
* also be altered.
*
* The load control system uses two subdirectories to store
* sockets and status files. server directories should be owner (root)
* write only and execute all others only (mode 710). The client directory
* must be group writeable but not readable (mode 730). This is done for
* security reasons and should not be altered.
*/
#define SPOOLDIR "/usr/spool/ldd/cl" /* client sockets dir */
#define SERVERDIR "/usr/spool/ldd/sr" /* servers directory */
/*
* The following MUST be in the SERVERDIR directory!!!!
*/
#define CNTRLPATH "/usr/spool/ldd/sr/cnsock" /* serv cntrl socket */
#define MSGPATH "/usr/spool/ldd/sr/msgsock" /* serv msg socket */
#define LISTFILE "/usr/spool/ldd/sr/list" /* jobs in queue file */
#define STATUSFILE "/usr/spool/ldd/sr/status" /* status of server */
#define ERRORPATH "/usr/spool/ldd/sr/errors" /* saved errors */
#define LOCK "/usr/spool/ldd/sr/lock" /* lockfile */
@//E*O*F h/common.h//
chmod u=r,g=r,o=r h/common.h
echo x - h/control.h
sed 's/^@//' > "h/control.h" <<'@//E*O*F h/control.h//'
/*------------------------------------------------------------------------
* control.h
*
* definations used by the control program
*------------------------------------------------------------------------
*/
/* $Log$ */
/*
* structure of control program command table
*/
struct cmd {
char *c_name; /* command name */
char *c_help; /* help message */
int (*c_handler)(); /* routine to do the work */
int c_priv; /* command privledge */
};
#define RESTRICT 1 /* a 1 means restricted command */
#define NORESTRICT 0 /* a 0 mean no restrictions */
/*
* structure of the hash table used by the list commands to keep a
* local listing of recently referenced users in the passwd file.
* (used for speedup).
*/
#define PNAMSIZ 12 /* size of list name bucket to store name */
#define HASHMOD 151 /* size of list hash table, MUST BE prime */
struct hashbuck{
int buckuid;
char buckname[PNAMSIZ+1];
};
/*
* warning message limits for ldc commands to help prevent the admin
* from setting server settings that might cause problems.
*/
#define LOWCYCLE 5 /* If cycle time is less complain */
#define HIGHCYCLE 600 /* If cycle time is greater complain */
#define LOWMAX 90 /* If max queue time is less complain */
#define HIGHMAX 43200 /* If max queue time is greater complain */
#define LOWSIZE 10 /* If max queue size is less complain */
#define HIGHSIZE 200 /* If max queue size is greater complain */
#define LOWLOAD 1.0 /* If load limit is less complain */
#define HIGHLOAD 35.0 /* If load limit is greater complain */
/*
* other defines
*/
#define WAITTIME 120 /* time (secs) before packet resend */
@//E*O*F h/control.h//
chmod u=r,g=r,o=r h/control.h
echo x - h/server.h
sed 's/^@//' > "h/server.h" <<'@//E*O*F h/server.h//'
/*------------------------------------------------------------------------
* server.h
*
* definations used by the server process.
*------------------------------------------------------------------------
*/
/* $Log$ */
/*
* structure of the double linked queue of waiting processes.
*/
struct qnode {
u_long pid; /* pid of waiting client */
u_long uid; /* uid of waiting client */
u_long time; /* time job submitted in queue */
struct qnode *fow; /* foward link to newer job */
struct qnode *back; /* back link to older job */
char com[COMLEN+1]; /* command line (truncated) */
};
#define QNIL (struct qnode *) 0 /* use for nil pointer */
/*
* General definations.
*/
#define MAXLOAD 10.0 /* default load level to queue at */
/* 10 for pyramid 90x, 8.5 for 780, 7 for */
/* 750. note you can override this on
/* ldd's command line */
#define ALRMTIME 60 /* default cycle time to check load */
/* 60 is good for vaxes. pyramids being */
/* so much faster should be 20. Note you */
/* can override this default on ldd's */
/* command line in seconds */
#define MAXQTIME 14400 /* default max queue time for a process */
/* waiting to run in seconds */
#define PRIO -4 /* server runs at this nice level this has */
/* little impact on the system, but makes */
/* sure packets get handled properly under */
/* heavy load. This should be -4 or smaller */
/* (-5, -6, ...) */
#define WAITTIME 60 /* wait for client during startup scan */
/* of the spool directory in seconds */
#define MAXPOLLS 2 /* how many times to send a poll request */
/* during startup polling */
#define MAXINQUEUE 150 /* max number of jobs that can be waiting to */
/* run */
@//E*O*F h/server.h//
chmod u=r,g=r,o=r h/server.h
echo Inspecting for damage in transit...
temp=/tmp/shar$$; dtemp=/tmp/.shar$$
trap "rm -f $temp $dtemp; exit" 0 1 2 3 15
cat > $temp <<\!!!
30 200 1207 client.h
81 528 3321 common.h
54 270 1630 control.h
50 298 1737 server.h
215 1296 7895 total
!!!
wc h/client.h h/common.h h/control.h h/server.h | sed 's=[^ ]*/==' | diff -b $temp - >$dtemp
if [ -s $dtemp ]
then echo "Ouch [diff of wc output]:" ; cat $dtemp
else echo "No problems found."
fi
exit 0
More information about the Comp.sources.unix
mailing list