Another grab bag of ANSI-fication, warning removal, and comment fixes. --- pbs-2.3.12/src/include/dis.h | 7 +++++++ pbs-2.3.12/src/include/mom_func.h | 12 ++++++++++-- pbs-2.3.12/src/lib/Libcmds/prepare_path.c | 1 + pbs-2.3.12/src/lib/Libifl/PBSD_jcred.c | 2 +- pbs-2.3.12/src/lib/Libifl/dec_attrl.c | 5 ++--- pbs-2.3.12/src/lib/Libifl/dec_svrattrl.c | 5 ++--- pbs-2.3.12/src/lib/Libifl/enc_svrattrl.c | 5 ++--- pbs-2.3.12/src/lib/Libifl/pbsD_connect.c | 1 + pbs-2.3.12/src/lib/Libifl/rpp.c | 1 + pbs-2.3.12/src/lib/Libifl/tcp_dis.c | 2 +- pbs-2.3.12/src/lib/Libifl/tm.c | 2 +- pbs-2.3.12/src/lib/Libnet/net_server.c | 1 + pbs-2.3.12/src/lib/Libsite/site_check_u.c | 1 + pbs-2.3.12/src/resmom/linux/mom_mach.h | 1 + pbs-2.3.12/src/resmom/linux/mom_start.c | 2 +- pbs-2.3.12/src/resmom/mom_comm.c | 3 +-- pbs-2.3.12/src/resmom/mom_inter.c | 9 +++------ pbs-2.3.12/src/resmom/mom_main.c | 26 +++++++++++++++++--------- pbs-2.3.12/src/resmom/mom_server.c | 8 ++------ pbs-2.3.12/src/resmom/requests.c | 5 +---- pbs-2.3.12/src/resmom/start_exec.c | 20 +++++++++++++------- pbs-2.3.12/src/server/node_func.c | 3 +++ pbs-2.3.12/src/server/svr_movejob.c | 6 +++--- 23 files changed, 76 insertions(+), 52 deletions(-) diff -puN src/include/dis.h~compile-warning-fixes-2 src/include/dis.h --- pbs-2.3.12-orig/src/include/dis.h~compile-warning-fixes-2 2004-08-06 17:48:12.000000000 -0400 +++ pbs-2.3.12/src/include/dis.h 2004-08-06 17:48:12.000000000 -0400 @@ -87,6 +87,9 @@ #include #include #include +#include "pbs_ifl.h" +#include "list_link.h" +#include "attribute.h" #ifndef TRUE #define TRUE 1 @@ -249,4 +252,8 @@ extern void DIS_tcp_reset A_((int fd, in extern void DIS_tcp_setup A_((int fd)); extern int DIS_tcp_wflush A_((int fd)); +extern int decode_DIS_attrl(int sock, struct attrl **ppatt); +extern int decode_DIS_svrattrl(int sock, list_head *phead); +extern int encode_DIS_svrattrl(int sock, svrattrl *psattl); + #endif /* DATA_IS_STRINGS_ */ diff -puN src/include/mom_func.h~compile-warning-fixes-2 src/include/mom_func.h --- pbs-2.3.12-orig/src/include/mom_func.h~compile-warning-fixes-2 2004-08-06 17:48:12.000000000 -0400 +++ pbs-2.3.12/src/include/mom_func.h 2004-08-06 17:48:12.000000000 -0400 @@ -80,7 +80,9 @@ /* * @(#) $Id: compile-warning-fixes-2.patch,v 1.2 2004/08/06 22:06:42 pw Exp $ */ - +#ifndef LIBPBS_H +#include "libpbs.h" +#endif #ifndef MOM_MACH #include "mom_mach.h" @@ -154,10 +156,16 @@ extern int reader A_((int, int)); extern int writer A_((int, int)); extern int conn_qsub A_((char *host, unsigned int port)); extern int run_pelog A_((int which, char *file, job *pjob, int pe_io_type)); -extern int is_joined A_((job *)); +extern int is_joined A_((const job *pjob)); extern void check_busy A_((double)); extern void state_to_server A_((int)); extern int send_sisters(const job *pjob, int com); +extern int mom_writer(int s, int ptc); +extern int mom_reader(int s, int ptc); +extern int task_save(task *ptask); +extern void end_proc(void); +extern int message_job(job *pjob, enum job_file jft, char *text); +extern void term_job(job *pjob); /* Defines for pe_io_type, see run_pelog() */ diff -puN src/lib/Libcmds/prepare_path.c~compile-warning-fixes-2 src/lib/Libcmds/prepare_path.c --- pbs-2.3.12-orig/src/lib/Libcmds/prepare_path.c~compile-warning-fixes-2 2004-08-06 17:48:12.000000000 -0400 +++ pbs-2.3.12/src/lib/Libcmds/prepare_path.c 2004-08-06 17:48:12.000000000 -0400 @@ -88,6 +88,7 @@ #include #include #include +#include #include #include #include diff -puN src/lib/Libifl/PBSD_jcred.c~compile-warning-fixes-2 src/lib/Libifl/PBSD_jcred.c --- pbs-2.3.12-orig/src/lib/Libifl/PBSD_jcred.c~compile-warning-fixes-2 2004-08-06 17:48:12.000000000 -0400 +++ pbs-2.3.12/src/lib/Libifl/PBSD_jcred.c 2004-08-06 17:48:12.000000000 -0400 @@ -107,7 +107,7 @@ int len; DIS_tcp_setup(sock); if ( (rc =encode_DIS_ReqHdr(sock,PBS_BATCH_JobCred,pbs_current_user)) || - (rc = encode_DIS_JobCredential(sock, type, buf, len)) || + (rc = encode_DIS_JobCred(sock, type, buf, len)) || (rc = encode_DIS_ReqExtend(sock, (char *)0)) ) { connection[c].ch_errtxt = strdup(dis_emsg[rc]); return (pbs_errno = PBSE_PROTOCOL); diff -puN src/lib/Libifl/dec_attrl.c~compile-warning-fixes-2 src/lib/Libifl/dec_attrl.c --- pbs-2.3.12-orig/src/lib/Libifl/dec_attrl.c~compile-warning-fixes-2 2004-08-06 17:48:12.000000000 -0400 +++ pbs-2.3.12/src/lib/Libifl/dec_attrl.c 2004-08-06 17:48:12.000000000 -0400 @@ -110,9 +110,8 @@ static char ident[] = "@(#) $RCSfile: de #include "libpbs.h" #include "dis.h" -int decode_DIS_attrl(sock, ppatt) - int sock; - struct attrl **ppatt; +int +decode_DIS_attrl(int sock, struct attrl **ppatt) { int hasresc; int i; diff -puN src/lib/Libifl/dec_svrattrl.c~compile-warning-fixes-2 src/lib/Libifl/dec_svrattrl.c --- pbs-2.3.12-orig/src/lib/Libifl/dec_svrattrl.c~compile-warning-fixes-2 2004-08-06 17:48:12.000000000 -0400 +++ pbs-2.3.12/src/lib/Libifl/dec_svrattrl.c 2004-08-06 17:48:12.000000000 -0400 @@ -113,9 +113,8 @@ static char ident[] = "@(#) $RCSfile: de #include "attribute.h" #include "dis.h" -int decode_DIS_svrattrl(sock, phead) - int sock; - list_head *phead; +int +decode_DIS_svrattrl(int sock, list_head *phead) { int i; unsigned int hasresc; diff -puN src/lib/Libifl/enc_svrattrl.c~compile-warning-fixes-2 src/lib/Libifl/enc_svrattrl.c --- pbs-2.3.12-orig/src/lib/Libifl/enc_svrattrl.c~compile-warning-fixes-2 2004-08-06 17:48:12.000000000 -0400 +++ pbs-2.3.12/src/lib/Libifl/enc_svrattrl.c 2004-08-06 17:48:12.000000000 -0400 @@ -108,9 +108,8 @@ static char ident[] = "@(#) $RCSfile: en #include "attribute.h" #include "dis.h" -int encode_DIS_svrattrl(sock, psattl) - int sock; - svrattrl *psattl; +int +encode_DIS_svrattrl(int sock, svrattrl *psattl) { unsigned int ct = 0; unsigned int name_len; diff -puN src/lib/Libifl/pbsD_connect.c~compile-warning-fixes-2 src/lib/Libifl/pbsD_connect.c --- pbs-2.3.12-orig/src/lib/Libifl/pbsD_connect.c~compile-warning-fixes-2 2004-08-06 17:48:12.000000000 -0400 +++ pbs-2.3.12/src/lib/Libifl/pbsD_connect.c 2004-08-06 17:48:12.000000000 -0400 @@ -96,6 +96,7 @@ #include #include #include "libpbs.h" +#include "net_connect.h" #include "dis.h" static char ident[] = "@(#) $RCSfile: compile-warning-fixes-2.patch,v $ $Revision: 1.2 $"; diff -puN src/lib/Libifl/rpp.c~compile-warning-fixes-2 src/lib/Libifl/rpp.c --- pbs-2.3.12-orig/src/lib/Libifl/rpp.c~compile-warning-fixes-2 2004-08-06 17:48:12.000000000 -0400 +++ pbs-2.3.12/src/lib/Libifl/rpp.c 2004-08-06 17:48:12.000000000 -0400 @@ -107,6 +107,7 @@ static char ident[] = "@(#) $RCSfile: rp #include #include #include +#include #include "rpp.h" #if !defined(H_ERRNO_DECLARED) diff -puN src/lib/Libifl/tcp_dis.c~compile-warning-fixes-2 src/lib/Libifl/tcp_dis.c --- pbs-2.3.12-orig/src/lib/Libifl/tcp_dis.c~compile-warning-fixes-2 2004-08-06 17:48:12.000000000 -0400 +++ pbs-2.3.12/src/lib/Libifl/tcp_dis.c 2004-08-06 17:48:12.000000000 -0400 @@ -395,7 +395,7 @@ static int tcp_wcommit(fd, commit_flag) return 0; } -void DIS_tcp_funcs() +void DIS_tcp_funcs(void) { if (dis_getc != tcp_getc) { dis_getc = tcp_getc; diff -puN src/lib/Libifl/tm.c~compile-warning-fixes-2 src/lib/Libifl/tm.c --- pbs-2.3.12-orig/src/lib/Libifl/tm.c~compile-warning-fixes-2 2004-08-06 17:48:12.000000000 -0400 +++ pbs-2.3.12/src/lib/Libifl/tm.c 2004-08-06 17:48:12.000000000 -0400 @@ -411,7 +411,7 @@ localmom() if (have_addr == 0) { /* lookup "localhost" and save address */ if ((hp = gethostbyname("localhost")) == NULL) { - DBPRT(("tm_init: localhost not found\n")) + DBPRT(("localmom: localhost not found\n")) return -1; } assert(hp->h_length <= sizeof(hostaddr)); diff -puN src/lib/Libnet/net_server.c~compile-warning-fixes-2 src/lib/Libnet/net_server.c --- pbs-2.3.12-orig/src/lib/Libnet/net_server.c~compile-warning-fixes-2 2004-08-06 17:48:12.000000000 -0400 +++ pbs-2.3.12/src/lib/Libnet/net_server.c 2004-08-06 17:48:12.000000000 -0400 @@ -79,6 +79,7 @@ #include /* the master config generated by configure */ #include +#include #include #include #include diff -puN src/lib/Libsite/site_check_u.c~compile-warning-fixes-2 src/lib/Libsite/site_check_u.c --- pbs-2.3.12-orig/src/lib/Libsite/site_check_u.c~compile-warning-fixes-2 2004-08-06 17:48:12.000000000 -0400 +++ pbs-2.3.12/src/lib/Libsite/site_check_u.c 2004-08-06 17:48:12.000000000 -0400 @@ -80,6 +80,7 @@ #include #include +#include #include #include "portability.h" #include "list_link.h" diff -puN src/resmom/linux/mom_mach.h~compile-warning-fixes-2 src/resmom/linux/mom_mach.h --- pbs-2.3.12-orig/src/resmom/linux/mom_mach.h~compile-warning-fixes-2 2004-08-06 17:48:12.000000000 -0400 +++ pbs-2.3.12/src/resmom/linux/mom_mach.h 2004-08-06 17:48:12.000000000 -0400 @@ -110,6 +110,7 @@ extern int mom_kill A_((int sid, int sig extern int mom_close_poll A_(()); /* Terminate poll ability */ extern int mach_checkpoint A_((struct task *, char *path, int abt)); extern long mach_restart A_((struct task *, char *path)); /* Restart checkpointed job */ +extern int kill_task(const task *ptask, int sig); typedef struct proc_stat { diff -puN src/resmom/linux/mom_start.c~compile-warning-fixes-2 src/resmom/linux/mom_start.c --- pbs-2.3.12-orig/src/resmom/linux/mom_start.c~compile-warning-fixes-2 2004-08-06 17:48:12.000000000 -0400 +++ pbs-2.3.12/src/resmom/linux/mom_start.c 2004-08-06 17:48:12.000000000 -0400 @@ -78,6 +78,7 @@ */ #include /* the master config generated by configure */ +#include #include #include #include @@ -196,7 +197,6 @@ void scan_for_terminated() job *pjob; task *ptask; int statloc; - void task_save A_((task *ptask)); /* update the latest intelligence about the running jobs; */ /* must be done before we reap the zombies, else we lose the info */ diff -puN src/resmom/mom_comm.c~compile-warning-fixes-2 src/resmom/mom_comm.c --- pbs-2.3.12-orig/src/resmom/mom_comm.c~compile-warning-fixes-2 2004-08-06 17:48:12.000000000 -0400 +++ pbs-2.3.12/src/resmom/mom_comm.c 2004-08-06 17:48:12.000000000 -0400 @@ -746,8 +746,7 @@ node_bailout(pjob, np) } void -term_job(pjob) - job *pjob; +term_job(job *pjob) { hnodent *np; int num; diff -puN src/resmom/mom_inter.c~compile-warning-fixes-2 src/resmom/mom_inter.c --- pbs-2.3.12-orig/src/resmom/mom_inter.c~compile-warning-fixes-2 2004-08-06 17:48:12.000000000 -0400 +++ pbs-2.3.12/src/resmom/mom_inter.c 2004-08-06 17:48:12.000000000 -0400 @@ -248,9 +248,8 @@ int setwinsize(pty) * reader process - reads from the remote socket, and writes * to the master pty */ -int mom_reader(s, ptc) - int s; - int ptc; +int +mom_reader(int s, int ptc) { extern ssize_t read_blocking_socket(int fd, void *buf, ssize_t count); char buf[1024]; @@ -292,9 +291,7 @@ int mom_reader(s, ptc) * data out to the rem socket */ int -mom_writer(s, ptc) - int s; - int ptc; +mom_writer(int s, int ptc) { char buf[1024]; int c; diff -puN src/resmom/mom_main.c~compile-warning-fixes-2 src/resmom/mom_main.c --- pbs-2.3.12-orig/src/resmom/mom_main.c~compile-warning-fixes-2 2004-08-06 17:48:12.000000000 -0400 +++ pbs-2.3.12/src/resmom/mom_main.c 2004-08-06 17:48:12.000000000 -0400 @@ -90,6 +90,7 @@ #include #endif #include +#include #include #include #include @@ -115,6 +116,7 @@ #include #include #include +#include #include "libpbs.h" #include "pbs_ifl.h" @@ -340,10 +342,10 @@ char *loadave(attrib) } struct config common_config[] = { - { "arch", arch }, - { "uname", requname }, - { "validuser", validuser }, - { NULL, nullproc } + { "arch", { arch } }, + { "uname", { requname } }, + { "validuser", { validuser } }, + { NULL, { nullproc } } }; /* @@ -528,6 +530,10 @@ rmnl(str) } } +/* stupid pbs code: cannot put this in a header file */ +extern void tinsert(const u_long key, void **rootp); +extern int tfind(const u_long key, void **rootp); + static u_long addclient(name) char *name; @@ -544,6 +550,7 @@ addclient(name) } memcpy((char *)&saddr, host->h_addr, host->h_length); ipaddr = ntohl(saddr.s_addr); + tinsert(ipaddr, &okclients); return ipaddr; } @@ -1529,6 +1536,7 @@ tcp_request(fd) log_buffer[0] = '\0'; for (c=0;; c++) { + extern void DIS_tcp_funcs(void); DIS_tcp_funcs(); if (do_tcp(fd)) @@ -1761,9 +1769,8 @@ usage(prog) * main - the main program of MOM */ -main(argc, argv) - int argc; - char *argv[]; +int +main(int argc, char *argv[]) { static char id[] = "mom_main"; int errflg, c; @@ -2277,11 +2284,12 @@ main(argc, argv) break; c = atoi(pjob->ji_globid); if ((kill((pid_t)c, 0)==-1) && - (errno == ESRCH)) { + (errno == ESRCH)) #else /* not cray */ if ((kill(ptask->ti_qs.ti_sid, 0)==-1) && - (errno == ESRCH)) { + (errno == ESRCH)) #endif /* not cray */ + { LOG_EVENT(PBSEVENT_JOB, PBS_EVENTCLASS_JOB, id, "no active process found"); ptask->ti_qs.ti_exitstat = 0; diff -puN src/resmom/mom_server.c~compile-warning-fixes-2 src/resmom/mom_server.c --- pbs-2.3.12-orig/src/resmom/mom_server.c~compile-warning-fixes-2 2004-08-06 17:48:12.000000000 -0400 +++ pbs-2.3.12/src/resmom/mom_server.c 2004-08-06 17:48:12.000000000 -0400 @@ -150,9 +150,7 @@ node *okclients = NULL; /* tree of ip a /* find value in tree, return 1 if found, 0 if not */ int -tfind(key, rootp) - const u_long key; /* key to be located */ - node **rootp; /* address of tree root */ +tfind(const u_long key, node **rootp) { register node *q; @@ -169,9 +167,7 @@ tfind(key, rootp) } void -tinsert(key, rootp) - const u_long key; /* key to be located */ - node **rootp; /* address of tree root */ +tinsert(const u_long key, node **rootp) { register node *q; diff -puN src/resmom/requests.c~compile-warning-fixes-2 src/resmom/requests.c --- pbs-2.3.12-orig/src/resmom/requests.c~compile-warning-fixes-2 2004-08-06 17:48:12.000000000 -0400 +++ pbs-2.3.12/src/resmom/requests.c 2004-08-06 17:48:12.000000000 -0400 @@ -463,10 +463,7 @@ void req_holdjob(preq) * Return a PBS error code. */ -int message_job(pjob, jft, text) - job *pjob; - enum job_file jft; - char *text; +int message_job(job *pjob, enum job_file jft, char *text) { char *pstr = NULL; int len; diff -puN src/resmom/start_exec.c~compile-warning-fixes-2 src/resmom/start_exec.c --- pbs-2.3.12-orig/src/resmom/start_exec.c~compile-warning-fixes-2 2004-08-06 17:48:12.000000000 -0400 +++ pbs-2.3.12/src/resmom/start_exec.c 2004-08-06 17:48:12.000000000 -0400 @@ -117,6 +117,8 @@ #include "pbs_error.h" #include "svrfunc.h" #include "md5.h" +#include "dis.h" +#include "net_connect.h" static char ident[] = "@(#) $RCSfile: compile-warning-fixes-2.patch,v $ $Revision: 1.2 $"; @@ -287,14 +289,14 @@ int mom_restart_job(pjob, path) goto fail; } if ((ptask = task_find(pjob, taskid)) == NULL) { - sprintf(log_buffer, "%s: task %ld not found", + sprintf(log_buffer, "%s: task %u not found", pjob->ji_qs.ji_jobid, taskid); goto fail; } (void)strcpy(filnam, pdir->d_name); if (mach_restart(ptask, namebuf) == -1) { - sprintf(log_buffer, "%s: task %ld failed from file %s", + sprintf(log_buffer, "%s: task %u failed from file %s", pjob->ji_qs.ji_jobid, taskid, namebuf); goto fail; } @@ -411,10 +413,10 @@ static int open_pty(pjob) * -1 - joined as stderr */ -is_joined(pjob) - job *pjob; +int +is_joined(const job *pjob) { - attribute *pattr; + const attribute *pattr; pattr = &pjob->ji_wattr[(int)JOB_ATR_join]; if ( (pattr->at_flags & ATR_VFLAG_SET) && @@ -950,7 +952,7 @@ finish_exec(pjob) bld_env_variables(&vtable, variables_else[8], buf); /* PBS_TASKNUM */ - sprintf(buf, "%ld", ptask->ti_qs.ti_task); + sprintf(buf, "%u", ptask->ti_qs.ti_task); bld_env_variables(&vtable, variables_else[9], buf); /* PBS_MOMPORT */ @@ -1601,7 +1603,7 @@ start_process(ptask, argv, envp) bld_env_variables(&vtable, variables_else[8], buf); /* PBS_TASKNUM */ - sprintf(buf, "%ld", ptask->ti_qs.ti_task); + sprintf(buf, "%u", ptask->ti_qs.ti_task); bld_env_variables(&vtable, variables_else[9], buf); /* PBS_MOMPORT */ @@ -2158,6 +2160,10 @@ char *std_file_name(pjob, which, keeping key = '\001'; /* should never be found */ suffix = JOB_CKPT_SUFFIX; break; + + default: + key = '\001'; + suffix = 0; } /* Is file to be kept?, if so use default name in Home directory */ diff -puN src/server/node_func.c~compile-warning-fixes-2 src/server/node_func.c --- pbs-2.3.12-orig/src/server/node_func.c~compile-warning-fixes-2 2004-08-06 17:48:12.000000000 -0400 +++ pbs-2.3.12/src/server/node_func.c 2004-08-06 17:48:12.000000000 -0400 @@ -95,7 +95,10 @@ #include #include +#include +#include #include +#include #include #include #include diff -puN src/server/svr_movejob.c~compile-warning-fixes-2 src/server/svr_movejob.c --- pbs-2.3.12-orig/src/server/svr_movejob.c~compile-warning-fixes-2 2004-08-06 17:48:12.000000000 -0400 +++ pbs-2.3.12/src/server/svr_movejob.c 2004-08-06 17:48:12.000000000 -0400 @@ -128,6 +128,7 @@ static int should_retry_route A_((int er static int move_job_file A_((int con, job *pjob, enum job_file which)); /* Global Data */ +int net_move(job *jobp, struct batch_request *req); extern char *path_jobs; extern char *path_spool; @@ -687,9 +688,8 @@ static void net_move_die(sig) * Returns: 2 on success (child started, see send_job()), -1 on error */ -int net_move(jobp, req) - job *jobp; - struct batch_request *req; +int +net_move(job *jobp, struct batch_request *req) { void *data; char *destination = jobp->ji_qs.ji_destin; _