Grab bag of ANSI-fication, warning removal, and comment fixes. --- pbs-2.3.12/src/include/job.h | 2 - pbs-2.3.12/src/lib/Libsite/site_alt_rte.c | 2 - pbs-2.3.12/src/lib/Libsite/site_check_u.c | 1 pbs-2.3.12/src/resmom/linux/mom_mach.c | 51 +++++++++++++++--------------- pbs-2.3.12/src/resmom/mom_comm.c | 12 ++----- pbs-2.3.12/src/resmom/rm_dep.h | 18 +++++----- pbs-2.3.12/src/resmom/start_exec.c | 6 +-- pbs-2.3.12/src/server/attr_recov.c | 1 pbs-2.3.12/src/server/req_quejob.c | 4 +- 9 files changed, 50 insertions(+), 47 deletions(-) diff -puN src/include/job.h~compile-warning-fixes src/include/job.h --- pbs-2.3.12-orig/src/include/job.h~compile-warning-fixes 2004-08-06 17:51:07.000000000 -0400 +++ pbs-2.3.12/src/include/job.h 2004-08-06 17:51:07.000000000 -0400 @@ -393,7 +393,7 @@ struct job { int ji_un_type; /* type of ji_un union */ union { /* depends on type of queue currently in */ struct { /* if in execution queue .. */ - pbs_net_t ji_momaddr; /* host addr of Server */ + pbs_net_t ji_momaddr; /* host addr of Mom */ int ji_exitstat; /* job exit status from MOM */ } ji_exect; struct { diff -puN src/lib/Libsite/site_alt_rte.c~compile-warning-fixes src/lib/Libsite/site_alt_rte.c --- pbs-2.3.12-orig/src/lib/Libsite/site_alt_rte.c~compile-warning-fixes 2004-08-06 17:51:07.000000000 -0400 +++ pbs-2.3.12/src/lib/Libsite/site_alt_rte.c 2004-08-06 17:51:07.000000000 -0400 @@ -84,8 +84,8 @@ #include "list_link.h" #include "attribute.h" #include "server_limits.h" -#include "job.h" #include "queue.h" +#include "job.h" static char ident[] = "@(#) $RCSfile: compile-warning-fixes.patch,v $ $Revision: 1.2 $"; diff -puN src/lib/Libsite/site_check_u.c~compile-warning-fixes src/lib/Libsite/site_check_u.c --- pbs-2.3.12-orig/src/lib/Libsite/site_check_u.c~compile-warning-fixes 2004-08-06 17:51:07.000000000 -0400 +++ pbs-2.3.12/src/lib/Libsite/site_check_u.c 2004-08-06 17:51:49.000000000 -0400 @@ -79,6 +79,7 @@ #include /* the master config generated by configure */ #include +#include #include #include "portability.h" #include "list_link.h" diff -puN src/resmom/linux/mom_mach.c~compile-warning-fixes src/resmom/linux/mom_mach.c --- pbs-2.3.12-orig/src/resmom/linux/mom_mach.c~compile-warning-fixes 2004-08-06 17:51:07.000000000 -0400 +++ pbs-2.3.12/src/resmom/linux/mom_mach.c 2004-08-06 17:51:48.000000000 -0400 @@ -87,7 +87,8 @@ #include #include #include -#include +#include +#include #include #include #include @@ -192,15 +193,15 @@ typedef struct proc_mem { ** local resource array */ struct config dependent_config[] = { - { "resi", resi }, - { "totmem", totmem }, - { "availmem", availmem }, - { "physmem", physmem }, - { "ncpus", ncpus }, - { "loadave", loadave }, - { "walltime", walltime }, - { "quota", quota }, - { NULL, nullproc }, + { "resi", { resi } }, + { "totmem", { totmem } }, + { "availmem", { availmem } }, + { "physmem", { physmem } }, + { "ncpus", { ncpus } }, + { "loadave", { loadave } }, + { "walltime", { walltime } }, + { "quota", { quota } }, + { NULL, { nullproc } }, }; unsigned linux_time = 0; @@ -231,9 +232,11 @@ void proc_get_btime() return; } -static char stat_str[] = "%d (%[^)]) %c %*d %*d %d %*d %*d %u %*u \ -%*u %*u %*u %d %d %d %d %*d %*d %*u %*u %u %u %u %*u %*u \ -%*u %*u %*u %*u %*u %*u %*u %*u %*u %*u %*u"; +static const char stat_str[] = +/* pid cmd state xx xx sessid xx xx flags xx */ +"%d (%[^)]) %c %*d %*d %d %*d %*d %u %*u " +/* xx xx xx utime stime cutime cstime xx xx xx xx start_time vsize rss */ +"%*u %*u %*u %d %d %d %d %*d %*d %*u %*u %u %u %u"; /* ** Convert jiffies to seconds. @@ -248,8 +251,8 @@ static char stat_str[] = "%d (%[^)]) %c * place of the ioctl call PIOCSTATUS in the irix imp of mom_mach.c * */ -proc_stat_t *get_proc_stat(pid) - int pid; +static proc_stat_t * +get_proc_stat(int pid) { static proc_stat_t ps; static char path[1024]; @@ -938,7 +941,7 @@ int mom_over_limit(pjob) num = (unsigned long)((double)(time_now - pjob->ji_qs.ji_stime) * wallfactor); if (num > value) { sprintf(log_buffer, - "walltime %d exceeded limit %d", + "walltime %lu exceeded limit %lu", num, value); return (TRUE); } @@ -1038,14 +1041,13 @@ int mom_set_use(pjob) * Kill a task session. * Call with the task pointer and a signal number. */ -int kill_task(ptask, sig) - task *ptask; - int sig; +int +kill_task(const task *ptask, int sig) { char *id = "kill_task"; int ct = 0; struct dirent *dent; - proc_stat_t *ps; + const proc_stat_t *ps; int sesid; @@ -1505,6 +1507,7 @@ struct rm_attribute *attrib; fmt = ret_string; for (j=0; j> 10); /* KB */ + sprintf(ret_string, "%lukb", sbuf.st_size >> 10); /* KB */ return ret_string; } @@ -1910,7 +1913,7 @@ struct rm_attribute *attrib; } closedir(dp); - sprintf(ret_string, "%d", MAX(0, curtm - maxtm)); + sprintf(ret_string, "%ld", MAX(0, curtm - maxtm)); return ret_string; } @@ -2203,10 +2206,10 @@ struct rm_attribute *attrib; sprintf(ret_string, "%u", qi.dqb_curinodes); break; case timedata: - sprintf(ret_string, "%u", gracetime((u_long)qi.dqb_btime)); + sprintf(ret_string, "%lu", gracetime(qi.dqb_btime)); break; case timefile: - sprintf(ret_string, "%u", gracetime((u_long)qi.dqb_itime)); + sprintf(ret_string, "%lu", gracetime(qi.dqb_itime)); break; } diff -puN src/resmom/mom_comm.c~compile-warning-fixes src/resmom/mom_comm.c --- pbs-2.3.12-orig/src/resmom/mom_comm.c~compile-warning-fixes 2004-08-06 17:51:07.000000000 -0400 +++ pbs-2.3.12/src/resmom/mom_comm.c 2004-08-06 17:51:50.000000000 -0400 @@ -154,8 +154,7 @@ char noglobid[] = "none"; ** Save the critical information associated with a task to disk. */ int -task_save(ptask) - task *ptask; +task_save(task *ptask) { static char id[] = "task_save"; job *pjob = ptask->ti_job; @@ -309,13 +308,13 @@ task_check(pjob, taskid) ptask = task_find(pjob, taskid); if (ptask == NULL) { - sprintf(log_buffer, "%s requesting task %ld not found", + sprintf(log_buffer, "%s requesting task %u not found", pjob->ji_qs.ji_jobid, taskid); log_err(-1, id, log_buffer); return NULL; } if (ptask->ti_fd < 0) { - sprintf(log_buffer, "cannot tm_reply to %s task %ld", + sprintf(log_buffer, "cannot tm_reply to %s task %u", pjob->ji_qs.ji_jobid, taskid); log_err(-1, id, log_buffer); return NULL; @@ -601,10 +600,7 @@ find_node(pjob, stream, nodeid) ** of the job. There should be no processes running at this point. */ void -job_start_error(pjob, code, nodename) - job *pjob; - int code; - char *nodename; +job_start_error(job *pjob, int code, char *nodename) { static char id[] = "job_start_error"; int nodes; diff -puN src/resmom/rm_dep.h~compile-warning-fixes src/resmom/rm_dep.h --- pbs-2.3.12-orig/src/resmom/rm_dep.h~compile-warning-fixes 2004-08-06 17:51:07.000000000 -0400 +++ pbs-2.3.12/src/resmom/rm_dep.h 2004-08-06 17:51:07.000000000 -0400 @@ -93,14 +93,14 @@ char *idletime A_((struct rm_attribute * char *nullproc A_((struct rm_attribute *attrib)); struct config standard_config[] = { - { "cput", cput }, - { "mem", mem }, - { "sessions", sessions }, - { "pids", pids }, - { "nsessions", nsessions }, - { "nusers", nusers }, - { "size", size }, - { "idletime", idletime }, - { NULL, nullproc }, + { "cput", { cput } }, + { "mem", { mem } }, + { "sessions", { sessions } }, + { "pids", { pids } }, + { "nsessions", { nsessions } }, + { "nusers", { nusers } }, + { "size", { size } }, + { "idletime", { idletime } }, + { NULL, { nullproc } }, }; diff -puN src/resmom/start_exec.c~compile-warning-fixes src/resmom/start_exec.c --- pbs-2.3.12-orig/src/resmom/start_exec.c~compile-warning-fixes 2004-08-06 17:51:07.000000000 -0400 +++ pbs-2.3.12/src/resmom/start_exec.c 2004-08-06 17:51:50.000000000 -0400 @@ -79,6 +79,7 @@ #include /* the master config generated by configure */ #include +#include #include #include #include @@ -263,6 +264,7 @@ int mom_restart_job(pjob, path) task *ptask; int tcount = 0; long mach_restart A_((task *, char *path)); + extern int task_save(task *ptask); if ((dir = opendir(path)) == NULL) { sprintf(log_buffer, "opendir %s", path); @@ -310,9 +312,7 @@ int mom_restart_job(pjob, path) } void -exec_bail(pjob, code) - job *pjob; - int code; +exec_bail(job *pjob, int code) { pjob->ji_qs.ji_substate = JOB_SUBSTATE_EXITING; pjob->ji_qs.ji_un.ji_momt.ji_exitstat = code; diff -puN src/server/attr_recov.c~compile-warning-fixes src/server/attr_recov.c --- pbs-2.3.12-orig/src/server/attr_recov.c~compile-warning-fixes 2004-08-06 17:51:07.000000000 -0400 +++ pbs-2.3.12/src/server/attr_recov.c 2004-08-06 17:51:48.000000000 -0400 @@ -98,6 +98,7 @@ #include #include #include +#include #include "list_link.h" #include "attribute.h" #include "log.h" diff -puN src/server/req_quejob.c~compile-warning-fixes src/server/req_quejob.c --- pbs-2.3.12-orig/src/server/req_quejob.c~compile-warning-fixes 2004-08-06 17:51:07.000000000 -0400 +++ pbs-2.3.12/src/server/req_quejob.c 2004-08-06 17:51:07.000000000 -0400 @@ -91,6 +91,8 @@ */ #include /* the master config generated by configure */ +#include +#include #include #include #include @@ -390,7 +392,7 @@ void req_quejob(preq) index = find_attr(job_attr_def, psatl->al_name, JOB_ATR_LAST); if (index < 0) { - /* didn`t recognize the name */ + /* didn't recognize the name */ #ifndef PBS_MOM index = JOB_ATR_UNKN; /* keep as "unknown" for now */ #else /* is PBS_MOM */ _