From 8c8fd7f3d096ec712330fe71f866bae50dc9dbc4 Mon Sep 17 00:00:00 2001 From: bdaw Date: Fri, 7 Dec 2012 16:47:52 -0700 Subject: [PATCH 01/20] Fixed a handful of coverity bugs. --- src/resmom/mom_comm.c | 22 ++++++++++++++++------ src/resmom/mom_server.c | 5 +++-- src/resmom/pbs_demux.c | 7 ++++++- src/resmom/prolog.c | 21 +++++++++++++-------- 4 files changed, 38 insertions(+), 17 deletions(-) diff --git a/src/resmom/mom_comm.c b/src/resmom/mom_comm.c index 7baea715ad..51e298e7a4 100644 --- a/src/resmom/mom_comm.c +++ b/src/resmom/mom_comm.c @@ -1880,7 +1880,8 @@ void send_im_error( else rc = DIS_tcp_wflush(local_chan); - close(socket); + if(socket >= 0) + close(socket); if (local_chan != NULL) { @@ -1963,7 +1964,8 @@ int reply_to_join_job_as_sister( else ret = DIS_tcp_wflush(local_chan); - close(socket); + if(socket >= 0) + close(socket); if (local_chan != NULL) { @@ -2875,7 +2877,9 @@ int im_spawn_task( else ret = DIS_tcp_wflush(local_chan); - close(local_socket); + if(socket >= 0) + close(local_socket); + if (local_chan != NULL) DIS_tcp_cleanup(local_chan); @@ -3056,7 +3060,9 @@ int im_signal_task( else DIS_tcp_wflush(local_chan); - close(socket); + if(socket >= 0) + close(socket); + if (local_chan != NULL) DIS_tcp_cleanup(local_chan); @@ -8076,7 +8082,11 @@ void fork_demux( int pipe_failed = FALSE; char buf[MAXLINE]; - maxfd = sysconf(_SC_OPEN_MAX); + if((maxfd = sysconf(_SC_OPEN_MAX)) < 0) + { + fprintf(stderr, "Unexpected return from sysconf."); + return; + } routem = (struct routefd *)calloc(sizeof(struct routefd), maxfd); if (routem == NULL) @@ -8108,7 +8118,7 @@ void fork_demux( close(pjob->ji_im_stdout); im_mom_stderr = dup(pjob->ji_im_stderr); - if (im_mom_stdout == -1) + if (im_mom_stderr == -1) { fprintf(stderr, "could not dup stdout in fork_demux"); free(routem); diff --git a/src/resmom/mom_server.c b/src/resmom/mom_server.c index 94084e92bd..7320a3abc3 100644 --- a/src/resmom/mom_server.c +++ b/src/resmom/mom_server.c @@ -591,7 +591,8 @@ void mom_server_stream_error( log_record(PBSEVENT_SYSTEM, 0, id, log_buffer); - close(stream); + if(stream >= 0) + close(stream); return; } /* END mom_server_stream_error() */ @@ -3071,7 +3072,7 @@ int mom_open_socket_to_jobs_server( } /* Associate a message handler with the connection */ - if (message_handler != NULL) + if ((message_handler != NULL)&&(sock >= 0)) { add_conn( sock, diff --git a/src/resmom/pbs_demux.c b/src/resmom/pbs_demux.c index 2a5df7121a..61af02a135 100644 --- a/src/resmom/pbs_demux.c +++ b/src/resmom/pbs_demux.c @@ -253,7 +253,12 @@ int main( #endif */ - maxfd = sysconf(_SC_OPEN_MAX); + if((maxfd = sysconf(_SC_OPEN_MAX)) < 0) + { + perror("unexpected return from sysconf."); + + exit(5); + } routem = (struct routem *)calloc(maxfd, sizeof(struct routem)); diff --git a/src/resmom/prolog.c b/src/resmom/prolog.c index 44f112f83c..e9d69f86a6 100644 --- a/src/resmom/prolog.c +++ b/src/resmom/prolog.c @@ -839,7 +839,7 @@ int run_pelog( fds2 = open_std_file(pjob, StdErr, O_WRONLY | O_APPEND, pjob->ji_qs.ji_un.ji_momt.ji_exgid); - fds1 = dup(fds2); + fds1 = (fds2 < 0)?-1:dup(fds2); break; @@ -848,7 +848,7 @@ int run_pelog( fds1 = open_std_file(pjob, StdOut, O_WRONLY | O_APPEND, pjob->ji_qs.ji_un.ji_momt.ji_exgid); - fds2 = dup(fds1); + fds2 = (fds1 < 0)?-1:dup(fds1); break; @@ -863,6 +863,9 @@ int run_pelog( } } + if((fds1 < 0)||(fds2 < 0)) + return -1; + if (pe_io_type != PE_IO_TYPE_ASIS) { /* If PE_IO_TYPE_ASIS, leave as is, already open to job */ @@ -871,18 +874,20 @@ int run_pelog( { close(1); - if (dup(fds1) == -1) {} - - close(fds1); + if (dup(fds1) >= 0) + { + close(fds1); + } } if (fds2 != 2) { close(2); - if (dup(fds2) == -1) {} - - close(fds2); + if (dup(fds2) >= 0) + { + close(fds2); + } } } From 1d2a5939c62f9443e67a86bc0a9055f6c22514fb Mon Sep 17 00:00:00 2001 From: root Date: Sat, 8 Dec 2012 07:08:01 -0700 Subject: [PATCH 02/20] Added changes which enable TORQUE to compile with c++. More changes to come. Also removed code for rpp.c --- configure.ac | 1 - doc/Makefile.am | 2 +- src/daemon_client/trq_auth_daemon.c | 4 +- src/gui/Ccode/xpbs_datadump.c | 8 +- src/include/Makefile.am | 2 +- src/include/array.h | 54 +- src/include/attribute.h | 2 +- src/include/pbs_config.h | 630 +++ src/include/pbs_error_db.h | 266 +- src/include/pbs_job.h | 117 +- src/include/site_job_attr_def.h | 111 + src/include/{rpp.h => site_job_attr_enum.h} | 73 +- src/include/site_qmgr_node_print.h | 91 + src/include/site_qmgr_que_print.h | 91 + src/include/site_qmgr_svr_print.h | 90 + src/include/site_que_attr_def.h | 102 + src/include/site_que_attr_enum.h | 92 + src/include/site_svr_attr_def.h | 102 + src/include/site_svr_attr_enum.h | 92 + src/lib/Libattr/attr_atomic.c | 6 +- src/lib/Libattr/attr_fn_acl.c | 48 +- src/lib/Libattr/attr_fn_arst.c | 12 +- src/lib/Libattr/attr_fn_str.c | 6 +- src/lib/Libattr/attr_func.c | 2 +- src/lib/Libattr/attr_node_func.c | 12 +- src/lib/Libattr/attr_node_func.h | 18 +- src/lib/Libcmds/add_verify_resources.c | 2 +- src/lib/Libcmds/cvtdate.c | 7 +- src/lib/Libcmds/parse_depend.c | 38 +- src/lib/Libcmds/prepare_path.c | 6 +- src/lib/Libcmds/set_resource.c | 6 +- src/lib/Libifl/Makefile.am | 2 +- src/lib/Libifl/PBSD_status.c | 2 +- src/lib/Libifl/PBSD_submit_caps.c | 2 +- src/lib/Libifl/dec_attrl.c | 2 +- src/lib/Libifl/dec_attropl.c | 2 +- src/lib/Libifl/enc_CpyFil.c | 2 +- src/lib/Libifl/enc_JobFile.c | 2 +- src/lib/Libifl/enc_QueueJob.c | 4 +- src/lib/Libifl/enc_QueueJob_hash.c | 4 +- src/lib/Libifl/enc_attropl_hash.c | 8 +- src/lib/Libifl/lib_ifl.h | 5 +- src/lib/Libifl/pbsD_asyrun.c | 2 +- src/lib/Libifl/pbsD_connect.c | 12 +- src/lib/Libifl/pbsD_holdjob.c | 4 +- src/lib/Libifl/pbsD_movejob.c | 2 +- src/lib/Libifl/pbsD_resc.c | 10 +- src/lib/Libifl/pbsD_rlsjob.c | 4 +- src/lib/Libifl/pbsD_runjob.c | 2 +- src/lib/Libifl/pbsD_stagein.c | 2 +- src/lib/Libifl/pbsD_statsrv.c | 4 +- src/lib/Libifl/pbsD_submit.c | 2 +- src/lib/Libifl/pbsD_submit_hash.c | 2 +- src/lib/Libifl/rpp.c | 4260 ----------------- src/lib/Libifl/tcp_dis.c | 8 +- src/lib/Libifl/test/Makefile.am | 2 +- src/lib/Libifl/test/rpp/Makefile.am | 27 - src/lib/Libifl/test/rpp/scaffolding.c | 10 - src/lib/Libifl/test/rpp/test_rpp.c | 53 - src/lib/Libifl/test/rpp/test_rpp.h | 11 - src/lib/Libifl/tm.c | 6 +- src/lib/Libifl/torquecfg.c | 2 +- src/lib/Libifl/trq_auth.c | 2 +- src/lib/Liblog/chk_file_sec.c | 18 +- src/lib/Liblog/pbs_log.c | 60 +- src/lib/Liblog/pbs_messages.c | 168 +- src/lib/Liblog/setup_env.c | 4 +- src/lib/Libnet/conn_table.c | 2 +- src/lib/Libnet/get_hostaddr.c | 41 +- src/lib/Libnet/net_cache.c | 4 +- src/lib/Libnet/net_common.c | 40 +- src/lib/Libnet/net_server.c | 16 +- src/lib/Libnet/rm.c | 2 +- src/lib/Libnet/server_core.c | 4 +- src/lib/Libpbs/Makefile.am | 2 +- src/lib/Libutils/u_MXML.c | 2 +- src/lib/Libutils/u_dynamic_string.c | 6 +- src/lib/Libutils/u_hash_map.c | 6 +- src/lib/Libutils/u_hash_map_structs.c | 4 +- src/lib/Libutils/u_hash_table.c | 18 +- src/lib/Libutils/u_lock_ctl.c | 12 +- src/lib/Libutils/u_memmgr.c | 4 +- src/lib/Libutils/u_mom_hierarchy.c | 13 +- src/lib/Libutils/u_mu.c | 3 +- src/lib/Libutils/u_resizable_array.c | 9 +- src/lib/Libutils/u_threadpool.c | 3 +- src/lib/Libutils/u_tree.c | 2 +- src/lib/Libutils/u_xml.c | 4 +- src/resmom/catch_child.c | 8 +- src/resmom/checkpoint.c | 18 +- src/resmom/cygwin/mom_mach.c | 30 +- src/resmom/darwin/mom_mach.c | 28 +- src/resmom/hpux11/mom_mach.c | 18 +- src/resmom/irix6array/mom_mach.c | 36 +- src/resmom/linux/cpuset.c | 24 +- src/resmom/linux/mom_mach.c | 36 +- src/resmom/linux/mom_start.c | 3 +- src/resmom/mic.c | 2 +- src/resmom/mom_comm.c | 130 +- src/resmom/mom_job_func.c | 10 +- src/resmom/mom_main.c | 114 +- src/resmom/mom_main.h | 2 - src/resmom/mom_req_quejob.c | 12 +- src/resmom/mom_server.c | 4 +- src/resmom/nvidia.c | 18 +- src/resmom/prolog.c | 26 +- src/resmom/requests.c | 10 +- src/resmom/solaris7/mom_mach.c | 26 +- src/resmom/start_exec.c | 128 +- src/resmom/sunos4/mom_mach.c | 58 +- src/resmom/test/requests/scaffolding.c | 6 - src/resmom/tmsock_recov.c | 8 +- src/resmom/unicos8/mom_mach.c | 44 +- src/resmom/unicos8/mom_start.c | 6 +- src/resmom/unicosmk2/mom_mach.c | 20 +- src/resmom/unicosmk2/mom_start.c | 6 +- src/scheduler.basl/af_cnodemap.c | 2 +- src/scheduler.basl/af_config.c | 2 +- src/scheduler.basl/af_resmom.c | 2 +- src/scheduler.basl/af_server.c | 12 +- src/scheduler.basl/af_system.c | 43 +- src/scheduler.cc/pbs_sched.c | 51 +- src/scheduler.tcl/pbs_sched.c | 12 - src/server/accounting.c | 10 +- src/server/array_func.c | 70 +- src/server/attr_recov.c | 16 +- src/server/exiting_jobs.c | 4 +- src/server/geteusernam.c | 12 +- src/server/issue_request.c | 22 +- src/server/job_attr_def.c | 168 +- src/server/job_container.c | 68 +- src/server/job_func.c | 102 +- src/server/job_recov.c | 28 +- src/server/job_recycler.c | 4 +- src/server/job_route.c | 8 +- src/server/node_attr_def.c | 32 +- src/server/node_func.c | 18 +- src/server/node_func.h | 14 +- src/server/node_manager.c | 164 +- src/server/pbsd_init.c | 86 +- src/server/pbsd_main.c | 98 +- src/server/process_alps_status.c | 14 +- src/server/process_mom_update.c | 4 +- src/server/process_request.c | 4 +- src/server/queue_attr_def.c | 106 +- src/server/queue_func.c | 44 +- src/server/queue_recov.c | 24 +- src/server/queue_recycler.c | 4 +- src/server/receive_mom_communication.c | 6 +- src/server/req_delete.c | 48 +- src/server/req_deletearray.c | 22 +- src/server/req_holdarray.c | 12 +- src/server/req_holdjob.c | 36 +- src/server/req_jobobit.c | 142 +- src/server/req_locate.c | 2 +- src/server/req_manager.c | 22 +- src/server/req_manager.h | 2 +- src/server/req_message.c | 4 +- src/server/req_modify.c | 60 +- src/server/req_movejob.c | 30 +- src/server/req_quejob.c | 62 +- src/server/req_register.c | 34 +- src/server/req_rerun.c | 12 +- src/server/req_runjob.c | 68 +- src/server/req_select.c | 24 +- src/server/req_shutdown.c | 12 +- src/server/req_signal.c | 16 +- src/server/req_stat.c | 62 +- src/server/req_track.c | 12 +- src/server/run_sched.c | 6 +- src/server/svr_attr_def.c | 184 +- src/server/svr_chk_owner.c | 4 +- src/server/svr_func.c | 14 +- src/server/svr_func.h | 2 +- src/server/svr_jobfunc.c | 90 +- src/server/svr_movejob.c | 50 +- src/server/svr_recov.c | 20 +- src/server/svr_task.c | 12 +- src/server/svr_task.h | 2 +- .../test/process_alps_status/scaffolding.c | 4 +- .../track_alps_reservations/scaffolding.c | 2 +- src/server/track_alps_reservations.c | 2 +- src/server/user_info.c | 2 +- 183 files changed, 3583 insertions(+), 6580 deletions(-) create mode 100644 src/include/pbs_config.h create mode 100644 src/include/site_job_attr_def.h rename src/include/{rpp.h => site_job_attr_enum.h} (84%) create mode 100644 src/include/site_qmgr_node_print.h create mode 100644 src/include/site_qmgr_que_print.h create mode 100644 src/include/site_qmgr_svr_print.h create mode 100644 src/include/site_que_attr_def.h create mode 100644 src/include/site_que_attr_enum.h create mode 100644 src/include/site_svr_attr_def.h create mode 100644 src/include/site_svr_attr_enum.h delete mode 100644 src/lib/Libifl/rpp.c delete mode 100644 src/lib/Libifl/test/rpp/Makefile.am delete mode 100644 src/lib/Libifl/test/rpp/scaffolding.c delete mode 100644 src/lib/Libifl/test/rpp/test_rpp.c delete mode 100644 src/lib/Libifl/test/rpp/test_rpp.h diff --git a/configure.ac b/configure.ac index c3ca9f1730..fc216db5f6 100644 --- a/configure.ac +++ b/configure.ac @@ -328,7 +328,6 @@ m4_ifdef([AM_SILENT_RULES],[ src/lib/Libifl/test/pbsD_termin/Makefile src/lib/Libifl/test/pbs_geterrmg/Makefile src/lib/Libifl/test/pbs_statfree/Makefile - src/lib/Libifl/test/rpp/Makefile src/lib/Libifl/test/tcp_dis/Makefile src/lib/Libifl/test/tm/Makefile src/lib/Libifl/test/torquecfg/Makefile diff --git a/doc/Makefile.am b/doc/Makefile.am index 40136c137c..0175cf75cb 100644 --- a/doc/Makefile.am +++ b/doc/Makefile.am @@ -96,7 +96,7 @@ nodist_man3_MANS = man3/pbs_alterjob.3 \ man3/pbs_submit.3 \ man3/pbs_terminate.3 -dist_man3_MANS = man3/rpp.3 man3/tm.3 +dist_man3_MANS = man3/tm.3 nodist_man7_MANS = man7/pbs_job_attributes.7 \ man7/pbs_queue_attributes.7 \ diff --git a/src/daemon_client/trq_auth_daemon.c b/src/daemon_client/trq_auth_daemon.c index 3e0468ee55..8145b992d9 100644 --- a/src/daemon_client/trq_auth_daemon.c +++ b/src/daemon_client/trq_auth_daemon.c @@ -164,7 +164,7 @@ int daemonize_trqauthd(char *server_ip, int server_port, void *(*process_meth)(v { openlog("daemonize_trqauthd", LOG_PID | LOG_NOWAIT, LOG_DAEMON); syslog(LOG_ALERT, "Failed to create client_logs directory: errno: %d", errno); - log_err(errno,"daemonize_trqauthd", "Failed to create client_logs directory"); + log_err(errno,"daemonize_trqauthd", (char *)"Failed to create client_logs directory"); closelog(); } pthread_mutex_lock(log_mutex); @@ -177,7 +177,7 @@ int daemonize_trqauthd(char *server_ip, int server_port, void *(*process_meth)(v { openlog("daemonize_trqauthd", LOG_PID | LOG_NOWAIT, LOG_DAEMON); syslog(LOG_ALERT, "trqauthd could not start: %d\n", rc); - log_err(rc, "daemonize_trqauthd", "trqauthd could not start"); + log_err(rc, "daemonize_trqauthd", (char *)"trqauthd could not start"); pthread_mutex_lock(log_mutex); log_close(1); pthread_mutex_unlock(log_mutex); diff --git a/src/gui/Ccode/xpbs_datadump.c b/src/gui/Ccode/xpbs_datadump.c index d6fb550eef..deed7f143d 100644 --- a/src/gui/Ccode/xpbs_datadump.c +++ b/src/gui/Ccode/xpbs_datadump.c @@ -1186,8 +1186,7 @@ display_statserver(struct batch_status *status, int prtheader, int full, int nod } printf(format, name, max, tot, que, run, hld, wat, trn, ext, stats, - - nod, p->name ? p->name : ""); + nod, p->name ? p->name : (char *)""); } if (full) printf("\n"); @@ -1309,7 +1308,7 @@ int main( /* qstat */ struct attropl *select_list = 0; - static char destination[PBS_MAXQUEUENAME+1] = ""; + static char destination[PBS_MAXQUEUENAME+1]; char *server_name_out; @@ -1325,6 +1324,9 @@ int main( /* qstat */ struct sigaction act; + destination[0] = '\0'; + + #define GETOPT_ARGS "a:A:c:h:l:N:p:q:r:s:u:JTt:" while ((c = getopt(argc, argv, GETOPT_ARGS)) != EOF) diff --git a/src/include/Makefile.am b/src/include/Makefile.am index 9b1715388d..8b2d7579ef 100644 --- a/src/include/Makefile.am +++ b/src/include/Makefile.am @@ -1,7 +1,7 @@ include $(top_srcdir)/buildutils/config.mk include_HEADERS = libcmds.h license_pbs.h pbs_constants.h pbs_cmds.h pbs_error.h \ - pbs_error_db.h pbs_ifl.h rm.h rpp.h tm.h tm_.h u_hash_map_structs.h \ + pbs_error_db.h pbs_ifl.h rm.h tm.h tm_.h u_hash_map_structs.h \ u_memmgr.h uthash.h tcp.h noinst_HEADERS = acct.h array.h assertions.h attribute.h batch_request.h \ diff --git a/src/include/array.h b/src/include/array.h index 09298fdf49..447c0bcfc8 100644 --- a/src/include/array.h +++ b/src/include/array.h @@ -94,6 +94,34 @@ struct job_array_259 typedef struct job_array_259 job_array_259; +/* this info is saved in the array file */ +struct array_info + { + /* NOTE, struct_version _must_ come first in the struct */ + int struct_version; /* version of this struct */ + int array_size; /* size of the array used to track the jobs */ + int num_jobs; /* total number of jobs in the array */ + int slot_limit; /* number of jobs in the array that can be run at one time */ + int jobs_running; /* number of jobs in the array currently running */ + int jobs_done; /* number of jobs that have been deleted, etc. */ + int num_cloned; /* number of jobs out of the array that have been created */ + int num_started; /* number of jobs that have begun execution */ + int num_failed; /* number of jobs that exited with status != 0 */ + int num_successful; /* number of jobs that exited with status == 0 */ + + /* dependency info */ + tlist_head deps; + + /* max user name, server name, 1 for the @, and one for the NULL */ + char owner[PBS_MAXUSER + PBS_MAXSERVERNAME + 2]; + char parent_id[PBS_MAXSVRJOBID + 1]; + char fileprefix[PBS_JOBBASE + 1]; + char submit_host[PBS_MAXSERVERNAME +1]; + int num_purged; /* number of jobs which have called purge_job */ + }; + +typedef struct array_info array_info; + /* pbs_server will keep a list of these structs, with one struct per job array*/ struct job_array @@ -113,32 +141,10 @@ struct job_array pthread_mutex_t *ai_mutex; /* this info is saved in the array file */ - struct array_info - { - /* NOTE, struct_version _must_ come first in the struct */ - int struct_version; /* version of this struct */ - int array_size; /* size of the array used to track the jobs */ - int num_jobs; /* total number of jobs in the array */ - int slot_limit; /* number of jobs in the array that can be run at one time */ - int jobs_running; /* number of jobs in the array currently running */ - int jobs_done; /* number of jobs that have been deleted, etc. */ - int num_cloned; /* number of jobs out of the array that have been created */ - int num_started; /* number of jobs that have begun execution */ - int num_failed; /* number of jobs that exited with status != 0 */ - int num_successful; /* number of jobs that exited with status == 0 */ - - /* dependency info */ - tlist_head deps; - - /* max user name, server name, 1 for the @, and one for the NULL */ - char owner[PBS_MAXUSER + PBS_MAXSERVERNAME + 2]; - char parent_id[PBS_MAXSVRJOBID + 1]; - char fileprefix[PBS_JOBBASE + 1]; - char submit_host[PBS_MAXSERVERNAME +1]; - int num_purged; /* number of jobs which have called purge_job */ - } ai_qs; + array_info ai_qs; }; + typedef struct job_array job_array; struct all_arrays diff --git a/src/include/attribute.h b/src/include/attribute.h index bfdfee0a6f..5fa05a419d 100644 --- a/src/include/attribute.h +++ b/src/include/attribute.h @@ -440,7 +440,7 @@ extern void free_unkn(pbs_attribute *); extern int parse_equal_string(char *, char **, char **); extern char *parse_comma_string(char *,char **); -#define NULL_FUNC (int (*)())0 +#define NULL_FUNC '\0' /* other associated funtions */ struct dynamic_string; diff --git a/src/include/pbs_config.h b/src/include/pbs_config.h new file mode 100644 index 0000000000..91e49ba7a5 --- /dev/null +++ b/src/include/pbs_config.h @@ -0,0 +1,630 @@ +/* src/include/pbs_config.h. Generated from pbs_config.h.in by configure. */ +/* src/include/pbs_config.h.in. Generated from configure.ac by autoheader. */ + +#ifndef _PBS_CONFIG_H_ +#define _PBS_CONFIG_H_ + +/* Define to add x attributes to accounting log */ +/* #undef ATTR_X_ACCT */ + +/* turns on the compilation of AUTORUN_JOBS code */ +/* #undef AUTORUN_JOBS */ + +/* 1234 = LIL_ENDIAN, 4321 = BIGENDIAN */ +/* #undef BYTEORDER */ + +/* turns on the compilation of DEBUG code */ +/* #undef DEBUG */ + +/* Alternate directory for MOM logs */ +/* #undef DEFAULT_MOMLOGDIR */ + +/* Alternate suffix for MOM logs */ +/* #undef DEFAULT_MOMLOGSUFFIX */ + +/* Define to disable daemons */ +/* #undef DISABLE_DAEMONS */ + +/* Define to enable BLCR support */ +/* #undef ENABLE_BLCR */ + +/* Define to enable Cray's CPA support */ +/* #undef ENABLE_CPA */ + +/* Define to enable Cray's CSA support */ +/* #undef ENABLE_CSA */ + +/* Define to enable unix domain sockets */ +/* #undef ENABLE_UNIX_SOCKETS */ + +/* are FD_SET and friends defined in sys/select.h */ +#define FD_SET_IN_SYS_SELECT_H 1 + +/* Define to the type of elements in the array set by `getgroups'. Usually + this is either `int' or `gid_t'. */ +#define GETGROUPS_T gid_t + +/* Define to 1 if you have the header file. */ +#define HAVE_ARPA_INET_H 1 + +/* Define to 1 if you have the `asprintf' function. */ +/* #undef HAVE_ASPRINTF */ + +/* Define to 1 if you have the `atexit' function. */ +#define HAVE_ATEXIT 1 + +/* Define to 1 if you have the `bindresvport' function. */ +#define HAVE_BINDRESVPORT 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_BITMASK_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_CPALIB_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_CPUSET_H */ + +/* Define to 1 if you have the declaration of `strerror_r', and to 0 if you + don't. */ +/* #undef HAVE_DECL_STRERROR_R */ + +/* Define to 1 if you have the header file, and it defines `DIR'. + */ +#define HAVE_DIRENT_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_DLFCN_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_ERR_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_FCNTL_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_FLOAT_H 1 + +/* Define to 1 if you have the `fstat' function. */ +/* #undef HAVE_FSTAT */ + +/* Define to 1 if you have the `getaddrinfo' function. */ +#define HAVE_GETADDRINFO 1 + +/* Define to 1 if you have the `getcwd' function. */ +/* #undef HAVE_GETCWD */ + +/* Define to 1 if your system has a working `getgroups' function. */ +#define HAVE_GETGROUPS 1 + +/* Define to 1 if you have the `gettimeofday' function. */ +#define HAVE_GETTIMEOFDAY 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_INTTYPES_H 1 + +/* Define to 1 if you have the `cpuset' library (-lcpuset). */ +/* #undef HAVE_LIBCPUSET */ + +/* Define to 1 if you have the `crypto' library (-lcrypto). */ +#define HAVE_LIBCRYPTO 1 + +/* Define to 1 if you have the `elf' library (-lelf). */ +/* #undef HAVE_LIBELF */ + +/* Define to 1 if you have the `hwloc' library (-lhwloc). */ +/* #undef HAVE_LIBHWLOC */ + +/* Define to 1 if you have the `kvm' library (-lkvm). */ +/* #undef HAVE_LIBKVM */ + +/* Define to 1 if you have the `memacct' library (-lmemacct). */ +/* #undef HAVE_LIBMEMACCT */ + +/* Define to 1 if you have the `nsl' library (-lnsl). */ +/* #undef HAVE_LIBNSL */ + +/* Define to 1 if you have the `resolv' library (-lresolv). */ +/* #undef HAVE_LIBRESOLV */ + +/* Define to 1 if you have the `socket' library (-lsocket). */ +/* #undef HAVE_LIBSOCKET */ + +/* Define to 1 if you have the `ssl' library (-lssl). */ +#define HAVE_LIBSSL 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_LIMITS_H 1 + +/* Define if lseek64() is available */ +#define HAVE_LSEEK64 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_MACH_SHARED_REGION_H */ + +/* Define to 1 if you have the header file. */ +#define HAVE_MALLOC_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_MEMORY_H 1 + +/* Define to 1 if you have the `mkstemp' function. */ +/* #undef HAVE_MKSTEMP */ + +/* Define to 1 if you have the header file, and it defines `DIR'. */ +/* #undef HAVE_NDIR_H */ + +/* Define to 1 if you have the header file. */ +#define HAVE_NETDB_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_NETINET_IN_H 1 + +/* Define to 1 if you have the `on_exit' function. */ +/* #undef HAVE_ON_EXIT */ + +/* Define if open64() is available */ +#define HAVE_OPEN64 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_PAM_PAM_MODULES_H */ + +/* Define to 1 if you have the `poll' function. */ +#define HAVE_POLL 1 + +/* Define if you have POSIX threads libraries and header files. */ +/* #undef HAVE_PTHREAD */ + +/* include readline support */ +/* #undef HAVE_READLINE */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_READLINE_READLINE_H */ + +/* Define to 1 if you have the `rresvport' function. */ +#define HAVE_RRESVPORT 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SECURITY_PAM_APPL_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SECURITY_PAM_MODULES_H 1 + +/* Define to 1 if you have the `setegid' function. */ +#define HAVE_SETEGID 1 + +/* Define to 1 if you have the `seteuid' function. */ +#define HAVE_SETEUID 1 + +/* Define to 1 if you have the `setresgid' function. */ +/* #undef HAVE_SETRESGID */ + +/* Define to 1 if you have the `setresuid' function. */ +/* #undef HAVE_SETRESUID */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_SOURCE_COIPIPELINE_SOURCE_H */ + +/* Define if stat64() is available */ +#define HAVE_STAT64 1 + +/* Define to 1 if stdbool.h conforms to C99. */ +/* #undef HAVE_STDBOOL_H */ + +/* Define to 1 if you have the header file. */ +#define HAVE_STDDEF_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STDINT_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STDLIB_H 1 + +/* Define to 1 if you have the `strchr' function. */ +/* #undef HAVE_STRCHR */ + +/* Define to 1 if you have the `strdup' function. */ +/* #undef HAVE_STRDUP */ + +/* Define to 1 if you have the `strerror' function. */ +/* #undef HAVE_STRERROR */ + +/* Define to 1 if you have the `strerror_r' function. */ +/* #undef HAVE_STRERROR_R */ + +/* Define to 1 if you have the `strftime' function. */ +/* #undef HAVE_STRFTIME */ + +/* Define to 1 if you have the header file. */ +#define HAVE_STRINGS_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STRING_H 1 + +/* Define to 1 if you have the `strlcpy' function. */ +/* #undef HAVE_STRLCPY */ + +/* Define if struct stat64 is available */ +#define HAVE_STRUCT_STAT64 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYSLOG_H 1 + +/* Define to 1 if you have the header file, and it defines `DIR'. + */ +/* #undef HAVE_SYS_DIR_H */ + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_FILE_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_IOCTL_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_MOUNT_H 1 + +/* Define to 1 if you have the header file, and it defines `DIR'. + */ +/* #undef HAVE_SYS_NDIR_H */ + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_PARAM_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_POLL_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_SOCKET_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_STATFS_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_STATVFS_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_STAT_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_TIME_H 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_SYS_TTY_H */ + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_TYPES_H 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_SYS_UCRED_H */ + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_UIO_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_UN_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_VFS_H 1 + +/* Define to 1 if you have that is POSIX.1 compatible. */ +#define HAVE_SYS_WAIT_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_TERMIOS_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_UNISTD_H 1 + +/* Define to 1 if you have the `vasprintf' function. */ +/* #undef HAVE_VASPRINTF */ + +/* Define to 1 if you have the va_copy function. */ +/* #undef HAVE_VA_COPY */ + +/* Define to 1 if you have the `wordexp' function. */ +#define HAVE_WORDEXP 1 + +/* Define to 1 if the system has the type `_Bool'. */ +/* #undef HAVE__BOOL */ + +/* Define to 1 if you have the __va_copy function. */ +/* #undef HAVE___VA_COPY */ + +/* is the global int h_errno declared in netdb.h */ +/* #undef H_ERRNO_DECLARED */ + +/* defined if this is an SP2 */ +#define IBM_SP2 0 + +/* Define if open64, stat64, and friends work */ +#define LARGEFILE_WORKS 1 + +/* Define to the sub-directory in which libtool stores uninstalled libraries. + */ +#define LT_OBJDIR ".libs/" + +/* the machine specific resc_def_* file name */ +#define MACH_RESC_DEFS "resc_def_linux.c" + +/* Define to enable MIC support */ +/* #undef MIC */ + +/* Define to error if spool is full on MOM */ +#define MOMCHECKLOCALSPOOL 1 + +/* whether checkpointing is supported */ +#define MOM_CHECKPOINT 0 + +/* force creation of nodefile */ +#define MOM_FORCENODEFILE 0 + +#ifndef NEED_BLOCKING_CONNECTIONS +#define write(a,b,c) write_nonblocking_socket(a,b,c) +#define read(a,b,c) read_nonblocking_socket(a,b,c) +#endif + +/* use nodemask-based scheduling on O2k */ +/* #undef NODEMASK */ + +/* Define to disable mlockall */ +/* #undef NOPOSIXMEMLOCK */ + +/* Define to disable privileged ports */ +/* #undef NOPRIVPORTS */ + +/* directly use homedirs instead of $TORQUEHOME/spool */ +#define NO_SPOOL_OUTPUT 0 + +/* Define if ntohl() is declared in arpa/inet.h */ +/* #undef NTOHL_NEEDS_ARPA_INET_H */ + +/* Define to enable Nvidia gpu support */ +/* #undef NVIDIA_GPUS */ + +/* Define to enable Nvidia NVML api support */ +/* #undef NVML_API */ + +/* Name of package */ +#define PACKAGE "torque" + +/* Define to the address where bug reports for this package should be sent. */ +#define PACKAGE_BUGREPORT "torqueusers@supercluster.org" + +/* Define to the full name of this package. */ +#define PACKAGE_NAME "torque" + +/* Define to the full name and version of this package. */ +#define PACKAGE_STRING "torque 4.2.0" + +/* Define to the one symbol short name of this package. */ +#define PACKAGE_TARNAME "torque" + +/* Define to the home page for this package. */ +#define PACKAGE_URL "" + +/* Define to the version of this package. */ +#define PACKAGE_VERSION "4.2.0" + +/* Define to the build date */ +#define PBS_BUILD_DATE "Sat Dec 8 06:46:21 MST 2012" + +/* Define to the build directory */ +#define PBS_BUILD_DIR "/sdb/dev/torque/actorque/torque.new" + +/* Define to the build hostname */ +#define PBS_BUILD_HOST "kmn" + +/* Define to the building username */ +#define PBS_BUILD_USER "knielson" + +/* Define to the install directory */ +#define PBS_CFLAGS "-g -W -Wall -Wno-unused-parameter -Wno-long-long -pedantic -Werror -D_LARGEFILE64_SOURCE -I/opt/intel/mic/coi/include" + +/* Define to the install directory */ +#define PBS_CONFIG_ARGS " '--with-debug' '--enable-gcc-warnings' '--with-server-home=/sdb/torque'" + +/* Define to the name of the default PBS server */ +#define PBS_DEFAULT_SERVER "kmn" + +/* Define to the install directory */ +#define PBS_INSTALL_DIR "/usr/local" + +/* the PBS style machine type name */ +#define PBS_MACH "linux" + +/* Define to the source directory */ +#define PBS_SOURCE_DIR "/sdb/dev/torque/actorque/torque.new" + +/* Define to enable Linux 2.6 cpusets */ +/* #undef PENABLE_LINUX26_CPUSETS */ + +/* use pemask-based scheduling on Cray T3e */ +/* #undef PE_MASK */ + +/* Select which daemons plock themselves, a bit pattern */ +#define PLOCK_DAEMONS 0 + +/* Define to necessary symbol if this constant uses a non-standard name on + your system. */ +/* #undef PTHREAD_CREATE_JOINABLE */ + +/* Define if you are on a solaris box */ +/* #undef PUSH_STREAM */ + +/* Define to the path of the qstat init file */ +#define QSTATRC_PATH "/sdb/torque/qstatrc" + +/* turns on the QSUB_KEEP_NO_OVERRIDE flag */ +/* #undef QSUB_KEEP_NO_OVERRIDE */ + +/* turns on the compilation of QUICKCOMMIT code */ +/* #undef QUICKCOMMIT */ + +/* turns on the compilation of RESOURCEMAXDEFAULT code */ +/* #undef RESOURCEMAXDEFAULT */ + +/* set the type of scheduler to use */ +#define SCHD_TYPE "cc" + +/* full pathname of sendmail */ +#define SENDMAIL_CMD "sendmail" + +/* Directory for Server checkpoint files */ +/* #undef SERVER_CHKPTDIR */ + +/* Define to set the controlling tty */ +/* #undef SETCONTROLLINGTTY */ + +/* set whether job scripts use a pipe */ +#define SHELL_INVOKE 1 + +/* job script name passed as the shell's arg */ +#define SHELL_USE_ARGV 0 + +/* The size of `double', as computed by sizeof. */ +#define SIZEOF_DOUBLE 8 + +/* The size of `float', as computed by sizeof. */ +#define SIZEOF_FLOAT 4 + +/* The size of `int', as computed by sizeof. */ +#define SIZEOF_INT 4 + +/* The size of `long', as computed by sizeof. */ +#define SIZEOF_LONG 8 + +/* The size of `long double', as computed by sizeof. */ +#define SIZEOF_LONG_DOUBLE 16 + +/* The size of `short', as computed by sizeof. */ +#define SIZEOF_SHORT 2 + +/* The size of `signed char', as computed by sizeof. */ +#define SIZEOF_SIGNED_CHAR 1 + +/* The size of `unsigned', as computed by sizeof. */ +#define SIZEOF_UNSIGNED 4 + +/* The size of `unsigned char', as computed by sizeof. */ +#define SIZEOF_UNSIGNED_CHAR 1 + +/* The size of `unsigned int', as computed by sizeof. */ +#define SIZEOF_UNSIGNED_INT 4 + +/* The size of `unsigned long', as computed by sizeof. */ +#define SIZEOF_UNSIGNED_LONG 8 + +/* The size of `unsigned short', as computed by sizeof. */ +#define SIZEOF_UNSIGNED_SHORT 2 + +/* include support for SRFS on Cray */ +#define SRFS 0 + +/* Define to 1 if you have the ANSI C header files. */ +#define STDC_HEADERS 1 + +/* Define to 1 if strerror_r returns char *. */ +/* #undef STRERROR_R_CHAR_P */ + +/* repository svn version */ +#define SVN_VERSION "unknown" + +/* Define to enable syslog */ +#define SYSLOG 1 + +/* Define if PBS should use Tcl in its tools */ +#define TCL 0 + +/* Define if PBS should use TclX in its tools */ +#define TCLX 0 + +/* the seperator for Tcl attribute parsing */ +#define TCL_ATRSEP "." + +/* Define if PBS should build qstat with Tcl */ +/* #undef TCL_QSTAT */ + +/* Define to set a max retry limit */ +#define TCP_RETRY_LIMIT 0 + +/* Define to prevent sync writes */ +#define TDISABLEFILESYNC 1 + +/* Define if PBS should use Tk in its tools */ +#define TK 0 + +/* Define if PBS should use Tkx in its tools */ +#define TKX 0 + +/* override the default domain for outgoing mail messages */ +/* #undef TMAILDOMAIN */ + +/* The pathname of the Cray temporary directory for mom */ +#define TMP_DIR "/tmp" + +/* Define if building on unsupported OS */ +/* #undef UNSUPPORTED_MACH */ + +/* Define to enable libjob job_create support */ +/* #undef USEJOBCREATE */ + +/* Define to enable libcpuset support */ +/* #undef USELIBCPUSET */ + +/* Define to enable libmemacct support */ +/* #undef USELIBMEMACCT */ + +/* Define on ancient linux distros */ +/* #undef USEOLDTTY */ + +/* Version number of package */ +#define VERSION "4.2.0" + +/* whether byteorder is bigendian */ +/* #undef WORDS_BIGENDIAN */ + +/* Define to the path of xauth */ +#define XAUTH_PATH "/usr/bin/xauth" + +/* Define to 1 if `lex' declares `yytext' as a `char *' by default, not a + `char[]'. */ +#define YYTEXT_POINTER 1 + +/* Define _GNU_SOURCE for portability */ +#define _GNU_SOURCE 1 + +/* Define to 1 if type `char' is unsigned and you are not using gcc. */ +#ifndef __CHAR_UNSIGNED__ +/* # undef __CHAR_UNSIGNED__ */ +#endif + +/* Define to `int' if doesn't define. */ +/* #undef gid_t */ + +/* type to use for 2nd arg of pam_get_user */ +#define pam_get_user_2nd_arg_t const char + +/* Define to `unsigned int' if does not define. */ +/* #undef size_t */ + +/* type to use in place of socklen_t if not defined */ +#define torque_socklen_t socklen_t + +/* Define to `int' if doesn't define. */ +/* #undef uid_t */ + + +#ifndef HAVE_VA_COPY +# define va_copy(a,b) __va_copy(a,b) +#endif + + + +#ifndef __GNUC__ +# define __attribute__ /* nothing */ +#endif + + + +#endif /* _PBS_CONFIG_H_ */ + diff --git a/src/include/pbs_error_db.h b/src/include/pbs_error_db.h index e186273c48..435c0879b7 100644 --- a/src/include/pbs_error_db.h +++ b/src/include/pbs_error_db.h @@ -24,233 +24,233 @@ #ifdef PbsErrClient /* 15000 */ /* pbs client errors floor (min_client_err - 1) */ -PbsErrClient(PBSE_FLOOR = 15000, "no error") /* also works as no error */ +PbsErrClient(PBSE_FLOOR = 15000, (char *)"no error") /* also works as no error */ /* Unknown Job Identifier */ -PbsErrClient(PBSE_UNKJOBID, "Unknown Job Id Error") +PbsErrClient(PBSE_UNKJOBID, (char *)"Unknown Job Id Error") /* Undefined Attribute */ -PbsErrClient(PBSE_NOATTR, "Undefined attribute ") +PbsErrClient(PBSE_NOATTR, (char *)"Undefined attribute ") /* attempt to set READ ONLY attribute */ -PbsErrClient(PBSE_ATTRRO, "Cannot set attribute, read only or insufficient permission ") +PbsErrClient(PBSE_ATTRRO, (char *)"Cannot set attribute, read only or insufficient permission ") /* Invalid request */ -PbsErrClient(PBSE_IVALREQ, "Invalid request") +PbsErrClient(PBSE_IVALREQ, (char *)"Invalid request") /* Unknown batch request */ -PbsErrClient(PBSE_UNKREQ, "Unknown request") +PbsErrClient(PBSE_UNKREQ, (char *)"Unknown request") /* Too many submit retries */ -PbsErrClient(PBSE_TOOMANY, "Too many submit retries") +PbsErrClient(PBSE_TOOMANY, (char *)"Too many submit retries") /* No permission */ -PbsErrClient(PBSE_PERM, "Unauthorized Request ") +PbsErrClient(PBSE_PERM, (char *)"Unauthorized Request ") /* pbs_iff not found */ -PbsErrClient(PBSE_IFF_NOT_FOUND, "pbs_iff command not found, unable to authenticate") +PbsErrClient(PBSE_IFF_NOT_FOUND, (char *)"pbs_iff command not found, unable to authenticate") /* munge not found */ -PbsErrClient(PBSE_MUNGE_NOT_FOUND, "munge executable not found, unable to authenticate") +PbsErrClient(PBSE_MUNGE_NOT_FOUND, (char *)"munge executable not found, unable to authenticate") /* 15010 */ /* access from host not allowed */ -PbsErrClient(PBSE_BADHOST, "Access from host not allowed, or unknown host") +PbsErrClient(PBSE_BADHOST, (char *)"Access from host not allowed, or unknown host") /* job already exists */ -PbsErrClient(PBSE_JOBEXIST, "Job with requested ID already exists") +PbsErrClient(PBSE_JOBEXIST, (char *)"Job with requested ID already exists") /* system error occurred */ -PbsErrClient(PBSE_SYSTEM, " System error: ") +PbsErrClient(PBSE_SYSTEM, (char *)" System error: ") /* internal server error occurred */ -PbsErrClient(PBSE_INTERNAL, "PBS server internal error") +PbsErrClient(PBSE_INTERNAL, (char *)"PBS server internal error") /* parent job of dependent in rte que */ -PbsErrClient(PBSE_REGROUTE, "Dependent parent job currently in routing queue") +PbsErrClient(PBSE_REGROUTE, (char *)"Dependent parent job currently in routing queue") /* unknown signal name */ -PbsErrClient(PBSE_UNKSIG, "Unknown/illegal signal name") +PbsErrClient(PBSE_UNKSIG, (char *)"Unknown/illegal signal name") /* bad attribute value */ -PbsErrClient(PBSE_BADATVAL, "Illegal attribute or resource value for ") +PbsErrClient(PBSE_BADATVAL, (char *)"Illegal attribute or resource value for ") /* Cannot modify attrib in run state */ -PbsErrClient(PBSE_MODATRRUN, "Cannot modify attribute while job running ") +PbsErrClient(PBSE_MODATRRUN, (char *)"Cannot modify attribute while job running ") /* request invalid for job state */ -PbsErrClient(PBSE_BADSTATE, "Request invalid for state of job") +PbsErrClient(PBSE_BADSTATE, (char *)"Request invalid for state of job") /* gap filler */ PbsErrClient(PBSE_GAP017, (char*)0) /* 15020 */ /* Unknown queue name */ -PbsErrClient(PBSE_UNKQUE, "Unknown queue") +PbsErrClient(PBSE_UNKQUE, (char *)"Unknown queue") /* Invalid Credential in request */ -PbsErrClient(PBSE_BADCRED, "Invalid credential") +PbsErrClient(PBSE_BADCRED, (char *)"Invalid credential") /* Expired Credential in request */ -PbsErrClient(PBSE_EXPIRED, "Expired credential") +PbsErrClient(PBSE_EXPIRED, (char *)"Expired credential") /* Queue not enabled */ -PbsErrClient(PBSE_QUNOENB, "Queue is not enabled") +PbsErrClient(PBSE_QUNOENB, (char *)"Queue is not enabled") /* No access permission for queue */ -PbsErrClient(PBSE_QACESS, "Access to queue is denied") +PbsErrClient(PBSE_QACESS, (char *)"Access to queue is denied") /* Bad user - no password entry */ -PbsErrClient(PBSE_BADUSER, "Bad UID for job execution") +PbsErrClient(PBSE_BADUSER, (char *)"Bad UID for job execution") /* Max hop count exceeded */ -PbsErrClient(PBSE_HOPCOUNT, "Job routing over too many hops") +PbsErrClient(PBSE_HOPCOUNT, (char *)"Job routing over too many hops") /* Queue already exists */ -PbsErrClient(PBSE_QUEEXIST, "Queue already exists") +PbsErrClient(PBSE_QUEEXIST, (char *)"Queue already exists") /* incompatable queue attribute type */ -PbsErrClient(PBSE_ATTRTYPE, "Incompatible type") +PbsErrClient(PBSE_ATTRTYPE, (char *)"Incompatible type") /* Queue Busy (not empty) */ -PbsErrClient(PBSE_QUEBUSY, "Cannot delete busy queue") +PbsErrClient(PBSE_QUEBUSY, (char *)"Cannot delete busy queue") /* 15030 */ /* Queue name too long */ -PbsErrClient(PBSE_QUENBIG, "Queue name too long") +PbsErrClient(PBSE_QUENBIG, (char *)"Queue name too long") /* Feature/function not supported */ -PbsErrClient(PBSE_NOSUP, "No support for requested service") +PbsErrClient(PBSE_NOSUP, (char *)"No support for requested service") /* Cannot enable queue,needs add def */ -PbsErrClient(PBSE_QUENOEN, "Cannot enable queue, incomplete definition") +PbsErrClient(PBSE_QUENOEN, (char *)"Cannot enable queue, incomplete definition") /* Protocol error */ -PbsErrClient(PBSE_PROTOCOL, "Batch protocol error") +PbsErrClient(PBSE_PROTOCOL, (char *)"Batch protocol error") /* Bad attribute list structure */ -PbsErrClient(PBSE_BADATLST, "Bad attribute list structure") +PbsErrClient(PBSE_BADATLST, (char *)"Bad attribute list structure") /* No free connections */ -PbsErrClient(PBSE_NOCONNECTS, "No free connections") +PbsErrClient(PBSE_NOCONNECTS, (char *)"No free connections") /* No server to connect to */ -PbsErrClient(PBSE_NOSERVER, "No server specified") +PbsErrClient(PBSE_NOSERVER, (char *)"No server specified") /* Unknown resource */ -PbsErrClient(PBSE_UNKRESC, "Unknown resource type ") +PbsErrClient(PBSE_UNKRESC, (char *)"Unknown resource type ") /* Job exceeds Queue resource limits */ -PbsErrClient(PBSE_EXCQRESC, "Job exceeds queue resource limits") +PbsErrClient(PBSE_EXCQRESC, (char *)"Job exceeds queue resource limits") /* No Default Queue Defined */ -PbsErrClient(PBSE_QUENODFLT, "No default queue specified") +PbsErrClient(PBSE_QUENODFLT, (char *)"No default queue specified") /* 15040 */ /* Job Not Rerunnable */ -PbsErrClient(PBSE_NORERUN, "job is not rerunnable") +PbsErrClient(PBSE_NORERUN, (char *)"job is not rerunnable") /* Route rejected by all destinations */ -PbsErrClient(PBSE_ROUTEREJ, "Job rejected by all possible destinations (check syntax, queue resources, ...)") +PbsErrClient(PBSE_ROUTEREJ, (char *)"Job rejected by all possible destinations (check syntax, queue resources, ...)") /* Time in Route Queue Expired */ -PbsErrClient(PBSE_ROUTEEXPD, "Time in Route Queue Expired") +PbsErrClient(PBSE_ROUTEEXPD, (char *)"Time in Route Queue Expired") /* Request to MOM failed */ -PbsErrClient(PBSE_MOMREJECT, "Execution server rejected request") +PbsErrClient(PBSE_MOMREJECT, (char *)"Execution server rejected request") /* (qsub) cannot access script file */ -PbsErrClient(PBSE_BADSCRIPT, "(qsub) cannot access script file") +PbsErrClient(PBSE_BADSCRIPT, (char *)"(qsub) cannot access script file") /* Stage In of files failed */ -PbsErrClient(PBSE_STAGEIN, "Stage In of files failed") +PbsErrClient(PBSE_STAGEIN, (char *)"Stage In of files failed") /* Resources temporarily unavailable */ -PbsErrClient(PBSE_RESCUNAV, "Resource temporarily unavailable") +PbsErrClient(PBSE_RESCUNAV, (char *)"Resource temporarily unavailable") /* Bad Group specified */ -PbsErrClient(PBSE_BADGRP, "Bad GID for job execution") +PbsErrClient(PBSE_BADGRP, (char *)"Bad GID for job execution") /* Max number of jobs in queue */ -PbsErrClient(PBSE_MAXQUED, "Maximum number of jobs already in queue") +PbsErrClient(PBSE_MAXQUED, (char *)"Maximum number of jobs already in queue") /* Checkpoint Busy, may be retries */ -PbsErrClient(PBSE_CKPBSY, "Checkpoint busy, may retry") +PbsErrClient(PBSE_CKPBSY, (char *)"Checkpoint busy, may retry") /* 15050 */ /* Limit exceeds allowable */ -PbsErrClient(PBSE_EXLIMIT, "Resource limit exceeds allowable") +PbsErrClient(PBSE_EXLIMIT, (char *)"Resource limit exceeds allowable") /* Bad Account attribute value */ -PbsErrClient(PBSE_BADACCT, "Invalid Account") +PbsErrClient(PBSE_BADACCT, (char *)"Invalid Account") /* Job already in exit state */ -PbsErrClient(PBSE_ALRDYEXIT, "Job already in exit state") +PbsErrClient(PBSE_ALRDYEXIT, (char *)"Job already in exit state") /* Job files not copied */ -PbsErrClient(PBSE_NOCOPYFILE, "Job files not copied") +PbsErrClient(PBSE_NOCOPYFILE, (char *)"Job files not copied") /* unknown job id after clean init */ -PbsErrClient(PBSE_CLEANEDOUT, "unknown job id after clean init") +PbsErrClient(PBSE_CLEANEDOUT, (char *)"unknown job id after clean init") /* No Master in Sync Set */ -PbsErrClient(PBSE_NOSYNCMSTR, "No master found for sync job set") +PbsErrClient(PBSE_NOSYNCMSTR, (char *)"No master found for sync job set") /* Invalid dependency */ -PbsErrClient(PBSE_BADDEPEND, "Invalid Job Dependency") +PbsErrClient(PBSE_BADDEPEND, (char *)"Invalid Job Dependency") /* Duplicate entry in List */ -PbsErrClient(PBSE_DUPLIST, "Duplicate entry in list ") +PbsErrClient(PBSE_DUPLIST, (char *)"Duplicate entry in list ") /* Bad DIS based Request Protocol */ -PbsErrClient(PBSE_DISPROTO, "Bad DIS based Request Protocol") +PbsErrClient(PBSE_DISPROTO, (char *)"Bad DIS based Request Protocol") /* cannot execute there */ -PbsErrClient(PBSE_EXECTHERE, "Cannot execute at specified host because of checkpoint or stagein files") +PbsErrClient(PBSE_EXECTHERE, (char *)"Cannot execute at specified host because of checkpoint or stagein files") /* 15060 */ /* sister rejected */ -PbsErrClient(PBSE_SISREJECT, "sister rejected") +PbsErrClient(PBSE_SISREJECT, (char *)"sister rejected") /* sister could not communicate */ -PbsErrClient(PBSE_SISCOMM, "sister could not communicate") +PbsErrClient(PBSE_SISCOMM, (char *)"sister could not communicate") /* req rejected -server shutting down */ -PbsErrClient(PBSE_SVRDOWN, "Request not allowed: Server shutting down") +PbsErrClient(PBSE_SVRDOWN, (char *)"Request not allowed: Server shutting down") /* not all tasks could checkpoint */ -PbsErrClient(PBSE_CKPSHORT, "not all tasks could checkpoint") +PbsErrClient(PBSE_CKPSHORT, (char *)"not all tasks could checkpoint") /* Named node is not in the list */ -PbsErrClient(PBSE_UNKNODE, "Unknown node ") +PbsErrClient(PBSE_UNKNODE, (char *)"Unknown node ") /* node-attribute not recognized */ -PbsErrClient(PBSE_UNKNODEATR, "Unknown node-attribute ") +PbsErrClient(PBSE_UNKNODEATR, (char *)"Unknown node-attribute ") /* Server has no node list */ -PbsErrClient(PBSE_NONODES, "Server has no node list") +PbsErrClient(PBSE_NONODES, (char *)"Server has no node list") /* Node name is too big */ -PbsErrClient(PBSE_NODENBIG, "Node name is too big") +PbsErrClient(PBSE_NODENBIG, (char *)"Node name is too big") /* Node name already exists */ -PbsErrClient(PBSE_NODEEXIST, "Node name already exists") +PbsErrClient(PBSE_NODEEXIST, (char *)"Node name already exists") /* Bad node-attribute value */ -PbsErrClient(PBSE_BADNDATVAL, "Illegal value for ") +PbsErrClient(PBSE_BADNDATVAL, (char *)"Illegal value for ") /* 15070 */ /* State values are mutually exclusive */ -PbsErrClient(PBSE_MUTUALEX, "Mutually exclusive values for ") +PbsErrClient(PBSE_MUTUALEX, (char *)"Mutually exclusive values for ") /* Error(s) during global modification of nodes */ -PbsErrClient(PBSE_GMODERR, "Modification failed for ") +PbsErrClient(PBSE_GMODERR, (char *)"Modification failed for ") /* could not contact Mom */ -PbsErrClient(PBSE_NORELYMOM, "Server could not connect to MOM") +PbsErrClient(PBSE_NORELYMOM, (char *)"Server could not connect to MOM") /* no time-shared nodes */ -PbsErrClient(PBSE_NOTSNODE, "No time-share node available") +PbsErrClient(PBSE_NOTSNODE, (char *)"No time-share node available") /* wrong job type (batch or interactive) */ -PbsErrClient(PBSE_JOBTYPE, "Wrong job type") +PbsErrClient(PBSE_JOBTYPE, (char *)"Wrong job type") /* bad entry in ACL host list */ -PbsErrClient(PBSE_BADACLHOST, "Bad ACL entry in host list") +PbsErrClient(PBSE_BADACLHOST, (char *)"Bad ACL entry in host list") /* max number of jobs queued for user */ -PbsErrClient(PBSE_MAXUSERQUED, "Maximum number of jobs already in queue for user") +PbsErrClient(PBSE_MAXUSERQUED, (char *)"Maximum number of jobs already in queue for user") /* bad type in disallowed_types queue attribute */ -PbsErrClient(PBSE_BADDISALLOWTYPE, "Bad type in disallowed_types list") +PbsErrClient(PBSE_BADDISALLOWTYPE, (char *)"Bad type in disallowed_types list") /* interactive jobs not allowed in queue */ -PbsErrClient(PBSE_NOINTERACTIVE, "Queue does not allow interactive jobs") +PbsErrClient(PBSE_NOINTERACTIVE, (char *)"Queue does not allow interactive jobs") /* batch jobs not allowed in queue */ -PbsErrClient(PBSE_NOBATCH, "Queue does not allow batch jobs") +PbsErrClient(PBSE_NOBATCH, (char *)"Queue does not allow batch jobs") /* 15080 */ /* rerunable jobs not allowed in queue */ -PbsErrClient(PBSE_NORERUNABLE, "Queue does not allow rerunable jobs") +PbsErrClient(PBSE_NORERUNABLE, (char *)"Queue does not allow rerunable jobs") /* nonrerunable jobs not allowed in queue */ -PbsErrClient(PBSE_NONONRERUNABLE, "Queue does not allow nonrerunable jobs") +PbsErrClient(PBSE_NONONRERUNABLE, (char *)"Queue does not allow nonrerunable jobs") /* unknown array id */ -PbsErrClient(PBSE_UNKARRAYID, "Unknown Array ID") +PbsErrClient(PBSE_UNKARRAYID, (char *)"Unknown Array ID") /* bad array request */ -PbsErrClient(PBSE_BAD_ARRAY_REQ, "Bad Job Array Request") +PbsErrClient(PBSE_BAD_ARRAY_REQ, (char *)"Bad Job Array Request") /* Bad file format for array */ -PbsErrClient(PBSE_BAD_ARRAY_DATA, "Bad data reading job array from file ") +PbsErrClient(PBSE_BAD_ARRAY_DATA, (char *)"Bad data reading job array from file ") /* Time out */ -PbsErrClient(PBSE_TIMEOUT, "Time out") -PbsErrClient(PBSE_JOBNOTFOUND, "Job not found") +PbsErrClient(PBSE_TIMEOUT, (char *)"Time out") +PbsErrClient(PBSE_JOBNOTFOUND, (char *)"Job not found") /* fault tolerant jobs not allowed in queue */ -PbsErrClient(PBSE_NOFAULTTOLERANT, "Queue does not allow fault tolerant jobs") +PbsErrClient(PBSE_NOFAULTTOLERANT, (char *)"Queue does not allow fault tolerant jobs") /* only fault tolerant jobs allowed in queue */ -PbsErrClient(PBSE_NOFAULTINTOLERANT, "Queue does not allow fault intolerant jobs") -PbsErrClient(PBSE_NOJOBARRAYS, "Queue does not allow job arrays") +PbsErrClient(PBSE_NOFAULTINTOLERANT, (char *)"Queue does not allow fault intolerant jobs") +PbsErrClient(PBSE_NOJOBARRAYS, (char *)"Queue does not allow job arrays") /* 15090 */ -PbsErrClient(PBSE_RELAYED_TO_MOM, "request was relayed to a MOM") /* */ -PbsErrClient(PBSE_MEM_MALLOC, "Error allocating memory - out of memory") -PbsErrClient(PBSE_MUTEX, "Error allocating controling mutex (lock/unlock)") -PbsErrClient(PBSE_THREADATTR, "Error setting thread attributes") -PbsErrClient(PBSE_THREAD, "Error creating thread") -PbsErrClient(PBSE_SELECT, "Error in socket select") -PbsErrClient(PBSE_SOCKET_FAULT, "Error getting connection to socket") -PbsErrClient(PBSE_SOCKET_WRITE, "Error writing data to socket") -PbsErrClient(PBSE_SOCKET_READ, "Error reading data from socket") -PbsErrClient(PBSE_SOCKET_CLOSE, "Socket close detected") +PbsErrClient(PBSE_RELAYED_TO_MOM, (char *)"request was relayed to a MOM") /* */ +PbsErrClient(PBSE_MEM_MALLOC, (char *)"Error allocating memory - out of memory") +PbsErrClient(PBSE_MUTEX, (char *)"Error allocating controling mutex (lock/unlock)") +PbsErrClient(PBSE_THREADATTR, (char *)"Error setting thread attributes") +PbsErrClient(PBSE_THREAD, (char *)"Error creating thread") +PbsErrClient(PBSE_SELECT, (char *)"Error in socket select") +PbsErrClient(PBSE_SOCKET_FAULT, (char *)"Error getting connection to socket") +PbsErrClient(PBSE_SOCKET_WRITE, (char *)"Error writing data to socket") +PbsErrClient(PBSE_SOCKET_READ, (char *)"Error reading data from socket") +PbsErrClient(PBSE_SOCKET_CLOSE, (char *)"Socket close detected") /* 15100 */ -PbsErrClient(PBSE_SOCKET_LISTEN, "Error listening on socket") -PbsErrClient(PBSE_AUTH_INVALID, "Invalid auth type in request") -PbsErrClient(PBSE_NOT_IMPLEMENTED, "This functionality is not yet implemented") -PbsErrClient(PBSE_QUENOTAVAILABLE, "Queue is currently not available") -PbsErrClient(PBSE_TMPDIFFOWNER, "tmpdir owned by another user") -PbsErrClient(PBSE_TMPNOTDIR, "tmpdir exists but is not a directory") -PbsErrClient(PBSE_TMPNONAME, "tmpdir cannot be named for job") -PbsErrClient(PBSE_CANTOPENSOCKET, "cannot open demux sockets") -PbsErrClient(PBSE_CANTCONTACTSISTERS, "cannot send join job to all sisters") -PbsErrClient(PBSE_CANTCREATETMPDIR, "cannot create tmpdir for job") +PbsErrClient(PBSE_SOCKET_LISTEN, (char *)"Error listening on socket") +PbsErrClient(PBSE_AUTH_INVALID, (char *)"Invalid auth type in request") +PbsErrClient(PBSE_NOT_IMPLEMENTED, (char *)"This functionality is not yet implemented") +PbsErrClient(PBSE_QUENOTAVAILABLE, (char *)"Queue is currently not available") +PbsErrClient(PBSE_TMPDIFFOWNER, (char *)"tmpdir owned by another user") +PbsErrClient(PBSE_TMPNOTDIR, (char *)"tmpdir exists but is not a directory") +PbsErrClient(PBSE_TMPNONAME, (char *)"tmpdir cannot be named for job") +PbsErrClient(PBSE_CANTOPENSOCKET, (char *)"cannot open demux sockets") +PbsErrClient(PBSE_CANTCONTACTSISTERS, (char *)"cannot send join job to all sisters") +PbsErrClient(PBSE_CANTCREATETMPDIR, (char *)"cannot create tmpdir for job") /* 15110 */ -PbsErrClient(PBSE_BADMOMSTATE, "Mom is down, cannot run job") -PbsErrClient(PBSE_SOCKET_INFORMATION, "socket information is not accessible") -PbsErrClient(PBSE_SOCKET_DATA, "data on socket does not process correctly") -PbsErrClient(PBSE_CLIENT_INVALID, "client is not allowed/trusted") -PbsErrClient(PBSE_PREMATURE_EOF, "Premature End of File") -PbsErrClient(PBSE_CAN_NOT_SAVE_FILE, "Error saving file") -PbsErrClient(PBSE_CAN_NOT_OPEN_FILE, "Error opening file") -PbsErrClient(PBSE_CAN_NOT_WRITE_FILE, "Error writing file") -PbsErrClient(PBSE_JOB_FILE_CORRUPT, "Job file corrupt") -PbsErrClient(PBSE_JOB_RERUN, "Job can not be rerun") +PbsErrClient(PBSE_BADMOMSTATE, (char *)"Mom is down, cannot run job") +PbsErrClient(PBSE_SOCKET_INFORMATION, (char *)"socket information is not accessible") +PbsErrClient(PBSE_SOCKET_DATA, (char *)"data on socket does not process correctly") +PbsErrClient(PBSE_CLIENT_INVALID, (char *)"client is not allowed/trusted") +PbsErrClient(PBSE_PREMATURE_EOF, (char *)"Premature End of File") +PbsErrClient(PBSE_CAN_NOT_SAVE_FILE, (char *)"Error saving file") +PbsErrClient(PBSE_CAN_NOT_OPEN_FILE, (char *)"Error opening file") +PbsErrClient(PBSE_CAN_NOT_WRITE_FILE, (char *)"Error writing file") +PbsErrClient(PBSE_JOB_FILE_CORRUPT, (char *)"Job file corrupt") +PbsErrClient(PBSE_JOB_RERUN, (char *)"Job can not be rerun") /* 15120 */ -PbsErrClient(PBSE_CONNECT, "Can not establish connection") -PbsErrClient(PBSE_JOBWORKDELAY, "Job function must be temporarily delayed") -PbsErrClient(PBSE_BAD_PARAMETER, "Parameter of function was invalid") -PbsErrClient(PBSE_CONTINUE, "Continue processing on job. (Not an error)") -PbsErrClient(PBSE_JOBSUBSTATE, "Current sub state does not allow trasaction.") -PbsErrClient(PBSE_CAN_NOT_MOVE_FILE, "Error moving file") -PbsErrClient(PBSE_JOB_RECYCLED, "Job is being recycled") -PbsErrClient(PBSE_JOB_ALREADY_IN_QUEUE, "Job is already in destination queue.") +PbsErrClient(PBSE_CONNECT, (char *)"Can not establish connection") +PbsErrClient(PBSE_JOBWORKDELAY, (char *)"Job function must be temporarily delayed") +PbsErrClient(PBSE_BAD_PARAMETER, (char *)"Parameter of function was invalid") +PbsErrClient(PBSE_CONTINUE, (char *)"Continue processing on job. (Not an error)") +PbsErrClient(PBSE_JOBSUBSTATE, (char *)"Current sub state does not allow trasaction.") +PbsErrClient(PBSE_CAN_NOT_MOVE_FILE, (char *)"Error moving file") +PbsErrClient(PBSE_JOB_RECYCLED, (char *)"Job is being recycled") +PbsErrClient(PBSE_JOB_ALREADY_IN_QUEUE, (char *)"Job is already in destination queue.") /* pbs client errors ceiling (max_client_err + 1) */ @@ -261,17 +261,17 @@ PbsErrClient(PBSE_CEILING, (char*)0) /* pbs rm errors floor (min_rm_err - 1) */ PbsErrRm(PBSE_RMFLOOR = 15200, (char*)0) /* resource unknown */ -PbsErrRm(PBSE_RMUNKNOWN, "resource unknown") +PbsErrRm(PBSE_RMUNKNOWN, (char *)"resource unknown") /* parameter could not be used */ -PbsErrRm(PBSE_RMBADPARAM, "parameter could not be used") +PbsErrRm(PBSE_RMBADPARAM, (char *)"parameter could not be used") /* a parameter needed did not exist */ -PbsErrRm(PBSE_RMNOPARAM, "a parameter needed did not exist") +PbsErrRm(PBSE_RMNOPARAM, (char *)"a parameter needed did not exist") /* something specified didn't exist */ -PbsErrRm(PBSE_RMEXIST, "something specified didn't exist") +PbsErrRm(PBSE_RMEXIST, (char *)"something specified didn't exist") /* a system error occured */ -PbsErrRm(PBSE_RMSYSTEM, "a system error occured") +PbsErrRm(PBSE_RMSYSTEM, (char *)"a system error occured") /* only part of reservation made */ -PbsErrRm(PBSE_RMPART, "only part of reservation made") +PbsErrRm(PBSE_RMPART, (char *)"only part of reservation made") /* pbs rm errors ceiling (max_rm_err + 1) */ PbsErrRm(PBSE_RMCEILING, (char*)0) #endif diff --git a/src/include/pbs_job.h b/src/include/pbs_job.h index 5a99e76dd9..d02ca9e5c4 100644 --- a/src/include/pbs_job.h +++ b/src/include/pbs_job.h @@ -504,7 +504,72 @@ typedef struct all_jobs +/* + * fixed size internal data - maintained via "quick save" + * some of the items are copies of attributes, if so this + * internal version takes precendent + * + * NOTE: IF YOU MAKE ANY CHANGES TO THIS STRUCT THEN YOU ARE INTRODUCING + * AN INCOMPATIBILITY WITH .JB FILES FROM PREVIOUS VERSIONS OF TORQUE. + * YOU SHOULD INCREMENT THE VERSION OF THE STRUCT AND PROVIDE APPROPRIATE + * SUPPORT IN joq_qs_upgrade() FOR UPGRADING PREVIOUS VERSIONS OF THIS + * STRUCT TO THE CURRENT VERSION. ALSO NOTE THAT ANY CHANGES TO CONSTANTS + * THAT DEFINE THE SIZE OF ANY ARRAYS IN THIS STRUCT ALSO INTRODUCE AN + * INCOMPATIBILITY WITH .JB FILES FROM PREVIOUS VERSIONS AND REQUIRE A NEW + * STRUCT VERSION AND UPGRADE SUPPORT. + */ + +struct jobfix + { + int qs_version; /* quick save version */ + int ji_state; /* internal copy of state */ + int ji_substate; /* job sub-state */ + int ji_svrflags; /* server flags */ + int ji_numattr; /* number of attributes in list - never used, delete me */ + int ji_ordering; /* special scheduling ordering - also never used */ + int ji_priority; /* internal priority - also never used */ + time_t ji_stime; /* time job started execution */ + char ji_jobid[PBS_MAXSVRJOBID + 1]; /* job identifier */ + char ji_fileprefix[PBS_JOBBASE + 1]; /* job file prefix */ + char ji_queue[PBS_MAXQUEUENAME + 1]; /* name of current queue */ + char ji_destin[PBS_MAXROUTEDEST + 1]; /* dest from qmove/route */ + /* + * ji_destin gets set when we assign hosts and gets + * cleared on failure to run job on mom or at obit_reply + */ + 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 */ + unsigned short ji_momport; /* host port of Server default 15002 */ + unsigned short ji_mom_rmport; /* host mom manager port of Server default 15003 */ + int ji_exitstat; /* job exit status from MOM */ + } ji_exect; + struct + { + time_t ji_quetime; /* time entered queue */ + time_t ji_rteretry; /* route retry time */ + } ji_routet; + + struct + { + pbs_net_t ji_fromaddr; /* host job coming from */ + int ji_fromsock; /* socket job coming over */ + int ji_scriptsz; /* script size */ + } ji_newt; + + struct + { + pbs_net_t ji_svraddr; /* host addr of Server */ + int ji_exitstat; /* job exit status from MOM */ + uid_t ji_exuid; /* execution uid */ + gid_t ji_exgid; /* execution gid */ + } ji_momt; + } ji_un; + }; /** * THE JOB @@ -625,57 +690,7 @@ struct job * STRUCT VERSION AND UPGRADE SUPPORT. */ - struct jobfix - { - int qs_version; /* quick save version */ - int ji_state; /* internal copy of state */ - int ji_substate; /* job sub-state */ - int ji_svrflags; /* server flags */ - int ji_numattr; /* number of attributes in list - never used, delete me */ - int ji_ordering; /* special scheduling ordering - also never used */ - int ji_priority; /* internal priority - also never used */ - time_t ji_stime; /* time job started execution */ - char ji_jobid[PBS_MAXSVRJOBID + 1]; /* job identifier */ - char ji_fileprefix[PBS_JOBBASE + 1]; /* job file prefix */ - char ji_queue[PBS_MAXQUEUENAME + 1]; /* name of current queue */ - char ji_destin[PBS_MAXROUTEDEST + 1]; /* dest from qmove/route */ - /* - * ji_destin gets set when we assign hosts and gets - * cleared on failure to run job on mom or at obit_reply - */ - 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 */ - unsigned short ji_momport; /* host port of Server default 15002 */ - unsigned short ji_mom_rmport; /* host mom manager port of Server default 15003 */ - int ji_exitstat; /* job exit status from MOM */ - } ji_exect; - - struct - { - time_t ji_quetime; /* time entered queue */ - time_t ji_rteretry; /* route retry time */ - } ji_routet; - - struct - { - pbs_net_t ji_fromaddr; /* host job coming from */ - int ji_fromsock; /* socket job coming over */ - int ji_scriptsz; /* script size */ - } ji_newt; - - struct - { - pbs_net_t ji_svraddr; /* host addr of Server */ - int ji_exitstat; /* job exit status from MOM */ - uid_t ji_exuid; /* execution uid */ - gid_t ji_exgid; /* execution gid */ - } ji_momt; - } ji_un; - } ji_qs; + struct jobfix ji_qs; /* * The following array holds the decode format of the attributes. diff --git a/src/include/site_job_attr_def.h b/src/include/site_job_attr_def.h new file mode 100644 index 0000000000..4d7fa262b1 --- /dev/null +++ b/src/include/site_job_attr_def.h @@ -0,0 +1,111 @@ +/* +* OpenPBS (Portable Batch System) v2.3 Software License +* +* Copyright (c) 1999-2000 Veridian Information Solutions, Inc. +* All rights reserved. +* +* --------------------------------------------------------------------------- +* For a license to use or redistribute the OpenPBS software under conditions +* other than those described below, or to purchase support for this software, +* please contact Veridian Systems, PBS Products Department ("Licensor") at: +* +* www.OpenPBS.org +1 650 967-4675 sales@OpenPBS.org +* 877 902-4PBS (US toll-free) +* --------------------------------------------------------------------------- +* +* This license covers use of the OpenPBS v2.3 software (the "Software") at +* your site or location, and, for certain users, redistribution of the +* Software to other sites and locations. Use and redistribution of +* OpenPBS v2.3 in source and binary forms, with or without modification, +* are permitted provided that all of the following conditions are met. +* After December 31, 2001, only conditions 3-6 must be met: +* +* 1. Commercial and/or non-commercial use of the Software is permitted +* provided a current software registration is on file at www.OpenPBS.org. +* If use of this software contributes to a publication, product, or +* service, proper attribution must be given; see www.OpenPBS.org/credit.html +* +* 2. Redistribution in any form is only permitted for non-commercial, +* non-profit purposes. There can be no charge for the Software or any +* software incorporating the Software. Further, there can be no +* expectation of revenue generated as a consequence of redistributing +* the Software. +* +* 3. Any Redistribution of source code must retain the above copyright notice +* and the acknowledgment contained in paragraph 6, this list of conditions +* and the disclaimer contained in paragraph 7. +* +* 4. Any Redistribution in binary form must reproduce the above copyright +* notice and the acknowledgment contained in paragraph 6, this list of +* conditions and the disclaimer contained in paragraph 7 in the +* documentation and/or other materials provided with the distribution. +* +* 5. Redistributions in any form must be accompanied by information on how to +* obtain complete source code for the OpenPBS software and any +* modifications and/or additions to the OpenPBS software. The source code +* must either be included in the distribution or be available for no more +* than the cost of distribution plus a nominal fee, and all modifications +* and additions to the Software must be freely redistributable by any party +* (including Licensor) without restriction. +* +* 6. All advertising materials mentioning features or use of the Software must +* display the following acknowledgment: +* +* "This product includes software developed by NASA Ames Research Center, +* Lawrence Livermore National Laboratory, and Veridian Information +* Solutions, Inc. +* Visit www.OpenPBS.org for OpenPBS software support, +* products, and information." +* +* 7. DISCLAIMER OF WARRANTY +* +* THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. ANY EXPRESS +* OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES +* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT +* ARE EXPRESSLY DISCLAIMED. +* +* IN NO EVENT SHALL VERIDIAN CORPORATION, ITS AFFILIATED COMPANIES, OR THE +* U.S. GOVERNMENT OR ANY OF ITS AGENCIES BE LIABLE FOR ANY DIRECT OR INDIRECT, +* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, +* OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, +* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* This license will be governed by the laws of the Commonwealth of Virginia, +* without reference to its choice of law rules. +*/ + +/* + * Place holder for site supplied additions to the array of + * site job attribute definitions, see server/job_attr_def.c + * + * Array elements must be of the form: + * { "name", + * decode_Func, + * encode_Func, + * set_Func, + * comp_Func, + * free_Func, + * action_routine, + * permissions, + * ATR_TYPE_*, + * PARENT_TYPE_JOB + * }, + * + * Matching entry must be added in site_job_attr_enum.h + */ + +{ "x", + decode_str, + encode_str, + set_str, + comp_str, + free_str, + NULL_FUNC, + READ_WRITE, + ATR_TYPE_STR, + PARENT_TYPE_JOB + }, + diff --git a/src/include/rpp.h b/src/include/site_job_attr_enum.h similarity index 84% rename from src/include/rpp.h rename to src/include/site_job_attr_enum.h index 1da8a7c90c..151a3f4246 100644 --- a/src/include/rpp.h +++ b/src/include/site_job_attr_enum.h @@ -1,45 +1,47 @@ +#ifndef _SITE_JOB_ATTR_ENUM_HT +#define _SITE_JOB_ATTR_ENUM_HT /* * OpenPBS (Portable Batch System) v2.3 Software License -* +* * Copyright (c) 1999-2000 Veridian Information Solutions, Inc. * All rights reserved. -* +* * --------------------------------------------------------------------------- * For a license to use or redistribute the OpenPBS software under conditions * other than those described below, or to purchase support for this software, * please contact Veridian Systems, PBS Products Department ("Licensor") at: -* +* * www.OpenPBS.org +1 650 967-4675 sales@OpenPBS.org * 877 902-4PBS (US toll-free) * --------------------------------------------------------------------------- -* +* * This license covers use of the OpenPBS v2.3 software (the "Software") at * your site or location, and, for certain users, redistribution of the * Software to other sites and locations. Use and redistribution of * OpenPBS v2.3 in source and binary forms, with or without modification, * are permitted provided that all of the following conditions are met. * After December 31, 2001, only conditions 3-6 must be met: -* +* * 1. Commercial and/or non-commercial use of the Software is permitted * provided a current software registration is on file at www.OpenPBS.org. * If use of this software contributes to a publication, product, or * service, proper attribution must be given; see www.OpenPBS.org/credit.html -* +* * 2. Redistribution in any form is only permitted for non-commercial, * non-profit purposes. There can be no charge for the Software or any * software incorporating the Software. Further, there can be no * expectation of revenue generated as a consequence of redistributing * the Software. -* +* * 3. Any Redistribution of source code must retain the above copyright notice * and the acknowledgment contained in paragraph 6, this list of conditions * and the disclaimer contained in paragraph 7. -* +* * 4. Any Redistribution in binary form must reproduce the above copyright * notice and the acknowledgment contained in paragraph 6, this list of * conditions and the disclaimer contained in paragraph 7 in the * documentation and/or other materials provided with the distribution. -* +* * 5. Redistributions in any form must be accompanied by information on how to * obtain complete source code for the OpenPBS software and any * modifications and/or additions to the OpenPBS software. The source code @@ -47,23 +49,23 @@ * than the cost of distribution plus a nominal fee, and all modifications * and additions to the Software must be freely redistributable by any party * (including Licensor) without restriction. -* +* * 6. All advertising materials mentioning features or use of the Software must * display the following acknowledgment: -* +* * "This product includes software developed by NASA Ames Research Center, -* Lawrence Livermore National Laboratory, and Veridian Information +* Lawrence Livermore National Laboratory, and Veridian Information * Solutions, Inc. * Visit www.OpenPBS.org for OpenPBS software support, * products, and information." -* +* * 7. DISCLAIMER OF WARRANTY -* +* * THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. ANY EXPRESS * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT * ARE EXPRESSLY DISCLAIMED. -* +* * IN NO EVENT SHALL VERIDIAN CORPORATION, ITS AFFILIATED COMPANIES, OR THE * U.S. GOVERNMENT OR ANY OF ITS AGENCIES BE LIABLE FOR ANY DIRECT OR INDIRECT, * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT @@ -72,36 +74,25 @@ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -* +* * This license will be governed by the laws of the Commonwealth of Virginia, * without reference to its choice of law rules. */ -int rpp_open(char *, unsigned int, char *); -int rpp_bind(unsigned int); -int rpp_poll(void); -int rpp_io(void); -int rpp_read(int, void *, int); -int rpp_write(int, void *, int); -int rpp_close(int); - -struct sockaddr_in* rpp_getaddr(int); -int rpp_flush(int); -void rpp_shutdown(void); -void rpp_terminate(void); -int rpp_rcommit(int, int); -int rpp_wcommit(int, int); -int rpp_skip(int, int); -int rpp_eom(int); -int rpp_getc(int); -int rpp_putc(int, int); -char * netaddr(struct sockaddr_in *); -int rpp_get_stream_state(int index); - +/* + * @(#) $Id$ + */ -unsigned long crc(unsigned char *, unsigned long); +/* + * Place holder for site supplied additions to the job's enumerated + * list of attributes, see pbs_job.h. + * + * List should be of the form: + * JOB_SITE_ATR_name, + * + * Matching entry must be added in site_job_attr_def.h + */ -void set_rpp_throttle_sleep_time(long sleep_time); +JOB_SITE_ATR_x, -extern int rpp_fd; -extern int rpp_dbprt; +#endif /* _SITE_JOB_ATTR_ENUM_HT */ diff --git a/src/include/site_qmgr_node_print.h b/src/include/site_qmgr_node_print.h new file mode 100644 index 0000000000..9d2544c03c --- /dev/null +++ b/src/include/site_qmgr_node_print.h @@ -0,0 +1,91 @@ +/* +* OpenPBS (Portable Batch System) v2.3 Software License +* +* Copyright (c) 1999-2000 Veridian Information Solutions, Inc. +* All rights reserved. +* +* --------------------------------------------------------------------------- +* For a license to use or redistribute the OpenPBS software under conditions +* other than those described below, or to purchase support for this software, +* please contact Veridian Systems, PBS Products Department ("Licensor") at: +* +* www.OpenPBS.org +1 650 967-4675 sales@OpenPBS.org +* 877 902-4PBS (US toll-free) +* --------------------------------------------------------------------------- +* +* This license covers use of the OpenPBS v2.3 software (the "Software") at +* your site or location, and, for certain users, redistribution of the +* Software to other sites and locations. Use and redistribution of +* OpenPBS v2.3 in source and binary forms, with or without modification, +* are permitted provided that all of the following conditions are met. +* After December 31, 2001, only conditions 3-6 must be met: +* +* 1. Commercial and/or non-commercial use of the Software is permitted +* provided a current software registration is on file at www.OpenPBS.org. +* If use of this software contributes to a publication, product, or +* service, proper attribution must be given; see www.OpenPBS.org/credit.html +* +* 2. Redistribution in any form is only permitted for non-commercial, +* non-profit purposes. There can be no charge for the Software or any +* software incorporating the Software. Further, there can be no +* expectation of revenue generated as a consequence of redistributing +* the Software. +* +* 3. Any Redistribution of source code must retain the above copyright notice +* and the acknowledgment contained in paragraph 6, this list of conditions +* and the disclaimer contained in paragraph 7. +* +* 4. Any Redistribution in binary form must reproduce the above copyright +* notice and the acknowledgment contained in paragraph 6, this list of +* conditions and the disclaimer contained in paragraph 7 in the +* documentation and/or other materials provided with the distribution. +* +* 5. Redistributions in any form must be accompanied by information on how to +* obtain complete source code for the OpenPBS software and any +* modifications and/or additions to the OpenPBS software. The source code +* must either be included in the distribution or be available for no more +* than the cost of distribution plus a nominal fee, and all modifications +* and additions to the Software must be freely redistributable by any party +* (including Licensor) without restriction. +* +* 6. All advertising materials mentioning features or use of the Software must +* display the following acknowledgment: +* +* "This product includes software developed by NASA Ames Research Center, +* Lawrence Livermore National Laboratory, and Veridian Information +* Solutions, Inc. +* Visit www.OpenPBS.org for OpenPBS software support, +* products, and information." +* +* 7. DISCLAIMER OF WARRANTY +* +* THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. ANY EXPRESS +* OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES +* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT +* ARE EXPRESSLY DISCLAIMED. +* +* IN NO EVENT SHALL VERIDIAN CORPORATION, ITS AFFILIATED COMPANIES, OR THE +* U.S. GOVERNMENT OR ANY OF ITS AGENCIES BE LIABLE FOR ANY DIRECT OR INDIRECT, +* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, +* OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, +* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* This license will be governed by the laws of the Commonwealth of Virginia, +* without reference to its choice of law rules. +*/ + +/* + * @(#) $Id$ + */ + +/* + * list of site defined queue attribute names which qmgr should + * include in its "print node" output + * + * format is (do include the quote marks): + * "attribute_name", + */ + diff --git a/src/include/site_qmgr_que_print.h b/src/include/site_qmgr_que_print.h new file mode 100644 index 0000000000..0dc8e2c0e5 --- /dev/null +++ b/src/include/site_qmgr_que_print.h @@ -0,0 +1,91 @@ +/* +* OpenPBS (Portable Batch System) v2.3 Software License +* +* Copyright (c) 1999-2000 Veridian Information Solutions, Inc. +* All rights reserved. +* +* --------------------------------------------------------------------------- +* For a license to use or redistribute the OpenPBS software under conditions +* other than those described below, or to purchase support for this software, +* please contact Veridian Systems, PBS Products Department ("Licensor") at: +* +* www.OpenPBS.org +1 650 967-4675 sales@OpenPBS.org +* 877 902-4PBS (US toll-free) +* --------------------------------------------------------------------------- +* +* This license covers use of the OpenPBS v2.3 software (the "Software") at +* your site or location, and, for certain users, redistribution of the +* Software to other sites and locations. Use and redistribution of +* OpenPBS v2.3 in source and binary forms, with or without modification, +* are permitted provided that all of the following conditions are met. +* After December 31, 2001, only conditions 3-6 must be met: +* +* 1. Commercial and/or non-commercial use of the Software is permitted +* provided a current software registration is on file at www.OpenPBS.org. +* If use of this software contributes to a publication, product, or +* service, proper attribution must be given; see www.OpenPBS.org/credit.html +* +* 2. Redistribution in any form is only permitted for non-commercial, +* non-profit purposes. There can be no charge for the Software or any +* software incorporating the Software. Further, there can be no +* expectation of revenue generated as a consequence of redistributing +* the Software. +* +* 3. Any Redistribution of source code must retain the above copyright notice +* and the acknowledgment contained in paragraph 6, this list of conditions +* and the disclaimer contained in paragraph 7. +* +* 4. Any Redistribution in binary form must reproduce the above copyright +* notice and the acknowledgment contained in paragraph 6, this list of +* conditions and the disclaimer contained in paragraph 7 in the +* documentation and/or other materials provided with the distribution. +* +* 5. Redistributions in any form must be accompanied by information on how to +* obtain complete source code for the OpenPBS software and any +* modifications and/or additions to the OpenPBS software. The source code +* must either be included in the distribution or be available for no more +* than the cost of distribution plus a nominal fee, and all modifications +* and additions to the Software must be freely redistributable by any party +* (including Licensor) without restriction. +* +* 6. All advertising materials mentioning features or use of the Software must +* display the following acknowledgment: +* +* "This product includes software developed by NASA Ames Research Center, +* Lawrence Livermore National Laboratory, and Veridian Information +* Solutions, Inc. +* Visit www.OpenPBS.org for OpenPBS software support, +* products, and information." +* +* 7. DISCLAIMER OF WARRANTY +* +* THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. ANY EXPRESS +* OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES +* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT +* ARE EXPRESSLY DISCLAIMED. +* +* IN NO EVENT SHALL VERIDIAN CORPORATION, ITS AFFILIATED COMPANIES, OR THE +* U.S. GOVERNMENT OR ANY OF ITS AGENCIES BE LIABLE FOR ANY DIRECT OR INDIRECT, +* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, +* OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, +* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* This license will be governed by the laws of the Commonwealth of Virginia, +* without reference to its choice of law rules. +*/ + +/* + * @(#) $Id$ + */ + +/* + * list of site defined queue attribute names which qmgr should + * include in its "print queue" output + * + * format is (do include the quote marks): + * "attribute_name", + */ + diff --git a/src/include/site_qmgr_svr_print.h b/src/include/site_qmgr_svr_print.h new file mode 100644 index 0000000000..8d0e16d176 --- /dev/null +++ b/src/include/site_qmgr_svr_print.h @@ -0,0 +1,90 @@ +/* +* OpenPBS (Portable Batch System) v2.3 Software License +* +* Copyright (c) 1999-2000 Veridian Information Solutions, Inc. +* All rights reserved. +* +* --------------------------------------------------------------------------- +* For a license to use or redistribute the OpenPBS software under conditions +* other than those described below, or to purchase support for this software, +* please contact Veridian Systems, PBS Products Department ("Licensor") at: +* +* www.OpenPBS.org +1 650 967-4675 sales@OpenPBS.org +* 877 902-4PBS (US toll-free) +* --------------------------------------------------------------------------- +* +* This license covers use of the OpenPBS v2.3 software (the "Software") at +* your site or location, and, for certain users, redistribution of the +* Software to other sites and locations. Use and redistribution of +* OpenPBS v2.3 in source and binary forms, with or without modification, +* are permitted provided that all of the following conditions are met. +* After December 31, 2001, only conditions 3-6 must be met: +* +* 1. Commercial and/or non-commercial use of the Software is permitted +* provided a current software registration is on file at www.OpenPBS.org. +* If use of this software contributes to a publication, product, or +* service, proper attribution must be given; see www.OpenPBS.org/credit.html +* +* 2. Redistribution in any form is only permitted for non-commercial, +* non-profit purposes. There can be no charge for the Software or any +* software incorporating the Software. Further, there can be no +* expectation of revenue generated as a consequence of redistributing +* the Software. +* +* 3. Any Redistribution of source code must retain the above copyright notice +* and the acknowledgment contained in paragraph 6, this list of conditions +* and the disclaimer contained in paragraph 7. +* +* 4. Any Redistribution in binary form must reproduce the above copyright +* notice and the acknowledgment contained in paragraph 6, this list of +* conditions and the disclaimer contained in paragraph 7 in the +* documentation and/or other materials provided with the distribution. +* +* 5. Redistributions in any form must be accompanied by information on how to +* obtain complete source code for the OpenPBS software and any +* modifications and/or additions to the OpenPBS software. The source code +* must either be included in the distribution or be available for no more +* than the cost of distribution plus a nominal fee, and all modifications +* and additions to the Software must be freely redistributable by any party +* (including Licensor) without restriction. +* +* 6. All advertising materials mentioning features or use of the Software must +* display the following acknowledgment: +* +* "This product includes software developed by NASA Ames Research Center, +* Lawrence Livermore National Laboratory, and Veridian Information +* Solutions, Inc. +* Visit www.OpenPBS.org for OpenPBS software support, +* products, and information." +* +* 7. DISCLAIMER OF WARRANTY +* +* THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. ANY EXPRESS +* OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES +* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT +* ARE EXPRESSLY DISCLAIMED. +* +* IN NO EVENT SHALL VERIDIAN CORPORATION, ITS AFFILIATED COMPANIES, OR THE +* U.S. GOVERNMENT OR ANY OF ITS AGENCIES BE LIABLE FOR ANY DIRECT OR INDIRECT, +* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, +* OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, +* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* This license will be governed by the laws of the Commonwealth of Virginia, +* without reference to its choice of law rules. +*/ + +/* + * @(#) $Id$ + */ + +/* + * list of site defined server attribute names which qmgr should + * include in its "print server" output + * + * format is (do include the quote marks): + * "attribute_name", + */ diff --git a/src/include/site_que_attr_def.h b/src/include/site_que_attr_def.h new file mode 100644 index 0000000000..3e134f4f60 --- /dev/null +++ b/src/include/site_que_attr_def.h @@ -0,0 +1,102 @@ +/* +* OpenPBS (Portable Batch System) v2.3 Software License +* +* Copyright (c) 1999-2000 Veridian Information Solutions, Inc. +* All rights reserved. +* +* --------------------------------------------------------------------------- +* For a license to use or redistribute the OpenPBS software under conditions +* other than those described below, or to purchase support for this software, +* please contact Veridian Systems, PBS Products Department ("Licensor") at: +* +* www.OpenPBS.org +1 650 967-4675 sales@OpenPBS.org +* 877 902-4PBS (US toll-free) +* --------------------------------------------------------------------------- +* +* This license covers use of the OpenPBS v2.3 software (the "Software") at +* your site or location, and, for certain users, redistribution of the +* Software to other sites and locations. Use and redistribution of +* OpenPBS v2.3 in source and binary forms, with or without modification, +* are permitted provided that all of the following conditions are met. +* After December 31, 2001, only conditions 3-6 must be met: +* +* 1. Commercial and/or non-commercial use of the Software is permitted +* provided a current software registration is on file at www.OpenPBS.org. +* If use of this software contributes to a publication, product, or +* service, proper attribution must be given; see www.OpenPBS.org/credit.html +* +* 2. Redistribution in any form is only permitted for non-commercial, +* non-profit purposes. There can be no charge for the Software or any +* software incorporating the Software. Further, there can be no +* expectation of revenue generated as a consequence of redistributing +* the Software. +* +* 3. Any Redistribution of source code must retain the above copyright notice +* and the acknowledgment contained in paragraph 6, this list of conditions +* and the disclaimer contained in paragraph 7. +* +* 4. Any Redistribution in binary form must reproduce the above copyright +* notice and the acknowledgment contained in paragraph 6, this list of +* conditions and the disclaimer contained in paragraph 7 in the +* documentation and/or other materials provided with the distribution. +* +* 5. Redistributions in any form must be accompanied by information on how to +* obtain complete source code for the OpenPBS software and any +* modifications and/or additions to the OpenPBS software. The source code +* must either be included in the distribution or be available for no more +* than the cost of distribution plus a nominal fee, and all modifications +* and additions to the Software must be freely redistributable by any party +* (including Licensor) without restriction. +* +* 6. All advertising materials mentioning features or use of the Software must +* display the following acknowledgment: +* +* "This product includes software developed by NASA Ames Research Center, +* Lawrence Livermore National Laboratory, and Veridian Information +* Solutions, Inc. +* Visit www.OpenPBS.org for OpenPBS software support, +* products, and information." +* +* 7. DISCLAIMER OF WARRANTY +* +* THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. ANY EXPRESS +* OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES +* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT +* ARE EXPRESSLY DISCLAIMED. +* +* IN NO EVENT SHALL VERIDIAN CORPORATION, ITS AFFILIATED COMPANIES, OR THE +* U.S. GOVERNMENT OR ANY OF ITS AGENCIES BE LIABLE FOR ANY DIRECT OR INDIRECT, +* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, +* OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, +* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* This license will be governed by the laws of the Commonwealth of Virginia, +* without reference to its choice of law rules. +*/ + +/* + * @(#) $Id$ + */ + +/* + * Place holder for site supplied additions to the array of + * site queue attribute definitions, see server/queue_attr_def.c + * + * Array elements must be of the form: + * { "name", + * decode_Func, + * encode_Func, + * set_Func, + * comp_Func, + * free_Func, + * action_routine, + * permissions, + * ATR_TYPE_*, + * PARENT_TYPE_QUE_[ALL|EXC|RTE] + * }, + * + * Matching entry must be added in site_que_attr_enum.h + */ diff --git a/src/include/site_que_attr_enum.h b/src/include/site_que_attr_enum.h new file mode 100644 index 0000000000..7d76242d00 --- /dev/null +++ b/src/include/site_que_attr_enum.h @@ -0,0 +1,92 @@ +/* +* OpenPBS (Portable Batch System) v2.3 Software License +* +* Copyright (c) 1999-2000 Veridian Information Solutions, Inc. +* All rights reserved. +* +* --------------------------------------------------------------------------- +* For a license to use or redistribute the OpenPBS software under conditions +* other than those described below, or to purchase support for this software, +* please contact Veridian Systems, PBS Products Department ("Licensor") at: +* +* www.OpenPBS.org +1 650 967-4675 sales@OpenPBS.org +* 877 902-4PBS (US toll-free) +* --------------------------------------------------------------------------- +* +* This license covers use of the OpenPBS v2.3 software (the "Software") at +* your site or location, and, for certain users, redistribution of the +* Software to other sites and locations. Use and redistribution of +* OpenPBS v2.3 in source and binary forms, with or without modification, +* are permitted provided that all of the following conditions are met. +* After December 31, 2001, only conditions 3-6 must be met: +* +* 1. Commercial and/or non-commercial use of the Software is permitted +* provided a current software registration is on file at www.OpenPBS.org. +* If use of this software contributes to a publication, product, or +* service, proper attribution must be given; see www.OpenPBS.org/credit.html +* +* 2. Redistribution in any form is only permitted for non-commercial, +* non-profit purposes. There can be no charge for the Software or any +* software incorporating the Software. Further, there can be no +* expectation of revenue generated as a consequence of redistributing +* the Software. +* +* 3. Any Redistribution of source code must retain the above copyright notice +* and the acknowledgment contained in paragraph 6, this list of conditions +* and the disclaimer contained in paragraph 7. +* +* 4. Any Redistribution in binary form must reproduce the above copyright +* notice and the acknowledgment contained in paragraph 6, this list of +* conditions and the disclaimer contained in paragraph 7 in the +* documentation and/or other materials provided with the distribution. +* +* 5. Redistributions in any form must be accompanied by information on how to +* obtain complete source code for the OpenPBS software and any +* modifications and/or additions to the OpenPBS software. The source code +* must either be included in the distribution or be available for no more +* than the cost of distribution plus a nominal fee, and all modifications +* and additions to the Software must be freely redistributable by any party +* (including Licensor) without restriction. +* +* 6. All advertising materials mentioning features or use of the Software must +* display the following acknowledgment: +* +* "This product includes software developed by NASA Ames Research Center, +* Lawrence Livermore National Laboratory, and Veridian Information +* Solutions, Inc. +* Visit www.OpenPBS.org for OpenPBS software support, +* products, and information." +* +* 7. DISCLAIMER OF WARRANTY +* +* THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. ANY EXPRESS +* OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES +* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT +* ARE EXPRESSLY DISCLAIMED. +* +* IN NO EVENT SHALL VERIDIAN CORPORATION, ITS AFFILIATED COMPANIES, OR THE +* U.S. GOVERNMENT OR ANY OF ITS AGENCIES BE LIABLE FOR ANY DIRECT OR INDIRECT, +* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, +* OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, +* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* This license will be governed by the laws of the Commonwealth of Virginia, +* without reference to its choice of law rules. +*/ + +/* + * @(#) $Id$ + */ + +/* + * Place holder for site supplied additions to the queue's enumerated + * list of attributes, see queue.h. + * + * List should be of the form: + * Q_SITE_ATR_name, + * + * Matching entry must be added in site_que_attr_def.h + */ diff --git a/src/include/site_svr_attr_def.h b/src/include/site_svr_attr_def.h new file mode 100644 index 0000000000..f51b6c467d --- /dev/null +++ b/src/include/site_svr_attr_def.h @@ -0,0 +1,102 @@ +/* +* OpenPBS (Portable Batch System) v2.3 Software License +* +* Copyright (c) 1999-2000 Veridian Information Solutions, Inc. +* All rights reserved. +* +* --------------------------------------------------------------------------- +* For a license to use or redistribute the OpenPBS software under conditions +* other than those described below, or to purchase support for this software, +* please contact Veridian Systems, PBS Products Department ("Licensor") at: +* +* www.OpenPBS.org +1 650 967-4675 sales@OpenPBS.org +* 877 902-4PBS (US toll-free) +* --------------------------------------------------------------------------- +* +* This license covers use of the OpenPBS v2.3 software (the "Software") at +* your site or location, and, for certain users, redistribution of the +* Software to other sites and locations. Use and redistribution of +* OpenPBS v2.3 in source and binary forms, with or without modification, +* are permitted provided that all of the following conditions are met. +* After December 31, 2001, only conditions 3-6 must be met: +* +* 1. Commercial and/or non-commercial use of the Software is permitted +* provided a current software registration is on file at www.OpenPBS.org. +* If use of this software contributes to a publication, product, or +* service, proper attribution must be given; see www.OpenPBS.org/credit.html +* +* 2. Redistribution in any form is only permitted for non-commercial, +* non-profit purposes. There can be no charge for the Software or any +* software incorporating the Software. Further, there can be no +* expectation of revenue generated as a consequence of redistributing +* the Software. +* +* 3. Any Redistribution of source code must retain the above copyright notice +* and the acknowledgment contained in paragraph 6, this list of conditions +* and the disclaimer contained in paragraph 7. +* +* 4. Any Redistribution in binary form must reproduce the above copyright +* notice and the acknowledgment contained in paragraph 6, this list of +* conditions and the disclaimer contained in paragraph 7 in the +* documentation and/or other materials provided with the distribution. +* +* 5. Redistributions in any form must be accompanied by information on how to +* obtain complete source code for the OpenPBS software and any +* modifications and/or additions to the OpenPBS software. The source code +* must either be included in the distribution or be available for no more +* than the cost of distribution plus a nominal fee, and all modifications +* and additions to the Software must be freely redistributable by any party +* (including Licensor) without restriction. +* +* 6. All advertising materials mentioning features or use of the Software must +* display the following acknowledgment: +* +* "This product includes software developed by NASA Ames Research Center, +* Lawrence Livermore National Laboratory, and Veridian Information +* Solutions, Inc. +* Visit www.OpenPBS.org for OpenPBS software support, +* products, and information." +* +* 7. DISCLAIMER OF WARRANTY +* +* THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. ANY EXPRESS +* OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES +* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT +* ARE EXPRESSLY DISCLAIMED. +* +* IN NO EVENT SHALL VERIDIAN CORPORATION, ITS AFFILIATED COMPANIES, OR THE +* U.S. GOVERNMENT OR ANY OF ITS AGENCIES BE LIABLE FOR ANY DIRECT OR INDIRECT, +* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, +* OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, +* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* This license will be governed by the laws of the Commonwealth of Virginia, +* without reference to its choice of law rules. +*/ + +/* + * @(#) $Id$ + */ + +/* + * Place holder for site supplied additions to the array of site + * server attribute definitions, see server/svr_attr_def.c + * + * Array elements must be of the form: + * { "name", + * decode_Func, + * encode_Func, + * set_Func, + * comp_Func, + * free_Func, + * action_routine, + * permissions, + * ATR_TYPE_*, + * PARENT_TYPE_SERVER + * }, + * + * Matching entry must be added in site_sv_attr_enum.h + */ diff --git a/src/include/site_svr_attr_enum.h b/src/include/site_svr_attr_enum.h new file mode 100644 index 0000000000..5a263d4a20 --- /dev/null +++ b/src/include/site_svr_attr_enum.h @@ -0,0 +1,92 @@ +/* +* OpenPBS (Portable Batch System) v2.3 Software License +* +* Copyright (c) 1999-2000 Veridian Information Solutions, Inc. +* All rights reserved. +* +* --------------------------------------------------------------------------- +* For a license to use or redistribute the OpenPBS software under conditions +* other than those described below, or to purchase support for this software, +* please contact Veridian Systems, PBS Products Department ("Licensor") at: +* +* www.OpenPBS.org +1 650 967-4675 sales@OpenPBS.org +* 877 902-4PBS (US toll-free) +* --------------------------------------------------------------------------- +* +* This license covers use of the OpenPBS v2.3 software (the "Software") at +* your site or location, and, for certain users, redistribution of the +* Software to other sites and locations. Use and redistribution of +* OpenPBS v2.3 in source and binary forms, with or without modification, +* are permitted provided that all of the following conditions are met. +* After December 31, 2001, only conditions 3-6 must be met: +* +* 1. Commercial and/or non-commercial use of the Software is permitted +* provided a current software registration is on file at www.OpenPBS.org. +* If use of this software contributes to a publication, product, or +* service, proper attribution must be given; see www.OpenPBS.org/credit.html +* +* 2. Redistribution in any form is only permitted for non-commercial, +* non-profit purposes. There can be no charge for the Software or any +* software incorporating the Software. Further, there can be no +* expectation of revenue generated as a consequence of redistributing +* the Software. +* +* 3. Any Redistribution of source code must retain the above copyright notice +* and the acknowledgment contained in paragraph 6, this list of conditions +* and the disclaimer contained in paragraph 7. +* +* 4. Any Redistribution in binary form must reproduce the above copyright +* notice and the acknowledgment contained in paragraph 6, this list of +* conditions and the disclaimer contained in paragraph 7 in the +* documentation and/or other materials provided with the distribution. +* +* 5. Redistributions in any form must be accompanied by information on how to +* obtain complete source code for the OpenPBS software and any +* modifications and/or additions to the OpenPBS software. The source code +* must either be included in the distribution or be available for no more +* than the cost of distribution plus a nominal fee, and all modifications +* and additions to the Software must be freely redistributable by any party +* (including Licensor) without restriction. +* +* 6. All advertising materials mentioning features or use of the Software must +* display the following acknowledgment: +* +* "This product includes software developed by NASA Ames Research Center, +* Lawrence Livermore National Laboratory, and Veridian Information +* Solutions, Inc. +* Visit www.OpenPBS.org for OpenPBS software support, +* products, and information." +* +* 7. DISCLAIMER OF WARRANTY +* +* THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. ANY EXPRESS +* OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES +* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT +* ARE EXPRESSLY DISCLAIMED. +* +* IN NO EVENT SHALL VERIDIAN CORPORATION, ITS AFFILIATED COMPANIES, OR THE +* U.S. GOVERNMENT OR ANY OF ITS AGENCIES BE LIABLE FOR ANY DIRECT OR INDIRECT, +* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, +* OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, +* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* This license will be governed by the laws of the Commonwealth of Virginia, +* without reference to its choice of law rules. +*/ + +/* + * @(#) $Id$ + */ + +/* + * Place holder for site supplied additions to the server's enumerated + * list of attributes, see server.h. + * + * List should be of the form: + * SVR_SITE_ATR_name, + * + * Matching entry must be added in site_sv_attr_def.h + */ diff --git a/src/lib/Libattr/attr_atomic.c b/src/lib/Libattr/attr_atomic.c index a43fab9848..f2969d60c3 100644 --- a/src/lib/Libattr/attr_atomic.c +++ b/src/lib/Libattr/attr_atomic.c @@ -162,7 +162,7 @@ int attr_atomic_set( { /* from a daemon, just ignore this pbs_attribute */ - plist = GET_NEXT(plist->al_link); + plist = (svrattrl *)GET_NEXT(plist->al_link); continue; } @@ -199,7 +199,7 @@ int attr_atomic_set( if (gpuval != NULL) { - rc = (pdef + index)->at_decode(&temp, plist->al_name, "gpus", + rc = (pdef + index)->at_decode(&temp, plist->al_name, (char *)"gpus", gpuval,ATR_DFLAG_ACCESS); free(gpuval); @@ -217,7 +217,7 @@ int attr_atomic_set( /* delete old resource_list.gpus value if any. * this can be done by setting it to zero */ - rc = (pdef + index)->at_decode(&temp, plist->al_name, "gpus", + rc = (pdef + index)->at_decode(&temp, plist->al_name, (char *)"gpus", 0,ATR_DFLAG_ACCESS); if (rc != 0) { diff --git a/src/lib/Libattr/attr_fn_acl.c b/src/lib/Libattr/attr_fn_acl.c index 39e3fcfd73..4f5075f032 100644 --- a/src/lib/Libattr/attr_fn_acl.c +++ b/src/lib/Libattr/attr_fn_acl.c @@ -93,6 +93,9 @@ #include "attribute.h" #include "pbs_error.h" +/* This typedef allows a function to return a pointer to a function */ +typedef int (*fptr_int)(const char *, const char *); + /* * This file contains general functions for attributes of type * User/Group/Hosts Acess Control List. @@ -123,14 +126,14 @@ /* Private Functions */ -static int hacl_match(const char *can, const char *master); -static int uhacl_match(const char *can, const char *master); -static int user_match(const char *can, const char *master); -static int gid_match(const char *can, const char *master); -static int host_order(char *old, char *new_order); -static int user_order(char *old, char *new_order); -static int set_allacl(pbs_attribute *, pbs_attribute *, enum batch_op, - int (*order_func)()); +int hacl_match(const char *can, const char *master); +int uhacl_match(const char *can, const char *master); +int user_match(const char *can, const char *master); +int gid_match(const char *can, const char *master); +int host_order(char *old, char *new_order); +int user_order(char *old, char *new_order); +int set_allacl(pbs_attribute *, pbs_attribute *, enum batch_op, + int (*order_func)(char *, char *)); /* for all decode_*acl() - use decode_arst() */ /* for all encode_*acl() - use encode_arst() */ @@ -182,9 +185,9 @@ int set_hostacl( /* this function returns a function pointer */ -int (*get_my_match_func( +fptr_int get_my_match_func( - int type))(const char *, const char *) + int type) { int (*match_func)(const char *, const char *); @@ -215,11 +218,11 @@ int (*get_my_match_func( default: - match_func = (int (*)())strcmp; + match_func = strcmp; break; } - return(match_func); + return((fptr_int)match_func); } /* END get_my_match_func() */ @@ -346,7 +349,7 @@ int acl_check( * between the new and old list. */ -static int chk_dup_acl( +int chk_dup_acl( struct array_strings *old, struct array_strings *new_string) @@ -390,7 +393,7 @@ static int chk_dup_acl( * parameter which indicates the ACL type. */ -static int set_allacl( +int set_allacl( pbs_attribute *attr, pbs_attribute *new_attr, @@ -480,7 +483,7 @@ static int set_allacl( nsize += nsize / 2; /* alloc extra space */ - if (!(pas->as_buf = calloc(1, (size_t)nsize))) + if (!(pas->as_buf = (char *)calloc(1, (size_t)nsize))) { pas->as_bufsize = 0; return (PBSE_SYSTEM); @@ -518,7 +521,7 @@ static int set_allacl( need = pas->as_bufsize + 2 * nsize; /* alloc new buf */ - pc = calloc(1, need); + pc = (char *)calloc(1, need); if (pc == (char *)0) return (PBSE_SYSTEM); @@ -654,8 +657,7 @@ static int set_allacl( * Returns 0 if strings match, 1 if not - to match strcmp() */ -static int -user_match(const char *can, const char *master) +int user_match(const char *can, const char *master) { /* match user name first */ @@ -703,7 +705,7 @@ user_match(const char *can, const char *master) * 1 if s1 sorts after s2 */ -static int user_order( +int user_order( char *s1, char *s2) @@ -741,7 +743,7 @@ static int user_order( /* * group acl match - match 2 groups by gid */ -static int gid_match(const char *group1, const char *group2) +int gid_match(const char *group1, const char *group2) { struct group *pgrp; @@ -893,7 +895,7 @@ int acl_wildcard_check( * Returns 0 if strings match, 1 if not - to match strcmp() */ -static int hacl_match( +int hacl_match( const char *can, const char *master) @@ -1035,7 +1037,7 @@ int match_strings(const char *can, const char *master) * Returns 0 if strings match, 1 if not - to match strcmp() */ -static int uhacl_match( +int uhacl_match( const char *can, const char *master) @@ -1121,7 +1123,7 @@ static int uhacl_match( * 1 if s1 sorts after s2 */ -static int host_order( +int host_order( char *s1, char *s2) diff --git a/src/lib/Libattr/attr_fn_arst.c b/src/lib/Libattr/attr_fn_arst.c index 81e0316e77..20fef7e0c3 100644 --- a/src/lib/Libattr/attr_fn_arst.c +++ b/src/lib/Libattr/attr_fn_arst.c @@ -143,7 +143,7 @@ int decode_arst_direct( ns = 1; ssize = strlen(val) + 1; - if ((tmpval = calloc(1, ssize)) == NULL) + if ((tmpval =(char *) calloc(1, ssize)) == NULL) { /* FAILURE */ @@ -174,7 +174,7 @@ int decode_arst_direct( ssize--; } - if ((pbuf = calloc(1, (unsigned)ssize)) == NULL) + if ((pbuf = (char *)calloc(1, (unsigned)ssize)) == NULL) { /* FAILURE */ free(tmpval); @@ -645,7 +645,7 @@ int set_arst( nsize += nsize / 2; /* alloc extra space */ - if (!(pas->as_buf = calloc(1, (size_t)nsize))) + if (!(pas->as_buf = (char *)calloc(1, (size_t)nsize))) { pas->as_bufsize = 0; @@ -677,12 +677,12 @@ int set_arst( if (pas->as_buf) { - pc = realloc(pas->as_buf, (size_t)need); + pc = (char *)realloc(pas->as_buf, (size_t)need); if (pc != NULL) memset(pc + pas->as_bufsize, 0, need - pas->as_bufsize); } else - pc = calloc(1, (size_t)need); + pc = (char *)calloc(1, (size_t)need); if (pc == NULL) { @@ -779,7 +779,7 @@ int set_arst( tmp_arst->as_bufsize = need; /* calloc the buffer size */ - pc = calloc(1, need); + pc = (char *)calloc(1, need); if (pc == NULL) { diff --git a/src/lib/Libattr/attr_fn_str.c b/src/lib/Libattr/attr_fn_str.c index 00a81a7c14..f9e06d1418 100644 --- a/src/lib/Libattr/attr_fn_str.c +++ b/src/lib/Libattr/attr_fn_str.c @@ -142,7 +142,7 @@ int decode_str( if ((val != NULL) && ((len = strlen(val) + 1) > 1)) { - patr->at_val.at_str = calloc(1, (unsigned)len); + patr->at_val.at_str = (char *)calloc(1, (unsigned)len); if (patr->at_val.at_str == NULL) { @@ -260,7 +260,7 @@ int set_str( case SET: /* set is replace old string with new */ - if ((new_value = calloc(1, nsize)) == NULL) + if ((new_value =(char *)calloc(1, nsize)) == NULL) return (PBSE_SYSTEM); if (attr->at_val.at_str) @@ -274,7 +274,7 @@ int set_str( case INCR: /* INCR is concatenate new to old string */ nsize += strlen(attr->at_val.at_str); - new_value = calloc(1, nsize + 1); + new_value = (char *)calloc(1, nsize + 1); if (new_value == NULL) return (PBSE_SYSTEM); diff --git a/src/lib/Libattr/attr_func.c b/src/lib/Libattr/attr_func.c index ea6efdbca2..8ed94ed84e 100644 --- a/src/lib/Libattr/attr_func.c +++ b/src/lib/Libattr/attr_func.c @@ -316,7 +316,7 @@ svrattrl *attrlist_alloc( tsize = sizeof(svrattrl) + szname + szresc + szval; - pal = calloc(1, tsize); + pal = (svrattrl *)calloc(1, tsize); if (pal == NULL) { diff --git a/src/lib/Libattr/attr_node_func.c b/src/lib/Libattr/attr_node_func.c index 99d6b31761..d66226d06f 100644 --- a/src/lib/Libattr/attr_node_func.c +++ b/src/lib/Libattr/attr_node_func.c @@ -153,12 +153,12 @@ static struct node_state } ns[] = { - {INUSE_UNKNOWN, ND_state_unknown}, - {INUSE_DOWN, ND_down}, - {INUSE_OFFLINE, ND_offline}, - {INUSE_RESERVE, ND_reserve}, - {INUSE_JOB, ND_job_exclusive}, - {INUSE_BUSY, ND_busy}, + {INUSE_UNKNOWN, (char *)ND_state_unknown}, + {INUSE_DOWN, (char *)ND_down}, + {INUSE_OFFLINE, (char *)ND_offline}, + {INUSE_RESERVE, (char *)ND_reserve}, + {INUSE_JOB, (char *)ND_job_exclusive}, + {INUSE_BUSY, (char *)ND_busy}, {0, NULL} }; diff --git a/src/lib/Libattr/attr_node_func.h b/src/lib/Libattr/attr_node_func.h index 135ef49924..43d81cfd7b 100644 --- a/src/lib/Libattr/attr_node_func.h +++ b/src/lib/Libattr/attr_node_func.h @@ -20,23 +20,23 @@ int decode_ntype(pbs_attribute *pattr, char *name, char *rescn, char *val, int p void free_prop_list(struct prop *prop); -int set_node_state(pbs_attribute *pattr, pbs_attribute *new, enum batch_op op); +int set_node_state(pbs_attribute *pattr, pbs_attribute *new_attr, enum batch_op op); -int set_node_ntype(pbs_attribute *pattr, pbs_attribute *new, enum batch_op op); +int set_node_ntype(pbs_attribute *pattr, pbs_attribute *new_attr, enum batch_op op); /* static int set_nodeflag(char *str, short *pflag); */ -int node_state(pbs_attribute *new, void *pnode, int actmode); +int node_state(pbs_attribute *new_attr, void *pnode, int actmode); -int node_ntype(pbs_attribute *new, void *pnode, int actmode); +int node_ntype(pbs_attribute *new_attr, void *pnode, int actmode); -int node_prop_list(pbs_attribute *new, void *pnode, int actmode); +int node_prop_list(pbs_attribute *new_attr, void *pnode, int actmode); -int node_status_list(pbs_attribute *new, void *pnode, int actmode); +int node_status_list(pbs_attribute *new_attr, void *pnode, int actmode); -int node_gpustatus_list(pbs_attribute *new, void *pnode, int actmode); +int node_gpustatus_list(pbs_attribute *new_attr, void *pnode, int actmode); -int node_note(pbs_attribute *new, void *pnode, int actmode); +int node_note(pbs_attribute *new_attr, void *pnode, int actmode); -int set_note_str(struct pbs_attribute *attr, struct pbs_attribute *new, enum batch_op op); +int set_note_str(struct pbs_attribute *attr, struct pbs_attribute *new_attr, enum batch_op op); diff --git a/src/lib/Libcmds/add_verify_resources.c b/src/lib/Libcmds/add_verify_resources.c index a6b019cf7c..ac3dae5ffd 100644 --- a/src/lib/Libcmds/add_verify_resources.c +++ b/src/lib/Libcmds/add_verify_resources.c @@ -282,7 +282,7 @@ int add_verify_resources( hash_add_or_exit(mm, res_attr, name, value, p_type); } else - hash_add_or_exit(mm, res_attr, name, "\0", p_type); + hash_add_or_exit(mm, res_attr, name, (char *)"\0", p_type); } else { diff --git a/src/lib/Libcmds/cvtdate.c b/src/lib/Libcmds/cvtdate.c index 4c3ab70a2d..e936c6fbed 100644 --- a/src/lib/Libcmds/cvtdate.c +++ b/src/lib/Libcmds/cvtdate.c @@ -106,9 +106,10 @@ #include #include -time_t -cvtdate(datestr) -char *datestr; +time_t cvtdate( + + char *datestr) + { char buf[3]; time_t clock; diff --git a/src/lib/Libcmds/parse_depend.c b/src/lib/Libcmds/parse_depend.c index 2d17573f54..bd2a37e3c0 100644 --- a/src/lib/Libcmds/parse_depend.c +++ b/src/lib/Libcmds/parse_depend.c @@ -88,30 +88,30 @@ static char *deptypes[] = { - "on", /* "on" and "synccount" must be first two */ - "synccount", - "after", - "afterok", - "afternotok", - "afterany", - "before", - "beforeok", - "beforenotok", - "beforeany", - "syncwith", + (char *)"on", /* "on" and "synccount" must be first two */ + (char *)"synccount", + (char *)"after", + (char *)"afterok", + (char *)"afternotok", + (char *)"afterany", + (char *)"before", + (char *)"beforeok", + (char *)"beforenotok", + (char *)"beforeany", + (char *)"syncwith", (char *)0 }; static char *arraydeptypes[] = { - "afterstartarray", - "afterokarray", - "afternotokarray", - "afteranyarray", - "beforestartarray", - "beforeokarray", - "beforenotokarray", - "beforeanyarray", + (char *)"afterstartarray", + (char *)"afterokarray", + (char *)"afternotokarray", + (char *)"afteranyarray", + (char *)"beforestartarray", + (char *)"beforeokarray", + (char *)"beforenotokarray", + (char *)"beforeanyarray", (char *)0 }; diff --git a/src/lib/Libcmds/prepare_path.c b/src/lib/Libcmds/prepare_path.c index 845aba32f0..263a5d6efe 100644 --- a/src/lib/Libcmds/prepare_path.c +++ b/src/lib/Libcmds/prepare_path.c @@ -316,14 +316,16 @@ int prepare_path( if (strncmp(path_name,"$HOME",strlen("$HOME")) == 0) { /* get the actual value for $HOME */ + size_t path_out_length; + size_t home_val_length; char *HomeVal = getenv("HOME"); char *NamePtr = path_name+strlen("$HOME"); if((HomeVal == NULL)||(NamePtr == NULL)) return(1); + path_out_length = strlen(HomeVal); + home_val_length = strlen(NamePtr); /* check if the path exeeds MAXPATHLEN */ - size_t path_out_length = strlen(HomeVal); - size_t home_val_length = strlen(NamePtr); if (path_out_length + home_val_length >= MAXPATHLEN) { return(4); diff --git a/src/lib/Libcmds/set_resource.c b/src/lib/Libcmds/set_resource.c index 9c1423af94..62077fd0b9 100644 --- a/src/lib/Libcmds/set_resource.c +++ b/src/lib/Libcmds/set_resource.c @@ -104,7 +104,7 @@ int set_resources( int add) /* I */ { - static char *gres_str = "gres"; + static char *gres_str = (char *)"gres"; char *r; char *eq; char *v; @@ -288,10 +288,10 @@ int set_resources( if (!strncmp(r,"gpus",strlen("gpus"))) { /* handle gpus specially */ - char *gpu_suffix = "gpus:"; + char *gpu_suffix = (char *)"gpus:"; int gpu_len = strlen(gpu_suffix) + 1 + (e - v); - str = calloc(1, gpu_len); + str = (char *)calloc(1, gpu_len); if (str == NULL) { diff --git a/src/lib/Libifl/Makefile.am b/src/lib/Libifl/Makefile.am index 43fa40ee12..852f4f68bc 100644 --- a/src/lib/Libifl/Makefile.am +++ b/src/lib/Libifl/Makefile.am @@ -12,4 +12,4 @@ include_HEADERS = lib_ifl.h noinst_LIBRARIES = libifl.a -libifl_a_SOURCES = PBSD_gpuctrl2.c PBSD_manage2.c PBSD_manager_caps.c PBSD_msg2.c PBSD_rdrpy.c PBSD_sig2.c PBSD_status.c PBSD_status2.c PBSD_submit_caps.c PBS_attr.c PBS_data.c dec_Authen.c dec_CpyFil.c dec_Gpu.c dec_JobCred.c dec_JobFile.c dec_JobId.c dec_JobObit.c dec_Manage.c dec_MoveJob.c dec_MsgJob.c dec_QueueJob.c dec_Reg.c dec_ReqExt.c dec_ReqHdr.c dec_Resc.c dec_ReturnFile.c dec_RunJob.c dec_Shut.c dec_Sig.c dec_Status.c dec_Track.c dec_attrl.c dec_attropl.c dec_rpyc.c dec_rpys.c dec_svrattrl.c enc_CpyFil.c enc_Gpu.c enc_JobCred.c enc_JobFile.c enc_JobId.c enc_JobObit.c enc_Manage.c enc_MoveJob.c enc_MsgJob.c enc_QueueJob.c enc_QueueJob_hash.c enc_Reg.c enc_ReqExt.c enc_ReqHdr.c enc_ReturnFile.c enc_RunJob.c enc_Shut.c enc_Sig.c enc_Status.c enc_Track.c enc_attrl.c enc_attropl.c enc_attropl_hash.c enc_reply.c enc_svrattrl.c get_svrport.c list_link.c nonblock.c pbsD_alterjo.c pbsD_asyrun.c pbsD_chkptjob.c pbsD_connect.c pbsD_deljob.c pbsD_gpuctrl.c pbsD_holdjob.c pbsD_locjob.c pbsD_manager.c pbsD_movejob.c pbsD_msgjob.c pbsD_orderjo.c pbsD_rerunjo.c pbsD_resc.c pbsD_rlsjob.c pbsD_runjob.c pbsD_selectj.c pbsD_sigjob.c pbsD_stagein.c pbsD_statjob.c pbsD_statnode.c pbsD_statque.c pbsD_statsrv.c pbsD_submit.c pbsD_submit_hash.c pbsD_termin.c pbs_geterrmg.c pbs_statfree.c rpp.c tcp_dis.c tm.c torquecfg.c trq_auth.c +libifl_a_SOURCES = PBSD_gpuctrl2.c PBSD_manage2.c PBSD_manager_caps.c PBSD_msg2.c PBSD_rdrpy.c PBSD_sig2.c PBSD_status.c PBSD_status2.c PBSD_submit_caps.c PBS_attr.c PBS_data.c dec_Authen.c dec_CpyFil.c dec_Gpu.c dec_JobCred.c dec_JobFile.c dec_JobId.c dec_JobObit.c dec_Manage.c dec_MoveJob.c dec_MsgJob.c dec_QueueJob.c dec_Reg.c dec_ReqExt.c dec_ReqHdr.c dec_Resc.c dec_ReturnFile.c dec_RunJob.c dec_Shut.c dec_Sig.c dec_Status.c dec_Track.c dec_attrl.c dec_attropl.c dec_rpyc.c dec_rpys.c dec_svrattrl.c enc_CpyFil.c enc_Gpu.c enc_JobCred.c enc_JobFile.c enc_JobId.c enc_JobObit.c enc_Manage.c enc_MoveJob.c enc_MsgJob.c enc_QueueJob.c enc_QueueJob_hash.c enc_Reg.c enc_ReqExt.c enc_ReqHdr.c enc_ReturnFile.c enc_RunJob.c enc_Shut.c enc_Sig.c enc_Status.c enc_Track.c enc_attrl.c enc_attropl.c enc_attropl_hash.c enc_reply.c enc_svrattrl.c get_svrport.c list_link.c nonblock.c pbsD_alterjo.c pbsD_asyrun.c pbsD_chkptjob.c pbsD_connect.c pbsD_deljob.c pbsD_gpuctrl.c pbsD_holdjob.c pbsD_locjob.c pbsD_manager.c pbsD_movejob.c pbsD_msgjob.c pbsD_orderjo.c pbsD_rerunjo.c pbsD_resc.c pbsD_rlsjob.c pbsD_runjob.c pbsD_selectj.c pbsD_sigjob.c pbsD_stagein.c pbsD_statjob.c pbsD_statnode.c pbsD_statque.c pbsD_statsrv.c pbsD_submit.c pbsD_submit_hash.c pbsD_termin.c pbs_geterrmg.c pbs_statfree.c tcp_dis.c tm.c torquecfg.c trq_auth.c diff --git a/src/lib/Libifl/PBSD_status.c b/src/lib/Libifl/PBSD_status.c index ff4979fda6..bcbc2ab09f 100644 --- a/src/lib/Libifl/PBSD_status.c +++ b/src/lib/Libifl/PBSD_status.c @@ -105,7 +105,7 @@ struct batch_status *PBSD_status( /* send the status request */ if (id == NULL) - id = ""; /* set to null string for encoding */ + id =(char *)""; /* set to null string for encoding */ rc = PBSD_status_put(c, function, id, attrib, extend); diff --git a/src/lib/Libifl/PBSD_submit_caps.c b/src/lib/Libifl/PBSD_submit_caps.c index fe29ef548e..c66cc338e9 100644 --- a/src/lib/Libifl/PBSD_submit_caps.c +++ b/src/lib/Libifl/PBSD_submit_caps.c @@ -317,7 +317,7 @@ static int PBSD_scbuf( return(PBSE_MEM_MALLOC); } else if (jobid == NULL) - jobid = ""; /* use null string for null pointer */ + jobid = (char *)""; /* use null string for null pointer */ if ((rc = encode_DIS_ReqHdr(chan, reqtype, pbs_current_user)) || (rc = encode_DIS_JobFile(chan, seq, buf, len, jobid, which)) || diff --git a/src/lib/Libifl/dec_attrl.c b/src/lib/Libifl/dec_attrl.c index b1637d5509..8275a3956e 100644 --- a/src/lib/Libifl/dec_attrl.c +++ b/src/lib/Libifl/dec_attrl.c @@ -134,7 +134,7 @@ int decode_DIS_attrl( if (rc) break; - pat = calloc(1, sizeof(struct attrl)); + pat = (struct attrl *)calloc(1, sizeof(struct attrl)); if (pat == NULL) return DIS_NOMALLOC; diff --git a/src/lib/Libifl/dec_attropl.c b/src/lib/Libifl/dec_attropl.c index 1714b0e62e..70a04561a2 100644 --- a/src/lib/Libifl/dec_attropl.c +++ b/src/lib/Libifl/dec_attropl.c @@ -136,7 +136,7 @@ int decode_DIS_attropl( if (rc) break; - pat = calloc(1, sizeof(struct attropl)); + pat = (struct attropl *)calloc(1, sizeof(struct attropl)); if (pat == 0) return DIS_NOMALLOC; diff --git a/src/lib/Libifl/enc_CpyFil.c b/src/lib/Libifl/enc_CpyFil.c index db7256e698..ddab9f72ee 100644 --- a/src/lib/Libifl/enc_CpyFil.c +++ b/src/lib/Libifl/enc_CpyFil.c @@ -114,7 +114,7 @@ int encode_DIS_CopyFiles( { int pair_ct = 0; - char *nullstr = ""; + char *nullstr = (char *)""; struct rqfpair *ppair; int rc; diff --git a/src/lib/Libifl/enc_JobFile.c b/src/lib/Libifl/enc_JobFile.c index 878fbda9b3..a829b7d474 100644 --- a/src/lib/Libifl/enc_JobFile.c +++ b/src/lib/Libifl/enc_JobFile.c @@ -106,7 +106,7 @@ int encode_DIS_JobFile( int rc; if (jobid == (char *)0) - jobid = ""; + jobid = (char *)""; if ((rc = diswui(chan, seq) != 0) || (rc = diswui(chan, which) != 0) || diff --git a/src/lib/Libifl/enc_QueueJob.c b/src/lib/Libifl/enc_QueueJob.c index 395d6f811e..6c768a4fa4 100644 --- a/src/lib/Libifl/enc_QueueJob.c +++ b/src/lib/Libifl/enc_QueueJob.c @@ -106,10 +106,10 @@ int encode_DIS_QueueJob( int rc; if (jobid == (char *)0) - jobid = ""; + jobid = (char *)""; if (destin == (char *)0) - destin = ""; + destin = (char *)""; if ((rc = diswst(chan, jobid) != 0) || (rc = diswst(chan, destin) != 0)) diff --git a/src/lib/Libifl/enc_QueueJob_hash.c b/src/lib/Libifl/enc_QueueJob_hash.c index 24df1f5a07..dca975ebe1 100644 --- a/src/lib/Libifl/enc_QueueJob_hash.c +++ b/src/lib/Libifl/enc_QueueJob_hash.c @@ -112,10 +112,10 @@ int encode_DIS_QueueJob_hash( int rc; if (jobid == (char *)0) - jobid = ""; + jobid = (char *)""; if (destin == (char *)0) - destin = ""; + destin = (char *)""; if ((rc = diswst(chan, jobid) != 0) || (rc = diswst(chan, destin) != 0)) diff --git a/src/lib/Libifl/enc_attropl_hash.c b/src/lib/Libifl/enc_attropl_hash.c index ba1c7ea51e..2d7dc80a48 100644 --- a/src/lib/Libifl/enc_attropl_hash.c +++ b/src/lib/Libifl/enc_attropl_hash.c @@ -139,7 +139,7 @@ int build_var_list( /* new_len = len + 1; *//* Existing string, */ name_len = strlen(atr->name); /* name= */ value_len = strlen(atr->value); /* value\0 */ - *var_list = memmgr_realloc(mm, *var_list, + *var_list = (char *)memmgr_realloc(mm, *var_list, current_len + 1 + name_len + 1 + value_len + 1); if (current_len != 0) { @@ -163,7 +163,7 @@ int build_var_list( { name_len = strlen(atr->name)-8; /* name= */ value_len = strlen(atr->value); /* value\0 */ - *var_list = memmgr_realloc(mm, *var_list, + *var_list = (char *)memmgr_realloc(mm, *var_list, current_len + 1 + name_len + 1 + value_len + 1); if (current_len != 0) { @@ -185,7 +185,7 @@ int build_var_list( /* len = strlen(*var_list); */ /* new_len = len + 1; *//* Existing string, */ value_len = strlen(atr->value); /* value\0 */ - *var_list = memmgr_realloc(mm, *var_list, + *var_list = (char *)memmgr_realloc(mm, *var_list, current_len + 1 + value_len + 1); if (current_len != 0) { @@ -203,7 +203,7 @@ int build_var_list( } if (preexisting_var_list == TRUE) { - hash_del_item(mm, attrs, ATTR_v); + hash_del_item(mm, attrs, (char *)ATTR_v); } return(item_count); diff --git a/src/lib/Libifl/lib_ifl.h b/src/lib/Libifl/lib_ifl.h index 293711cc1a..5532a2b818 100644 --- a/src/lib/Libifl/lib_ifl.h +++ b/src/lib/Libifl/lib_ifl.h @@ -216,8 +216,8 @@ int encode_DIS_svrattrl(struct tcp_chan *chan, svrattrl *psattl); unsigned int get_svrport(char *service_name, char *ptype, unsigned int pdefault); /* list_link.c */ -void insert_link(struct list_link *old, struct list_link *new, void *pobj, int position); -void append_link(tlist_head *head, list_link *new, void *pobj); +void insert_link(struct list_link *old, struct list_link *new_link, void *pobj, int position); +void append_link(tlist_head *head, list_link *new_link, void *pobj); void delete_link(struct list_link *old); void swap_link(list_link *pone, list_link *ptwo); int is_linked(list_link *head, list_link *entry); @@ -404,7 +404,6 @@ int rpp_flush(int index); int rpp_bind(uint port); int rpp_open(char *name, uint port, char *EMsg); struct sockaddr_in *rpp_getaddr(int index); -void rpp_terminate(void); void rpp_shutdown_on_exit(int foo, void *bar); void rpp_shutdown(void); int rpp_close(int index); diff --git a/src/lib/Libifl/pbsD_asyrun.c b/src/lib/Libifl/pbsD_asyrun.c index 0981b28b5f..bbda850c02 100644 --- a/src/lib/Libifl/pbsD_asyrun.c +++ b/src/lib/Libifl/pbsD_asyrun.c @@ -110,7 +110,7 @@ int pbs_asyrunjob_err( } if (location == NULL) - location = ""; + location = (char *)""; pthread_mutex_lock(connection[c].ch_mutex); diff --git a/src/lib/Libifl/pbsD_connect.c b/src/lib/Libifl/pbsD_connect.c index 7a66f89c07..b8efafef74 100644 --- a/src/lib/Libifl/pbsD_connect.c +++ b/src/lib/Libifl/pbsD_connect.c @@ -335,8 +335,8 @@ char *PBS_get_server( if (dflt_port == 0) { dflt_port = get_svrport( - PBS_BATCH_SERVICE_NAME, - "tcp", + (char *)PBS_BATCH_SERVICE_NAME, + (char *)"tcp", PBS_BATCH_SERVICE_PORT); } @@ -430,7 +430,7 @@ int PBSD_munge_authenticate( { /* read failed */ local_errno = errno; - log_err(local_errno, __func__, "error reading pipe in PBSD_munge_authenticate"); + log_err(local_errno, __func__, (char *)"error reading pipe in PBSD_munge_authenticate"); return -1; } @@ -552,7 +552,7 @@ int validate_socket( snprintf(tmp_buf, LOCAL_LOG_BUF, "cannot get account info: uid %d, errno %d (%s)\n", (int)myrealuid, errno, strerror(errno)); log_event(PBSEVENT_ADMIN, PBS_EVENTCLASS_SERVER, __func__, tmp_buf); } - else if ((rc = get_hostaddr_hostent_af(&local_errno, AUTH_IP, &af_family, &l_server, &l_server_len)) != PBSE_NONE) + else if ((rc = get_hostaddr_hostent_af(&local_errno, (char *)AUTH_IP, &af_family, &l_server, &l_server_len)) != PBSE_NONE) { } else if ((rc = get_parent_client_socket(psock, &parent_client_socket)) != PBSE_NONE) @@ -802,7 +802,7 @@ int pbs_original_connect( { if (connection[i].ch_mutex == NULL) { - connection[i].ch_mutex = calloc(1, sizeof(pthread_mutex_t)); + connection[i].ch_mutex = (pthread_mutex_t *)calloc(1, sizeof(pthread_mutex_t)); pthread_mutex_init(connection[i].ch_mutex,NULL); } @@ -1598,7 +1598,7 @@ void initialize_connections_table() for (i = 1;i < PBS_NET_MAX_CONNECTIONS;i++) { - connection[i].ch_mutex = calloc(1, sizeof(pthread_mutex_t)); + connection[i].ch_mutex = (pthread_mutex_t *)calloc(1, sizeof(pthread_mutex_t)); pthread_mutex_init(connection[i].ch_mutex, NULL); } } /* END initialize_connections_table() */ diff --git a/src/lib/Libifl/pbsD_holdjob.c b/src/lib/Libifl/pbsD_holdjob.c index ba7e2f9eb2..d2ca3ef380 100644 --- a/src/lib/Libifl/pbsD_holdjob.c +++ b/src/lib/Libifl/pbsD_holdjob.c @@ -102,12 +102,12 @@ int pbs_holdjob_err( if ((jobid == (char *)0) || (*jobid == '\0')) return(PBSE_IVALREQ); - aopl.name = ATTR_h; + aopl.name = (char *)ATTR_h; aopl.resource = (char *)NULL; if ((holdtype == (char *)NULL) || (*holdtype == '\0')) - aopl.value = "u"; + aopl.value = (char *)"u"; else aopl.value = holdtype; diff --git a/src/lib/Libifl/pbsD_movejob.c b/src/lib/Libifl/pbsD_movejob.c index b62b99fa7a..189a02d493 100644 --- a/src/lib/Libifl/pbsD_movejob.c +++ b/src/lib/Libifl/pbsD_movejob.c @@ -105,7 +105,7 @@ int pbs_movejob_err( return (PBSE_IVALREQ); if (destin == (char *)0) - destin = ""; + destin = (char *)""; pthread_mutex_lock(connection[c].ch_mutex); diff --git a/src/lib/Libifl/pbsD_resc.c b/src/lib/Libifl/pbsD_resc.c index b784aaa7ee..d2711df7d1 100644 --- a/src/lib/Libifl/pbsD_resc.c +++ b/src/lib/Libifl/pbsD_resc.c @@ -94,7 +94,7 @@ static int nodes_avail = 0; static int nodes_alloc = 0; static int nodes_resrv = 0; static int nodes_down = 0; -static char *resc_nodes = "nodes"; +static char *resc_nodes = (char *)"nodes"; /* * tcp_encode_DIS_resc() - encode a resource related request, @@ -416,13 +416,13 @@ char *avail( int dwn; if (pbs_rescquery(con, &resc, 1, &av, &al, &res, &dwn) != 0) - return ("?"); + return ((char *)"?"); else if (av > 0) - return ("yes"); + return ((char *)"yes"); else if (av == 0) - return ("no"); + return ((char *)"no"); else - return ("never"); + return ((char *)"never"); } diff --git a/src/lib/Libifl/pbsD_rlsjob.c b/src/lib/Libifl/pbsD_rlsjob.c index c58bb539b6..04cf4017c7 100644 --- a/src/lib/Libifl/pbsD_rlsjob.c +++ b/src/lib/Libifl/pbsD_rlsjob.c @@ -103,12 +103,12 @@ int pbs_rlsjob_err( if ((jobid == (char *)0) || (*jobid == '\0') || c < 0) return (PBSE_IVALREQ); - aopl.name = ATTR_h; + aopl.name = (char *)ATTR_h; aopl.resource = (char *)NULL; if ((holdtype == (char *)NULL) || (*holdtype == '\0')) - aopl.value = "u"; + aopl.value = (char *)"u"; else aopl.value = holdtype; diff --git a/src/lib/Libifl/pbsD_runjob.c b/src/lib/Libifl/pbsD_runjob.c index 6f96a93a5a..858724f11f 100644 --- a/src/lib/Libifl/pbsD_runjob.c +++ b/src/lib/Libifl/pbsD_runjob.c @@ -154,7 +154,7 @@ int pbs_runjob_err( if (location == NULL) { - location = ""; + location = (char *)""; } pthread_mutex_lock(connection[c].ch_mutex); diff --git a/src/lib/Libifl/pbsD_stagein.c b/src/lib/Libifl/pbsD_stagein.c index 8bb50c775e..78af5e23cb 100644 --- a/src/lib/Libifl/pbsD_stagein.c +++ b/src/lib/Libifl/pbsD_stagein.c @@ -108,7 +108,7 @@ int pbs_stagein( return (PBSE_IVALREQ); if (location == (char *)0) - location = ""; + location = (char *)""; pthread_mutex_lock(connection[c].ch_mutex); diff --git a/src/lib/Libifl/pbsD_statsrv.c b/src/lib/Libifl/pbsD_statsrv.c index f2704667dc..312669e52d 100644 --- a/src/lib/Libifl/pbsD_statsrv.c +++ b/src/lib/Libifl/pbsD_statsrv.c @@ -93,7 +93,7 @@ struct batch_status *pbs_statserver_err( int *local_errno) { - return(PBSD_status(c, PBS_BATCH_StatusSvr, local_errno, "", attrib, extend)); + return(PBSD_status(c, PBS_BATCH_StatusSvr, local_errno, (char *)"", attrib, extend)); } /* END pbs_statserver_err() */ @@ -109,7 +109,7 @@ struct batch_status *pbs_statserver( { pbs_errno = 0; - return(PBSD_status(c, PBS_BATCH_StatusSvr, &pbs_errno, "", attrib, extend)); + return(PBSD_status(c, PBS_BATCH_StatusSvr, &pbs_errno, (char *)"", attrib, extend)); } /* END pbs_statserver() */ diff --git a/src/lib/Libifl/pbsD_submit.c b/src/lib/Libifl/pbsD_submit.c index 0c7a4d1950..e096aa815a 100644 --- a/src/lib/Libifl/pbsD_submit.c +++ b/src/lib/Libifl/pbsD_submit.c @@ -120,7 +120,7 @@ char *pbs_submit_err( /* Queue job with null string for job id */ - return_jobid = PBSD_queuejob(c, local_errno, "", destination, attrib, extend); + return_jobid = PBSD_queuejob(c, local_errno, (char *)"", destination, attrib, extend); if (return_jobid == NULL) { diff --git a/src/lib/Libifl/pbsD_submit_hash.c b/src/lib/Libifl/pbsD_submit_hash.c index a7f319043b..4c420f0a65 100644 --- a/src/lib/Libifl/pbsD_submit_hash.c +++ b/src/lib/Libifl/pbsD_submit_hash.c @@ -130,7 +130,7 @@ int pbs_submit_hash( /* Queue job with null string for job id */ - rc = PBSD_QueueJob_hash(socket, "", destination, mm, job_attr, res_attr, extend, return_jobid, msg); + rc = PBSD_QueueJob_hash(socket, (char *)"", destination, mm, job_attr, res_attr, extend, return_jobid, msg); if (rc != PBSE_NONE) { diff --git a/src/lib/Libifl/rpp.c b/src/lib/Libifl/rpp.c deleted file mode 100644 index 6093c9179e..0000000000 --- a/src/lib/Libifl/rpp.c +++ /dev/null @@ -1,4260 +0,0 @@ -/* -* OpenPBS (Portable Batch System) v2.3 Software License -* -* Copyright (c) 1999-2000 Veridian Information Solutions, Inc. -* All rights reserved. -* -* --------------------------------------------------------------------------- -* For a license to use or redistribute the OpenPBS software under conditions -* other than those described below, or to purchase support for this software, -* please contact Veridian Systems, PBS Products Department ("Licensor") at: -* -* www.OpenPBS.org +1 650 967-4675 sales@OpenPBS.org -* 877 902-4PBS (US toll-free) -* --------------------------------------------------------------------------- -* -* This license covers use of the OpenPBS v2.3 software (the "Software") at -* your site or location, and, for certain users, redistribution of the -* Software to other sites and locations. Use and redistribution of -* OpenPBS v2.3 in source and binary forms, with or without modification, -* are permitted provided that all of the following conditions are met. -* After December 31, 2001, only conditions 3-6 must be met: -* -* 1. Commercial and/or non-commercial use of the Software is permitted -* provided a current software registration is on file at www.OpenPBS.org. -* If use of this software contributes to a publication, product, or -* service, proper attribution must be given; see www.OpenPBS.org/credit.html -* -* 2. Redistribution in any form is only permitted for non-commercial, -* non-profit purposes. There can be no charge for the Software or any -* software incorporating the Software. Further, there can be no -* expectation of revenue generated as a consequence of redistributing -* the Software. -* -* 3. Any Redistribution of source code must retain the above copyright notice -* and the acknowledgment contained in paragraph 6, this list of conditions -* and the disclaimer contained in paragraph 7. -* -* 4. Any Redistribution in binary form must reproduce the above copyright -* notice and the acknowledgment contained in paragraph 6, this list of -* conditions and the disclaimer contained in paragraph 7 in the -* documentation and/or other materials provided with the distribution. -* -* 5. Redistributions in any form must be accompanied by information on how to -* obtain complete source code for the OpenPBS software and any -* modifications and/or additions to the OpenPBS software. The source code -* must either be included in the distribution or be available for no more -* than the cost of distribution plus a nominal fee, and all modifications -* and additions to the Software must be freely redistributable by any party -* (including Licensor) without restriction. -* -* 6. All advertising materials mentioning features or use of the Software must -* display the following acknowledgment: -* -* "This product includes software developed by NASA Ames Research Center, -* Lawrence Livermore National Laboratory, and Veridian Information -* Solutions, Inc. -* Visit www.OpenPBS.org for OpenPBS software support, -* products, and information." -* -* 7. DISCLAIMER OF WARRANTY -* -* THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. ANY EXPRESS -* OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES -* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT -* ARE EXPRESSLY DISCLAIMED. -* -* IN NO EVENT SHALL VERIDIAN CORPORATION, ITS AFFILIATED COMPANIES, OR THE -* U.S. GOVERNMENT OR ANY OF ITS AGENCIES BE LIABLE FOR ANY DIRECT OR INDIRECT, -* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, -* OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, -* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -* -* This license will be governed by the laws of the Commonwealth of Virginia, -* without reference to its choice of law rules. -*/ -/* -** Routines to communicate with UDP packets - Reliable Packet Protocol. -** -** This package provides for sending information in "messages" -** which are complete blocks of data which will either arrive -** complete or not at all. -*/ - -#if !defined(_BSD) && defined(_AIX) /* this is needed by AIX */ -#define _BSD 1 -#endif - -#include /* the master config generated by configure */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#if defined(NTOHL_NEEDS_ARPA_INET_H) && defined(HAVE_ARPA_INET_H) -#include -#endif - -#include "rpp.h" -#include "log.h" -#include "../Liblog/pbs_log.h" - -#if !defined(H_ERRNO_DECLARED) && !defined(_AIX) -extern int h_errno; -#endif - -/* -** Boolean Constants -*/ -#ifndef FALSE -#define FALSE 0 -#endif -#ifndef TRUE -#define TRUE 1 -#endif - -/* -** Turn on for debug log dump to /tmp. -#define RPPLOG 1 -*/ - -/* -** Size-Constants for the various parts of RPP packet -*/ -#define RPP_PKT_SIZE 4*1024 /* max packet length, including header */ -#define RPP_PKT_HEAD 26 /* Size of packet header, includes CRC */ -#define RPP_HDR_SID 2 /* position of stream id in packet header */ -#define RPP_HDR_SEQ 10 /* position of "sequence" in pkt header */ -#define RPP_CRC_LEN 8 /* Length of CRC field in pkt header */ - -#define RPP_PKT_CRC (RPP_PKT_HEAD - RPP_CRC_LEN) -#define RPP_PKT_DATA (RPP_PKT_SIZE - RPP_PKT_HEAD) - - -/* -** RPP packet-header fields -** -** length field -** ======== ========= -** 2 type -** 8 stream id -** 8 sequence -** 8 crc -*/ - - -/* -** Integer codes for all the valid RPP message types -*/ -#define RPP_ACK 1 -#define RPP_DATA 2 -#define RPP_EOD 3 -#define RPP_HELLO1 4 -#define RPP_HELLO2 5 -#define RPP_GOODBYE 6 - - -/* -** Integer codes for all the valid RPP state values -*/ -#define RPP_DEAD -1 /* only set during clear_stream() */ -#define RPP_FREE 0 -#define RPP_OPEN_PEND 1 -#define RPP_OPEN_WAIT 2 -#define RPP_CONNECT 3 -#define RPP_CLOSE_PEND 4 -#define RPP_LAST_ACK 5 -#define RPP_CLOSE_WAIT1 6 -#define RPP_CLOSE_WAIT2 7 -#define RPP_STALE 99 /* set when a packet has been sent more than RPP_RETRY times */ - -/* -** Time in seconds; packet on the master send queue is not sent more -** often than every RPP_TIMEOUT seconds. -*/ -#define DEFAULT_RPP_TIMEOUT 4 -/* -** Default number of sendto attempts on a *packet. -*/ -#define DEFAULT_RPP_RETRY 48 -/* -** Max allowed number of outstanding pkts -*/ -#define RPP_HIGHWATER 60 - -int RPPTimeOut = DEFAULT_RPP_TIMEOUT; -int RPPRetry = DEFAULT_RPP_RETRY; - -char *server_alias = NULL; -long rpp_throttle_sleeptime = 0; - -/* external prototypes */ - -void rpp_shutdown_on_exit(int, void *); - -/* END external prototypes */ -pthread_mutex_t *stream_mutexes = NULL; - - - - -/* -** Several kinds of linked lists hang from each RPP stream structure. -** In particular, each stream structure has a list of send_packet -** structures. These structures record information that's necessary for -** managing a piece of data that's being sent to the other end of the -** connection. Besides having a pointer that links it to the next -** send_packet on the stream, a send_packet posseses a pair of pointers -** (up,down) which link the send_packet to the master send list when -** connection sequencing has reached the point where it is now proper to -** attach it to the list (stream is fully opened). Once on the master -** sendlist, any invocation of the rpp_send_out routine will attempt to -** transfer the send_packet's data buffer to the other end of the stream -** connection if all of the following hold: -** -** 1) packet hasn't reached its maximum-transfer-attempt limit -** 2) RPP_TIMEOUT or more seconds have elapsed since the last attempt -** 3) the transfer has yet to be ACK'd by the other side. -** 4) less than RPP_HIGHWATER number of non-duplicate packets are -** un-ACK'd -** -** Those "send_packets" that deal with stream control -** (RPP_ACK, RPP_HELLO1, RPP_HELLO2, RPP_GOODBYE) have no -** associated data, the send_packet's data buffer is comprised -** of only the header. -*/ - -struct send_packet - { - u_char *data; /* points to a buffer to be transferred */ - - u_short type; /* RPP_ACK, RPP_HELLO1, RPP_DATA, etc */ - - u_short sent_out; /* number of times sent; <= sp->retry */ - - int len; /* size *data not counting the header */ - - int index; /* other end's stream id */ - - int sequence; /* sequential value that is placed into */ - /* data buffer's header and is returned */ - /* in the RPP_ACK; identifies the data */ - /* that was transferred and now needs */ - /* to be removed from master send list */ - time_t time_sent; /* time packet was last sent; zero if */ - /* it has yet to be sent */ - - struct send_packet *next; /* next packet on stream's send list */ - - struct send_packet *up; /* used when the send_packet is */ - /* on RPP's master send list */ - /* pointer to preceeding packet */ - - struct send_packet *down; /* similar to up, but pointing to */ - /* packet following this one */ - }; - -/* -** Hanging from an stream structure is a linked list of recv_packets -** Each recv_packet records the information necessary for managing a -** piece of data that was received from the other end of a connection. -** With the exception of RPP_GOODBYE (a surrogate RPP_EOD), pkts that deal -** with stream control (RPP_ACK,RPP_HELLO1,RPP_HELLO2,) don't ever make it -** to the stream's receive list, they are handled directly as they come -** in. So, the only types of packets on a stream's receive list should -** be ones of type RPP_DATA, RPP_EOD, and RPP_GOODBYE. -*/ - -struct recv_packet - { - u_char *data; /* pointer to byte string that was sent from */ - /* the other end of the stream */ - - u_short type; /* RPP_DATA, RPP_EOD or RPP_GOODBYE; i.e. a */ - /* piece of the message or the end of the */ - /* message (RPP_EOD or RPP_GOODBYE) */ - - int len; /* size in bytes of the received string; */ - /* does not include the length of the header */ - - int sequence; /* decoded sequential number; it describes */ - /* the buffer's sequential output order */ - /* relative to the other buffers */ - - struct recv_packet *next; /* pointer to next recv_packet in */ - /* the linked receive list for */ - /* this stream */ - }; - - -/* -** Each stream structure has a linked list of pend structs hanging -** from it. This list of structs is used to manage a set of data buffers -** that may or may not all get 'packetized' and sent over to the other -** end of the connection. Subsequent to the creation of the list of data -** buffers, the creating program decides to either commit or not commit -** the sending of this data to the other side-- done by calling the -** interface function, rpp_wcommit. The interface function -** rpp_write doesn't send the data, it merely -** attaches the data buffer to a pending struct and links this struct to -** the stream's list of pending structs. No transfer to the other end -** gets set in motion by calling rpp_write. -** -** Doing an rpp_wcommit, on the other hand, entails adjoining a header -** to each pending struct's data buffer, attaching the buffer to a -** new send_packet struct, linking the send_packet to the master send -** list, freeing the pend struct, and doing an update of the stream's -** pend_commit variable -- a running sum of the number of bytes sent -** to the other side. -** -** Decommiting data that was written for transfer to the other end entails -** removing and freeing the pending structs and their associated data -** buffer from the stream's pend list and, updating the stream's -** pend_attempt varable back to the byte count that is stored in its -** pend_commit variable. Refer to relevant fields in struct stream. -*/ - -struct pending - { - u_char *data; /* pointer to a buffer of user data */ - - struct pending *next; /* pointer to the next pending struct */ - }; - - -/* -** Every stream that comes into existence during the life of the -** process gets realized on each end of the connection by a stream -** struct. All the stream structs generated by a process are in a -** dynamic array in the process' heap area. -** Each stream is a finite state machine. -*/ - -struct stream - { - int state; /* state of this end of the */ - /* connection; RPP_OPEN, etc */ - - struct sockaddr_in addr; /* address of the other end; */ - /* port/family/IPadrs */ - - struct in_addr *addr_array; /* array of alternate network */ - /* addresses for other end */ - /* of the connection */ - - int fd; /* must be in rpp_fd_array */ - - int stream_id; /* id of other end of the */ - /* connection; array position */ - /* of stream struct on the */ - /* other end */ - - int retry; /* sendto retry limit */ - - int open_key; /* unique bit pattern created */ - /* by the end issuing the */ - /* rpp_open. It's the same */ - /* same for each end of the */ - /* connecton; used in setting */ - /* up the stream connection */ - - int msg_cnt; /* size in bytes of current */ - /* DATA/EOD/GOODBYE message */ - - int send_sequence; /* initialized to value of 1 */ - /* and incremented by 1 for */ - /* each packet that's added */ - /* to the master send list */ - - struct pending *pend_head; /* head and tail pointers for */ - - struct pending *pend_tail; /* stream's pend list; see */ - /* struct pend definition */ - - int pend_commit; /* total number of data bytes */ - /* sent to other end connect */ - int pend_attempt; /* total number bytes that */ - /* reside in the list of */ - /* pending struct buffers. */ - /* pend_commit<=pend_attempt */ - - struct send_packet *send_head; /* head and tail pointers for */ - - struct send_packet *send_tail; /* stream's master send list */ - /* see struct send_packet */ - - int recv_sequence; /* monotonic,increasing, by 1 */ - /* starts from zero; A packet */ - /* on the stream's recv list */ - /* having a sequence number */ - /* less than this value is a */ - /* packet of an earlier mesg */ - - struct recv_packet *recv_head; /* head and tail pointers for */ - - struct recv_packet *recv_tail; /* the stream's recv list; */ - /* see struct recv_packet */ - - int recv_commit; /* number of bytes from */ - /* start of current message */ - /* that have been accepted */ - /* by the reader on this end */ - - int recv_attempt; /* number bytes, from start */ - /* of current message, that */ - /* have been read */ - - int being_attended; /* if a thread has been queued to handle this stream */ - }; - -/* -** Static Variables -*/ - -static struct stream *stream_array = NULL; /* pointer to stream struct */ -/* dynamic array */ - -static int stream_num = 0; /* current number of stream */ -/* structs in stream_array */ - -static int pkts_sent = 0; /* range: 0 - RPP_HIGHWATER; */ -/* incremented with each new */ -/* pkt sent; retransmissions */ -/* are not counted */ - -static int open_key = 0; /* monotonicly increasing */ -/* value stored in stream */ -/* struct on rpp_open and */ -/* passed to other end to */ -/* be recorded in */ -/* corresponding stream */ -/* struct there */ - -static struct send_packet *top = NULL; /* ptrs to beginning and end */ - -static struct send_packet *bottom = NULL; /* of master send list; */ - -pthread_mutex_t *master_list_mutex = NULL; - -/* All sent date is linked */ -/* between top and bottom. */ - -/* -** Global Variables -*/ -int rpp_dbprt = 0; /* controls debug printing */ - -/* -** Current file descriptor. Any call to rpp_open will use this -** for the returned stream. -*/ -int rpp_fd = -1; - -/* -** A dynamic array of socket descriptors bound to a network address. -** More than one call to rpp_bind can result in this having multiple -** entries. The value of rpp_fd will be contained in this array. -*/ -int *rpp_fd_array = NULL; -/*pthread_mutex_t *rpp_fd_mutex = NULL;*/ - -/* -** Number of elements in rpp_fd_array -*/ -int rpp_fd_num = 0; - - -/* -** Tables used by the macros I2TOH, HTOI2, I8TOH, HTOI8 -** to convert 2 and 8 digit hexidecimal strings to integer and back. -*/ -char cval[] = - { - -1, -1, -1, -1, -1, -1, -1, -1, /* nul .. bel */ - -1, -1, -1, -1, -1, -1, -1, -1, /* bs .. si */ - -1, -1, -1, -1, -1, -1, -1, -1, /* dle .. etb */ - -1, -1, -1, -1, -1, -1, -1, -1, /* can .. us */ - -1, -1, -1, -1, -1, -1, -1, -1, /* sp .. ' */ - -1, -1, -1, -1, -1, -1, -1, -1, /* ( .. / */ - 0, 1, 2, 3, 4, 5, 6, 7, /* 0 .. 7 */ - 8, 9, -1, -1, -1, -1, -1, -1, /* 8 .. ? */ - -1, 10, 11, 12, 13, 14, 15, -1, /* @ .. G */ - -1, -1, -1, -1, -1, -1, -1, -1, /* H .. O */ - -1, -1, -1, -1, -1, -1, -1, -1, /* P .. W */ - -1, -1, -1, -1, -1, -1, -1, -1, /* X .. _ */ - -1, 10, 11, 12, 13, 14, 15, -1, /* ` .. g */ - -1, -1, -1, -1, -1, -1, -1, -1, /* h .. o */ - -1, -1, -1, -1, -1, -1, -1, -1, /* p .. w */ - -1, -1, -1, -1, -1, -1, -1, -1 /* x .. del */ - }; - -char ival[] = - { - '0', '1', '2', '3', '4', '5', '6', '7', - '8', '9', 'A', 'B', 'C', 'D', 'E', 'F' - }; - -/* -** Conversion macros -*/ - -#define I2TOH(i, h) \ - { \ - int num = i; \ - char *str = h; \ - str[1] = ival[num & 0xF]; num >>= 4 ; \ - str[0] = ival[num & 0xF]; \ - } - -#define I8TOH(i, h) \ - { \ - u_long num = i; \ - char *str = h; \ - str[7] = ival[num & 0xF]; num >>= 4; \ - str[6] = ival[num & 0xF]; num >>= 4; \ - str[5] = ival[num & 0xF]; num >>= 4; \ - str[4] = ival[num & 0xF]; num >>= 4; \ - str[3] = ival[num & 0xF]; num >>= 4; \ - str[2] = ival[num & 0xF]; num >>= 4; \ - str[1] = ival[num & 0xF]; num >>= 4; \ - str[0] = ival[num & 0xF]; \ - } - -#define HTOI2(h, i) \ - { \ - char *str = h; \ - int num = 0; \ - num = cval[str[0] & 0xFF]; num <<= 4; \ - num |= cval[str[1] & 0xFF]; \ - i = num; \ - } - -#define HTOI8(h, i) \ - { \ - char *str = h; \ - u_long num; \ - num = (long)cval[str[0] & 0x7F]; num <<= 4; \ - num |= (long)cval[str[1] & 0x7F]; num <<= 4; \ - num |= (long)cval[str[2] & 0x7F]; num <<= 4; \ - num |= (long)cval[str[3] & 0x7F]; num <<= 4; \ - num |= (long)cval[str[4] & 0x7F]; num <<= 4; \ - num |= (long)cval[str[5] & 0x7F]; num <<= 4; \ - num |= (long)cval[str[6] & 0x7F]; num <<= 4; \ - num |= (long)cval[str[7] & 0x7F]; \ - i = num; \ - } - - -/* -** Different print macros for use in debugging. -*/ - -#ifdef DEBUG - -#define DBTO stdout -#define LOCAL_DBPRT(x) \ - if (rpp_dbprt) { \ - int err = errno; \ - fprintf(DBTO, "%lX: ", time(0)); \ - fprintf x; \ - errno = err; \ - } -#define DOID(x) static char id[] = x; - -#elif defined(RPPLOG) - -static char *blog_buf = NULL; -static int blog_buflen = 0; - -static int blog_head = 0; - -void -blog_init(char *s, int len) - { - if (blog_buf != NULL || len <= 0) - return; - - if (s == NULL) - blog_buf = (char *)malloc(len); - else - blog_buf = s; - - blog_buflen = len; - } - -int -blog_write(char *s) - { - int i, len; - - if (s == NULL || *s == '\0') - return 0; - - if (blog_buf == NULL) - blog_init(NULL, 64*1024); - - len = strlen(s) + 1; - - if (len > blog_buflen) - return -1; - - for (i = 0; i < len; i++) - { - blog_buf[blog_head++] = *s++; - blog_head %= blog_buflen; - } - - return len -1; - } - -void -blog_out(char *filename) - { - FILE *f; - int btrail; - int c; - - if (blog_buf == NULL) - return; - - if ((f = fopen(filename, "a")) == NULL) - return; - - for (btrail = blog_head; blog_buf[btrail] != '\0'; btrail++) - btrail %= blog_buflen; - - for (btrail++; btrail != blog_head; btrail++) - { - btrail %= blog_buflen; - - c = (int)blog_buf[btrail]; - - if (c == '\0') - continue; - - putc(c, f); - } - - fclose(f); - - return; - } - -static char logbuf[4096], *logp; - -#define DBTO logp - -#define LOCAL_DBPRT(x) \ - sprintf(logbuf, "%lX: ", time(0)); \ - logp = logbuf + strlen(logbuf); \ - sprintf x; \ - blog_write(logbuf); \ - if (rpp_dbprt) { \ - int err = errno; \ - sprintf(logbuf, "/tmp/rpp_log.%d", getpid()); \ - blog_out(logbuf); \ - rpp_dbprt = 0; \ - errno = err; \ - } -#define DOID(x) static char id[] = x; - -#else -#define DBTO xxx -#define LOCAL_DBPRT(x) -#define DOID(x) -#endif - - -#ifndef MIN -#define MIN(x, y) (((x) < (y)) ? (x) : (y)) -#endif -#ifndef MAX -#define MAX(x, y) (((x) > (y)) ? (x) : (y)) -#endif - - -/* -** BEGIN included source -*/ -/*- - * Copyright (c) 1991, 1993 - * The Regents of the University of California. All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * James W. Williams of NASA Goddard Space Flight Center. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgment: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -static u_long crctab[] = - { - 0x0, - 0x04c11db7, 0x09823b6e, 0x0d4326d9, 0x130476dc, 0x17c56b6b, - 0x1a864db2, 0x1e475005, 0x2608edb8, 0x22c9f00f, 0x2f8ad6d6, - 0x2b4bcb61, 0x350c9b64, 0x31cd86d3, 0x3c8ea00a, 0x384fbdbd, - 0x4c11db70, 0x48d0c6c7, 0x4593e01e, 0x4152fda9, 0x5f15adac, - 0x5bd4b01b, 0x569796c2, 0x52568b75, 0x6a1936c8, 0x6ed82b7f, - 0x639b0da6, 0x675a1011, 0x791d4014, 0x7ddc5da3, 0x709f7b7a, - 0x745e66cd, 0x9823b6e0, 0x9ce2ab57, 0x91a18d8e, 0x95609039, - 0x8b27c03c, 0x8fe6dd8b, 0x82a5fb52, 0x8664e6e5, 0xbe2b5b58, - 0xbaea46ef, 0xb7a96036, 0xb3687d81, 0xad2f2d84, 0xa9ee3033, - 0xa4ad16ea, 0xa06c0b5d, 0xd4326d90, 0xd0f37027, 0xddb056fe, - 0xd9714b49, 0xc7361b4c, 0xc3f706fb, 0xceb42022, 0xca753d95, - 0xf23a8028, 0xf6fb9d9f, 0xfbb8bb46, 0xff79a6f1, 0xe13ef6f4, - 0xe5ffeb43, 0xe8bccd9a, 0xec7dd02d, 0x34867077, 0x30476dc0, - 0x3d044b19, 0x39c556ae, 0x278206ab, 0x23431b1c, 0x2e003dc5, - 0x2ac12072, 0x128e9dcf, 0x164f8078, 0x1b0ca6a1, 0x1fcdbb16, - 0x018aeb13, 0x054bf6a4, 0x0808d07d, 0x0cc9cdca, 0x7897ab07, - 0x7c56b6b0, 0x71159069, 0x75d48dde, 0x6b93dddb, 0x6f52c06c, - 0x6211e6b5, 0x66d0fb02, 0x5e9f46bf, 0x5a5e5b08, 0x571d7dd1, - 0x53dc6066, 0x4d9b3063, 0x495a2dd4, 0x44190b0d, 0x40d816ba, - 0xaca5c697, 0xa864db20, 0xa527fdf9, 0xa1e6e04e, 0xbfa1b04b, - 0xbb60adfc, 0xb6238b25, 0xb2e29692, 0x8aad2b2f, 0x8e6c3698, - 0x832f1041, 0x87ee0df6, 0x99a95df3, 0x9d684044, 0x902b669d, - 0x94ea7b2a, 0xe0b41de7, 0xe4750050, 0xe9362689, 0xedf73b3e, - 0xf3b06b3b, 0xf771768c, 0xfa325055, 0xfef34de2, 0xc6bcf05f, - 0xc27dede8, 0xcf3ecb31, 0xcbffd686, 0xd5b88683, 0xd1799b34, - 0xdc3abded, 0xd8fba05a, 0x690ce0ee, 0x6dcdfd59, 0x608edb80, - 0x644fc637, 0x7a089632, 0x7ec98b85, 0x738aad5c, 0x774bb0eb, - 0x4f040d56, 0x4bc510e1, 0x46863638, 0x42472b8f, 0x5c007b8a, - 0x58c1663d, 0x558240e4, 0x51435d53, 0x251d3b9e, 0x21dc2629, - 0x2c9f00f0, 0x285e1d47, 0x36194d42, 0x32d850f5, 0x3f9b762c, - 0x3b5a6b9b, 0x0315d626, 0x07d4cb91, 0x0a97ed48, 0x0e56f0ff, - 0x1011a0fa, 0x14d0bd4d, 0x19939b94, 0x1d528623, 0xf12f560e, - 0xf5ee4bb9, 0xf8ad6d60, 0xfc6c70d7, 0xe22b20d2, 0xe6ea3d65, - 0xeba91bbc, 0xef68060b, 0xd727bbb6, 0xd3e6a601, 0xdea580d8, - 0xda649d6f, 0xc423cd6a, 0xc0e2d0dd, 0xcda1f604, 0xc960ebb3, - 0xbd3e8d7e, 0xb9ff90c9, 0xb4bcb610, 0xb07daba7, 0xae3afba2, - 0xaafbe615, 0xa7b8c0cc, 0xa379dd7b, 0x9b3660c6, 0x9ff77d71, - 0x92b45ba8, 0x9675461f, 0x8832161a, 0x8cf30bad, 0x81b02d74, - 0x857130c3, 0x5d8a9099, 0x594b8d2e, 0x5408abf7, 0x50c9b640, - 0x4e8ee645, 0x4a4ffbf2, 0x470cdd2b, 0x43cdc09c, 0x7b827d21, - 0x7f436096, 0x7200464f, 0x76c15bf8, 0x68860bfd, 0x6c47164a, - 0x61043093, 0x65c52d24, 0x119b4be9, 0x155a565e, 0x18197087, - 0x1cd86d30, 0x029f3d35, 0x065e2082, 0x0b1d065b, 0x0fdc1bec, - 0x3793a651, 0x3352bbe6, 0x3e119d3f, 0x3ad08088, 0x2497d08d, - 0x2056cd3a, 0x2d15ebe3, 0x29d4f654, 0xc5a92679, 0xc1683bce, - 0xcc2b1d17, 0xc8ea00a0, 0xd6ad50a5, 0xd26c4d12, 0xdf2f6bcb, - 0xdbee767c, 0xe3a1cbc1, 0xe760d676, 0xea23f0af, 0xeee2ed18, - 0xf0a5bd1d, 0xf464a0aa, 0xf9278673, 0xfde69bc4, 0x89b8fd09, - 0x8d79e0be, 0x803ac667, 0x84fbdbd0, 0x9abc8bd5, 0x9e7d9662, - 0x933eb0bb, 0x97ffad0c, 0xafb010b1, 0xab710d06, 0xa6322bdf, - 0xa2f33668, 0xbcb4666d, 0xb8757bda, 0xb5365d03, 0xb1f740b4 - }; - - - - -/* - * Compute a POSIX 1003.2 checksum. This routine has been broken out so that - * other programs can use it. It takes a char pointer and length. - * It ruturns the crc value for the data in buf. - */ - -u_long crc(buf, clen) -u_char *buf; -u_long clen; - { - register u_char *p; - register u_long crc, len; - -#define COMPUTE(var, ch) (var) = (((var) << 8) ^ \ - crctab[(((var) >> 24) & 0xff) ^ (ch)]) & 0xffffffff - - for (crc = 0, len = clen, p = buf; len--; ++p) - { - COMPUTE(crc, *p); - } - - /* Include the length of the file. */ - for (; clen != 0; clen >>= 8) - { - COMPUTE(crc, clen & 0xff); - } - - return (~crc & 0xffffffff); - } - -/* -** END of included source -*/ - -/* -** Generate a sequence number for a packet. -*/ -static int -next_seq(int *seq) - { - (*seq)++; - - if (*seq < 0) /* had a rollover */ - { - errno = EFBIG; - return -1; - } - - return 0; - } - -/* -** Put a human readable representation of a network addres passed -** in as a long and return a staticly allocated string. -*/ -char * netaddr_long(long ap, char *out) - { - u_long ipadd; - - ipadd = ap; - - sprintf(out, "%ld.%ld.%ld.%ld", - (ipadd & 0xff000000) >> 24, - (ipadd & 0x00ff0000) >> 16, - (ipadd & 0x0000ff00) >> 8, - (ipadd & 0x000000ff)); - - return out; - } - -/* -** Put a human readable representation of a network addres into -** a staticly allocated string. -*/ -char * netaddr(struct sockaddr_in *ap) - { - static char out[80]; - char tmp[80]; - - if (ap == NULL) - return "unknown"; - - netaddr_long( ntohl(ap->sin_addr.s_addr), tmp); - - sprintf(out, "%s:%d", tmp, ntohs(ap->sin_port)); - - return out; - } - - - -/* -** set_rpp_throttle_sleep_time sets the throttle sleep time -** for rpp. This is an option set in the MOM config file. -** By default the value of rpp_throttle_sleeptime is 0 -** which means false. Other wise the value is in micro seconds -** to be used with the usleep function -*/ -void set_rpp_throttle_sleep_time(long sleep_time) -{ - rpp_throttle_sleeptime = sleep_time; - return; -} - - -/* -** Create a packet of the given type, fill in the sequence and -** index number. If buf is NULL, malloc an area for just -** a header. If buf is not NULL, it should contain space -** for len+RPP_PKT_HEADER bytes. -*/ - -static void rpp_form_pkt( - - int index, - int type, - int seq, - u_char *buf, - int len) - - { - DOID("form_pkt") - - struct send_packet *pktp; - - struct stream *sp; - - LOCAL_DBPRT((DBTO, "%s: index %d type %d seq %d len %d\n", - id, index, type, seq, len)) - sp = &stream_array[index]; - pktp = (struct send_packet *)malloc(sizeof(struct send_packet)); - assert(pktp != NULL); - - pktp->type = type; - pktp->sequence = seq; - pktp->time_sent = 0; - pktp->sent_out = 0; - pktp->len = len; - pktp->index = index; - - if (buf) - pktp->data = (u_char *)realloc(buf, len + RPP_PKT_HEAD); - else - pktp->data = (u_char *)malloc(RPP_PKT_HEAD); - - assert(pktp->data != NULL); - - /* - ** Put on stream send list - */ - if (sp->send_head == NULL) - sp->send_head = pktp; - else - sp->send_tail->next = pktp; - - sp->send_tail = pktp; - - pktp->next = NULL; - - pktp->down = NULL; - - /* - ** if open has not completed yet, hold off putting on send queue - */ - if (sp->stream_id == -1) - { - pktp->up = NULL; - return; - } - - /* - ** if the stream is fully open, format and put on the send queue - */ - LOCAL_DBPRT((DBTO, "%s: idx %d link %d seq %d len %d to sendq\n", - id, index, type, seq, len)) - - I2TOH(type, (char *)&pktp->data[len]) - I8TOH(sp->stream_id, (char *)&pktp->data[len+RPP_HDR_SID]) - I8TOH(seq, (char *)&pktp->data[len+RPP_HDR_SEQ]) - I8TOH(crc(pktp->data, (u_long)(len + RPP_PKT_CRC)), - (char *)&pktp->data[len+RPP_PKT_CRC]) - - if (master_list_mutex == NULL) - { - master_list_mutex = malloc(sizeof(pthread_mutex_t)); - pthread_mutex_init(master_list_mutex,NULL); - } - - pthread_mutex_lock(master_list_mutex); - - if (bottom) - bottom->down = pktp; - - pktp->up = bottom; - - if (top == NULL) /* first one */ - top = pktp; - - bottom = pktp; - - pthread_mutex_unlock(master_list_mutex); - - return; - } - - - - -/* -** Check to make sure an incoming packet goes with one of the -** streams we have. -*/ - -static struct stream *rpp_check_pkt( - - int index, - struct sockaddr_in *addrp) - - { - DOID("check_pkt") - - struct stream *sp; - - struct in_addr *addrs; - int i; - - if ((index < 0) || (index >= stream_num)) - { - LOCAL_DBPRT((DBTO, "%s: BAD INDEX %d outside limit %d\n", - id, index, stream_num)) - - return(NULL); - } - - sp = &stream_array[index]; - - if (sp->state <= RPP_FREE) - { - LOCAL_DBPRT((DBTO, "%s: FREE STREAM\n", - id)) - - return(NULL); - } - - if ((addrp->sin_family == 0) || (addrp->sin_family >= AF_MAX)) - { - /* - * Some systems have a buggy recvfrom() that doesn't set - * sin_family for UDP sockets. This was directly observed - * on Sandia's Tru64 system -garrick - */ - - LOCAL_DBPRT((DBTO, "%s: buggy recvfrom(), fixing bogus sin_family value: %d\n", - id, - addrp->sin_family)); - - addrp->sin_family = sp->addr.sin_family; - } - - if (addrp->sin_port != sp->addr.sin_port) - goto bad; - - if (addrp->sin_family != sp->addr.sin_family) - goto bad; - - if (addrp->sin_addr.s_addr == sp->addr.sin_addr.s_addr) - { - return(sp); - } - - if ((addrs = sp->addr_array) != NULL) - { - for (i = 0;addrs[i].s_addr;i++) - { - if (addrs[i].s_addr == addrp->sin_addr.s_addr) - { - return(sp); - } - } - } - -bad: - - LOCAL_DBPRT((DBTO, "%s: ADDRESS MISMATCH\n", - id)) - - LOCAL_DBPRT((DBTO, "\tstream %d addr %s\n", - index, - netaddr(&sp->addr))) - - LOCAL_DBPRT((DBTO, "\tpkt addr %s\n", - netaddr(addrp))) - - return(NULL); - } /* END rpp_check_pkt() */ - - - - -/* -** Send outstanding information starting with top and working -** down to bottom. Will not cause state change. -*/ - -static void rpp_send_out(void) - - { - struct send_packet *pp; - - struct stream *sp; - time_t curr; - torque_socklen_t len; - - char *id = "rpp_send_out"; - - curr = time(NULL); - - if (master_list_mutex == NULL) - { - master_list_mutex = malloc(sizeof(pthread_mutex_t)); - pthread_mutex_init(master_list_mutex,NULL); - } - - pthread_mutex_lock(master_list_mutex); - - for (pp = top;pp != NULL;pp = pp->down) - { - if ((curr - pp->time_sent) < RPPTimeOut) - continue; - - if ((pp->time_sent == 0) && (pkts_sent >= RPP_HIGHWATER)) - break; - - sp = &stream_array[pp->index]; - - LOCAL_DBPRT((DBTO, "%s index %d type %d sent %d seq %d to %s crc %8.8s\n", - id, - pp->index, - pp->type, - pp->sent_out, - pp->sequence, - netaddr(&sp->addr), - (char *)&pp->data[pp->len+RPP_PKT_CRC])) - - len = sizeof(struct sockaddr_in); - - if (sendto( - sp->fd, - (char *)pp->data, - RPP_PKT_HEAD + pp->len, - 0, - (struct sockaddr *)&sp->addr, - len) == -1) - { - LOCAL_DBPRT((DBTO, "%s: SENDTO errno %d (%s)\n", - id, - errno, - strerror(errno))) - - log_err(errno,id,"Error in sendto\n"); - - pp->sent_out++; - - continue; - } - - /* has the rpp_throttle option been set? If it is - * not 0 it is set. */ - if(rpp_throttle_sleeptime > 0) - { - usleep(rpp_throttle_sleeptime); - } - - if (pp->time_sent == 0) /* new one */ - pkts_sent++; - - pp->time_sent = curr; - - pp->sent_out++; - } /* END for (pp) */ - - pthread_mutex_unlock(master_list_mutex); - - /* NOTE: failure cannot be detected */ - - return; - } /* END rpp_send_out */ - - - - -/* -** Create or reuse a position in stream_array. -*/ - -static int rpp_create_sp(void) - - { - int i; - - struct stream *sp = NULL; - - if (stream_array == NULL) - { - stream_array = (struct stream *)malloc(sizeof(struct stream)); - - if (stream_array == NULL) - { - return(-1); - } - - memset(stream_array, '\0', sizeof(struct stream)); - - stream_num = 1; - - /* create the mutex */ - stream_mutexes = (pthread_mutex_t *)malloc(sizeof(pthread_mutex_t)); - - if (stream_mutexes == NULL) - return(-1); - - pthread_mutex_init(stream_mutexes,NULL); - } - - for (i = 0;i < stream_num;i++) - { - sp = &stream_array[i]; - - if (sp->state == RPP_FREE) - break; - } - - if (i == stream_num) - { - for (i = 0;i < stream_num;i++) - { - sp = &stream_array[i]; - - if (sp->state == RPP_DEAD) - break; - } - } - - if (i == stream_num) - { - /* no free streams available */ - - sp = (struct stream *)realloc( - (void *)stream_array, - (stream_num * 2) * sizeof(struct stream)); - - if (sp == NULL) - { - sp = (struct stream *)realloc( - (void *)stream_array, - (stream_num + 1) * sizeof(struct stream)); - - if (sp == NULL) - { - return(-1); - } - - stream_num++; - - stream_mutexes = (pthread_mutex_t *)realloc( - stream_mutexes, - (stream_num) * sizeof(pthread_mutex_t)); - - if (stream_mutexes == NULL) - return(-1); - - pthread_mutex_init(stream_mutexes + stream_num - 1,NULL); - } - else - { - int j; - - stream_num *= 2; - - stream_mutexes = (pthread_mutex_t *)realloc( - stream_mutexes, - (stream_num) * sizeof(pthread_mutex_t)); - - if (stream_mutexes == NULL) - return(-1); - - for (j = stream_num / 2; j < stream_num; j++) - { - pthread_mutex_init(stream_mutexes + j,NULL); - } - } - - stream_array = sp; - - sp = &stream_array[i]; - - memset((void *)sp, '\0', (stream_num - i) * sizeof(struct stream)); - } - else - { - memset((void *)sp, '\0', sizeof(struct stream)); - } - - LOCAL_DBPRT((DBTO, "rpp_create_sp: new index %d\n", - i)) - - return(i); - } /* END rpp_create_sp() */ - - - - - -/* -** Look up the "canonical" name for the host by -** calling gethostbyaddr with an IP address. -*/ - -static struct hostent *rpp_get_cname( - - struct sockaddr_in *addr) - - { - DOID("get_cname") - - struct hostent *hp; - char *hname; - - if ((hp = gethostbyaddr( - (void *)&addr->sin_addr, - sizeof(struct in_addr), - addr->sin_family)) == NULL) - { - LOCAL_DBPRT((DBTO, "%s: addr not found, h_errno=%d errno=%d (%s)\n", - id, h_errno, errno, strerror(errno))) - - return(NULL); - } - - if ((hname = (char *)strdup(hp->h_name)) == NULL) - { - return(NULL); - } - - if ((hp = gethostbyname(hname)) == NULL) - { - LOCAL_DBPRT((DBTO, "%s: canonical name %s not found, h_errno=%d errno=%d (%s)\n", - id, hname, h_errno, errno, strerror(errno))) - } - - free(hname); - - /* SUCCESS */ - - return(hp); - } - - - - -/* -** Allocate a list of alternate address for a host and save -** them in the stream structure. -*/ - -static void rpp_alist( - - struct hostent *hp, - struct stream *sp) - - { - int i, j; - - for (i = 1;hp->h_addr_list[i];i++); - - if (i == 1) - { - return; - } - - sp->addr_array = (struct in_addr *)calloc(i, sizeof(struct in_addr)); - - if (sp->addr_array == NULL) - { - return; - } - - j = 0; - - for (i = 0;hp->h_addr_list[i];i++) - { - if (memcmp(&sp->addr.sin_addr, hp->h_addr_list[i], hp->h_length) == 0) - continue; - - memcpy(&sp->addr_array[j++], hp->h_addr_list[i], hp->h_length); - } - - sp->addr_array[j].s_addr = 0; - - return; - } - - - - - -static int rpp_send_ack( - - struct stream *sp, - int seq) - - { - DOID("send_ack") - - char buf[RPP_PKT_HEAD]; - u_long xcrc; - - if (sp->stream_id < 0) - { - /* can't send yet */ - - LOCAL_DBPRT((DBTO, "%s: STREAM NOT OPEN seq %d\n", - id, - seq)) - - return(0); - } - - I2TOH(RPP_ACK, buf) - - I8TOH(sp->stream_id, &buf[2]) - I8TOH(seq, &buf[10]) - - xcrc = crc((u_char *)buf, (u_long)RPP_PKT_CRC); - - I8TOH(xcrc, &buf[RPP_PKT_CRC]) - - LOCAL_DBPRT((DBTO, "%s: seq %d to %s crc %lX\n", - id, seq, netaddr(&sp->addr), xcrc)) - - if (sendto( - sp->fd, - buf, - RPP_PKT_HEAD, - 0, - (struct sockaddr *)&sp->addr, - sizeof(struct sockaddr_in)) == -1) - { - LOCAL_DBPRT((DBTO, "%s: ACK error %d (%s)\n", - id, - errno, strerror(errno))) - - if ((errno != EWOULDBLOCK) && (errno != ENOBUFS)) - { - return(-1); - } - } - - return(0); - } /* END rpp_send_ack() */ - - - - -/* -** Take a packet off the send queue and free it. -*/ - -static void dqueue( - - struct send_packet *pp) - - { - pthread_mutex_lock(master_list_mutex); - - if (pp->down == NULL) - bottom = pp->up; - else - pp->down->up = pp->up; - - if (pp->up == NULL) - top = pp->down; - else - pp->up->down = pp->down; - - if (--pkts_sent < 0) - pkts_sent = 0; - - free(pp->data); - - free(pp); - - pthread_mutex_unlock(master_list_mutex); - - return; - } /* END dqueue() */ - - - - - -/* -** Get rid of anything on the pend and send queue for a stream. -*/ - -static void clear_send( - - struct stream *sp) - - { - - struct pending *ppp, *pprev; - - struct send_packet *spp, *sprev; - - for (ppp = sp->pend_head;ppp;ppp = pprev) - { - pprev = ppp->next; - - free(ppp->data); - - free(ppp); - } - - sp->pend_head = NULL; - - sp->pend_tail = NULL; - sp->pend_commit = 0; - sp->pend_attempt = 0; - - for (spp = sp->send_head;spp;spp = sprev) - { - sprev = spp->next; - - if (sp->stream_id == -1) - { - /* not open yet */ - - struct send_packet *look; /* might not be */ - /* on send queue */ - - pthread_mutex_lock(master_list_mutex); - - for (look = top;look;look = look->down) - { - if (look == spp) - break; - } - - pthread_mutex_unlock(master_list_mutex); - - if (look == NULL) - { - free(spp->data); - free(spp); - - continue; - } - } - - dqueue(spp); - } - - sp->send_head = NULL; - - sp->send_tail = NULL; - - return; - } /* END clear_send() */ - - - - -/* -** Remove packets from receive, pending and send queues for -** a stream, free all the memory and zero the stream_array -** entry. -*/ - -static void clear_stream( - - struct stream *sp) - - { - - struct recv_packet *rpp, *rprev; - - LOCAL_DBPRT((DBTO, "CLEAR stream %ld\n", - ((long)sp - (long)stream_array) / sizeof(struct stream))) - - for (rpp = sp->recv_head;rpp;rpp = rprev) - { - rprev = rpp->next; - - if (rpp->data) - free(rpp->data); - - free(rpp); - } - - sp->recv_head = NULL; - - sp->recv_tail = NULL; - - clear_send(sp); - - if (sp->addr_array) - { - free(sp->addr_array); - - sp->addr_array = NULL; - } - - sp->state = RPP_DEAD; - - return; - } /* END clear_stream() */ - - - - - -/* -** Do a recvfrom() call to get a packet off of all file descriptors. -** Return the index of the stream the packet belonged to, -** -2 if it was no data, or -1 if there was an error. -** Return -3 if there was no data to read. -** MAY CAUSE STATE CHANGE! -*/ - -static int rpp_recv_pkt( - - int fd) /* I */ - - { - DOID("recv_pkt") - - torque_socklen_t flen; - - int len; - - struct sockaddr_in addr; - - struct hostent *hp; - int i, streamid; - - struct send_packet *spp, *sprev; - - struct recv_packet *rpp, *rprev; - - struct recv_packet *pkt; - - struct stream *sp; - char *data; - int type; - int sequence; - u_long pktcrc; - - data = malloc(RPP_PKT_SIZE); - - assert(data != NULL); - - flen = sizeof(struct sockaddr_in); - - /* - ** Loop so we can avoid failing on EINTR. Thanks to - ** Pete Wyckoff for finding this. - */ - - for (;;) - { - len = recvfrom( - fd, - data, - RPP_PKT_SIZE, - 0, - (struct sockaddr *) & addr, - &flen); - - if (len != -1) - break; - - if (errno == EINTR) - continue; - - free(data); - - if ((errno == EWOULDBLOCK) || (errno == EAGAIN) || (errno == ECONNREFUSED)) - { - errno = 0; - - return(-3); - } - - return(-1); - } /* END for (;;) */ - - LOCAL_DBPRT((DBTO, "%s: addr %s len %d\n", - id, - netaddr(&addr), - len)) - - if (len < RPP_PKT_HEAD) /* less than minimum size */ - goto err_out; - - HTOI8(&data[len-RPP_CRC_LEN], pktcrc) - - if (pktcrc != crc((u_char *)data, (u_long)(len - RPP_CRC_LEN))) - { - LOCAL_DBPRT((DBTO, "%s: packet crc %08lX failed\n", id, pktcrc)) - - goto err_out; - } - - HTOI2(&data[len-RPP_PKT_HEAD], type) - - HTOI8(&data[len-RPP_PKT_HEAD+RPP_HDR_SID], streamid) - HTOI8(&data[len-RPP_PKT_HEAD+RPP_HDR_SEQ], sequence) - - switch (type) - { - - case RPP_ACK: - - LOCAL_DBPRT((DBTO, "%s: ACK stream %d sequence %d crc %08lX\n", - id, streamid, sequence, pktcrc)) - - free(data); - - if ((sp = rpp_check_pkt(streamid, &addr)) == NULL) - { - return(-2); - } - - if (sp->state == RPP_OPEN_PEND) - { - if (sequence != sp->open_key) - { - LOCAL_DBPRT((DBTO, "%s: WILD ACK in RPP_OPEN_PEND %d\n", - id, streamid)) - - return(-2); - } - - spp = sp->send_head; - - assert(spp->type == RPP_HELLO2); - assert(spp->next == NULL); - - sp->state = RPP_CONNECT; - sp->send_head = NULL; - sp->send_tail = NULL; - - dqueue(spp); - - /* SUCCESS */ - - return(streamid); - } - else if (sp->stream_id == -1) - { - LOCAL_DBPRT((DBTO, "%s: ACK for closed stream %d\n", - id, - streamid)) - - return(-2); - } - - for (spp = sp->send_head, sprev = NULL;spp;sprev = spp, spp = spp->next) - { - if (spp->sequence == sequence) - break; - } - - if (spp != NULL) - { - LOCAL_DBPRT((DBTO, "%s: stream %d seq %d took %ld\n", - id, - streamid, - sequence, - (long)(time(NULL) - spp->time_sent))) - - if ((sp->state == RPP_CLOSE_WAIT1) && (spp->type == RPP_GOODBYE)) - sp->state = RPP_CLOSE_WAIT2; - - if (sprev == NULL) - sp->send_head = spp->next; - else - sprev->next = spp->next; - - if (sp->send_tail == spp) - sp->send_tail = sprev; - - dqueue(spp); - - if ((sp->state == RPP_LAST_ACK) && (sp->send_head == NULL)) - { - clear_stream(sp); - - return(-2); - } - } - - return(streamid); - - /*NOTREACHED*/ - - break; - - case RPP_GOODBYE: - - LOCAL_DBPRT((DBTO, "%s: GOODBYE stream %d sequence %d crc %08lX\n", - id, streamid, sequence, pktcrc)) - - free(data); - - if ((sp = rpp_check_pkt(streamid, &addr)) == NULL) - { - return(-2); - } - - if (rpp_send_ack(sp, sequence) == -1) - { - return(-1); - } - - switch (sp->state) - { - - case RPP_OPEN_PEND: - - case RPP_OPEN_WAIT: - - case RPP_CLOSE_PEND: - - case RPP_LAST_ACK: - - return(-2); - - /*NOTREACHED*/ - - break; - - case RPP_CLOSE_WAIT1: - - sp->state = RPP_LAST_ACK; - - return(-2); - - /*NOTREACHED*/ - - break; - - case RPP_CLOSE_WAIT2: - - clear_stream(sp); - - return(-2); - - /*NOTREACHED*/ - - break; - - default: - - /* NO-OP */ - - break; - } /* END switch (sp->state) */ - - sp->state = RPP_CLOSE_PEND; - - clear_send(sp); /* other side not reading now */ - - for (rpp = sp->recv_head, rprev = NULL;rpp != NULL;rprev = rpp, rpp = rpp->next) - { - if (rpp->sequence >= sequence) - break; - } - - if ((rpp == NULL) || (rpp->sequence > sequence)) - { - LOCAL_DBPRT((DBTO, "%s: GOOD seq %d\n", - id, - sequence)) - - pkt = (struct recv_packet *)malloc(sizeof(struct recv_packet)); - - assert(pkt != NULL); - - pkt->type = type; - - pkt->sequence = sequence; - pkt->len = 0; - pkt->data = NULL; - - if (rprev == NULL) - { - pkt->next = sp->recv_head; - - sp->recv_head = pkt; - } - else - { - pkt->next = rprev->next; - rprev->next = pkt; - } - - if (sp->recv_tail == rprev) - sp->recv_tail = pkt; - } - else - { - LOCAL_DBPRT((DBTO, "%s: DUPLICATE seq %d MAX seen %d\n", - id, - sequence, - rpp->sequence)) - } - - return(-2); - - /*NOTREACHED*/ - - break; - - case RPP_DATA: - - case RPP_EOD: - - LOCAL_DBPRT((DBTO, "%s: DATA stream %d sequence %d crc %08lX len %d\n", - id, - streamid, - sequence, - pktcrc, - len)) - - if ((sp = rpp_check_pkt(streamid, &addr)) == NULL) - goto err_out; - - if (rpp_send_ack(sp, sequence) == -1) - { - free(data); - - return(-1); - } - - switch (sp->state) - { - - case RPP_OPEN_WAIT: - - LOCAL_DBPRT((DBTO, "INPUT on unconnected stream %d\n", - streamid)) - - free(data); - - return(-2); - - case RPP_CLOSE_WAIT1: - - case RPP_CLOSE_WAIT2: - - case RPP_LAST_ACK: - - LOCAL_DBPRT((DBTO, "INPUT on closed stream %d\n", streamid)) - - free(data); - - return(-2); - - break; - - default: - - /* NO-OP */ - - break; - } - - if (sequence < sp->recv_sequence) - { - LOCAL_DBPRT((DBTO, "%s: OLD seq %d\n", - id, - sequence)) - - free(data); - - return(-2); - } - - for (rpp = sp->recv_head, rprev = NULL;rpp != NULL;rprev = rpp, rpp = rpp->next) - { - if (rpp->sequence >= sequence) - break; - } - - if ((rpp == NULL) || (rpp->sequence > sequence)) - { - LOCAL_DBPRT((DBTO, "%s: GOOD seq %d\n", - id, - sequence)) - - data = realloc(data, len); - - assert(data != NULL); - - pkt = (struct recv_packet *)malloc(sizeof(struct recv_packet)); - - assert(pkt != NULL); - - pkt->type = type; - - pkt->sequence = sequence; - - pkt->len = len - RPP_PKT_HEAD; - - pkt->data = (u_char *)data; - - if (rprev == NULL) - { - pkt->next = sp->recv_head; - sp->recv_head = pkt; - } - else - { - pkt->next = rprev->next; - rprev->next = pkt; - } - - if (sp->recv_tail == rprev) - sp->recv_tail = pkt; - - if (sp->state == RPP_OPEN_PEND) - return -2; - else - return streamid; - } - else - { - LOCAL_DBPRT((DBTO, "%s: DUPLICATE seq %d MAX seen %d\n", - id, sequence, rpp->sequence)) - free(data); - } - - break; - - case RPP_HELLO1: - /* - ** HELLO1 packets have the remote side's stream index - ** in the "streamid" field and open key in the sequence. - */ - LOCAL_DBPRT((DBTO, "%s: HELLO1 stream %d sequence %d\n", - id, streamid, sequence)) - free(data); - - for (i = 0; i < stream_num; i++) - { - sp = &stream_array[i]; - - if (sp->state <= RPP_FREE) - continue; - - if (memcmp(&sp->addr, &addr, sizeof(addr))) - continue; - - if (sp->open_key == sequence) - { - rpp_send_out(); - return -2; - } - - LOCAL_DBPRT((DBTO, "OLD STREAM state %d reopened %d %d\n", - - sp->state, sp->open_key, sequence)) - clear_stream(sp); /* old stream */ - } - - i = rpp_create_sp(); - - if (i == -1) - return -1; - - sp = &stream_array[i]; - - sp->state = RPP_OPEN_PEND; - - sp->fd = fd; - - sp->retry = RPPRetry; - - memcpy(&sp->addr, &addr, sizeof(addr)); - - if ((hp = rpp_get_cname(&addr)) != NULL) - rpp_alist(hp, sp); - - sp->stream_id = streamid; - - sp->open_key = sequence; - - open_key = MAX(open_key, sequence); - - rpp_form_pkt(i, RPP_HELLO2, i, NULL, 0); - - rpp_send_out(); - - break; - - case RPP_HELLO2: - /* - ** HELLO2 packet has this side's stream index in - ** "streamid" as usual and the remote side's - ** stream index overloaded in the "sequence" field. - */ - LOCAL_DBPRT((DBTO, "%s: HELLO2 stream %d sequence %d\n", - id, streamid, sequence)) - free(data); - - if ((sp = rpp_check_pkt(streamid, &addr)) == NULL) - return -2; - - switch (sp->state) - { - - case RPP_OPEN_WAIT: - sp->state = RPP_CONNECT; - break; - - case RPP_CLOSE_WAIT1: /* called close before open done */ - - case RPP_LAST_ACK: - break; - - default: - - if (sp->stream_id == sequence) - { - LOCAL_DBPRT((DBTO, - "%s: stream %d got DUP HELLO2 %d\n", - id, streamid, sp->state)) - - if (rpp_send_ack(sp, sp->open_key) == -1) - return -1; - } - else - { - LOCAL_DBPRT((DBTO, "%s: NON-DUP HELLO2\n", id)) - } - - return -2; - } - - sp->stream_id = sequence; - - if (rpp_send_ack(sp, sp->open_key) == -1) - return -1; - - if ((spp = sp->send_head) == NULL) - { - LOCAL_DBPRT((DBTO, - "%s: stream %d got HELLO2 but sendq NULL\n", - id, streamid)) - return -2; - } - - if (spp->type != RPP_HELLO1) - { - LOCAL_DBPRT((DBTO, - "%s: stream %d sendq %d rather than HELLO1\n", - id, streamid, spp->type)) - return -2; - } - - sp->send_head = spp->next; /* remove HELLO1 pkt */ - - if (sp->send_tail == spp) - sp->send_tail = NULL; - - dqueue(spp); - - /* - ** Put any waitting packets onto the send queue - */ - for (spp = sp->send_head; spp; spp = spp->next) - { - int len = spp->len; - - LOCAL_DBPRT((DBTO, "%s: idx %d link %d seq %d len %d to sendq\n", - id, streamid, spp->type, spp->sequence, len)) - I2TOH(spp->type, (char *)&spp->data[len]) - I8TOH(sp->stream_id, - (char *)&spp->data[len+RPP_HDR_SID]) - I8TOH(spp->sequence, - (char *)&spp->data[len+RPP_HDR_SEQ]) - I8TOH(crc(spp->data, (u_long)(len + RPP_PKT_CRC)), - (char *)&spp->data[len+RPP_PKT_CRC]) - - if (master_list_mutex == NULL) - { - master_list_mutex = malloc(sizeof(pthread_mutex_t)); - pthread_mutex_init(master_list_mutex,NULL); - } - - pthread_mutex_lock(master_list_mutex); - - if (bottom) - bottom->down = spp; - - spp->up = bottom; - - spp->down = NULL; - - if (top == NULL) /* first one */ - top = spp; - - bottom = spp; - - pthread_mutex_unlock(master_list_mutex); - } - - break; - - default: - - LOCAL_DBPRT((DBTO, "%s: UNKNOWN packet type %d stream %d sequence %d\n", - id, type, streamid, sequence)) - - free(data); - - break; - } /* END switch (type) */ - - return(-2); - -err_out: - - /* no data to read */ - - free(data); - - return(-2); - } /* END rpp_recv_pkt() */ - - - - - -/* -** Do recv calls until there is one that shows data. -*/ - -static int rpp_recv_all(void) - - { - int i, ret; - int rc = -3; - - LOCAL_DBPRT((DBTO, "entered rpp_recv_all\n")) - - for (i = 0;i < rpp_fd_num;i++) - { - ret = rpp_recv_pkt(rpp_fd_array[i]); - - rc = MAX(ret, rc); - - if (ret == -1) - { - /* failure detected */ - - break; - } - } /* END for (i) */ - - return(rc); - } /* rpp_recv_all() */ - - - - - -/* -** Check to see if any packet being sent out on a stream has -** been sent more than a reasonable number of times. -*/ - -static void rpp_stale( - - struct stream *sp) /* I (cleared on corruption) */ - - { - - struct send_packet *pp; - int counter; - - if ((sp->state <= RPP_FREE) || (sp->state == RPP_STALE)) - { - return; - } - - counter = 0; - - for (pp = sp->send_head;pp != NULL;pp = pp->next) - { - counter++; - - if (pp->sent_out >= sp->retry) - break; - - if (counter > 1024) - { - if (pp->next == pp) - { - LOCAL_DBPRT((DBTO, "RPP PACKET is corrupt - seq %d sent %d of %d - fixing linked list\n", - pp->sequence, - pp->sent_out, - sp->retry)) - - pp->next = NULL; - } - else - { - /* stream is corrupt - destroy it */ - - LOCAL_DBPRT((DBTO, "RPP PACKET is corrupt - seq %d sent %d of %d - destroying stream\n", - pp->sequence, - pp->sent_out, - sp->retry)) - - clear_stream(sp); - - return; - } - } - } /* END for (pp) */ - - if (pp != NULL) - { - LOCAL_DBPRT((DBTO, "STALE PACKET seq %d sent %d of %d\n", - pp->sequence, - pp->sent_out, - sp->retry)) - - switch (sp->state) - { - - case RPP_OPEN_PEND: - - case RPP_CLOSE_WAIT1: - - case RPP_CLOSE_WAIT2: - - case RPP_LAST_ACK: - - /* what do these states indicate? */ - - clear_stream(sp); - - break; - - default: - - sp->state = RPP_STALE; - - break; - } - } /* END if (pp != NULL) */ - - return; - } /* END rpp_stale() */ - - - - - -/* -** Form data packets for any pending data. If flag is true, -** create an EOD packet too. -*/ - -static int rpp_dopending( - - int index, /* I */ - int flag) /* I */ - - { - DOID("dopending") - - struct stream *sp; - - struct pending *pp; - - LOCAL_DBPRT((DBTO, "%s: entered index %d\n", - id, - index)) - - sp = &stream_array[index]; - - for (pp = sp->pend_head;pp != sp->pend_tail;pp = sp->pend_head) - { - rpp_form_pkt(index, RPP_DATA, sp->send_sequence, pp->data, RPP_PKT_DATA); - - sp->pend_head = pp->next; - - free(pp); - - sp->pend_attempt -= RPP_PKT_DATA; - - if (next_seq(&sp->send_sequence) == -1) - { - return(-1); - } - } - - if (flag) - { - rpp_form_pkt( - index, - RPP_EOD, - sp->send_sequence, - (pp != NULL) ? pp->data : NULL, - sp->pend_attempt); - - if (pp != NULL) - { - free(pp); - - sp->pend_head = NULL; - sp->pend_tail = NULL; - } - - sp->pend_attempt = 0; - - if (next_seq(&sp->send_sequence) == -1) - { - return(-1); - } - } - - sp->pend_commit = sp->pend_attempt; - - return(0); - } /* END rpp_dopending() */ - - - - - -/* -** Flush all data out of a stream -- do an end of message. -** Return 0 if it all went well, -1 on error. -*/ - -int rpp_flush( - - int index) - - { - DOID("flush") - - struct stream *sp; - - LOCAL_DBPRT((DBTO, "%s: entered index %d\n", - id, - index)) - - if ((index < 0) || (index >= stream_num)) - { - errno = EINVAL; - - return(-1); - } - - sp = &stream_array[index]; - - switch (sp->state) - { - - case RPP_CLOSE_PEND: - - errno = EPIPE; - - return(-1); - - /*NOTREACHED*/ - - break; - - case RPP_DEAD: - - case RPP_FREE: - - case RPP_OPEN_PEND: - - case RPP_CLOSE_WAIT1: - - case RPP_CLOSE_WAIT2: - - case RPP_LAST_ACK: - - errno = ENOTCONN; - - return(-1); - - /*NOTREACHED*/ - - break; - - default: - - /* NO-OP */ - - break; - } - - /* - ** if something is pending or we need to return a zero len EOM, - ** call rpp_dopending(). - */ - - if ((sp->pend_head != NULL) || (sp->send_head == NULL)) - { - if (rpp_dopending(index, TRUE)) - { - return(-1); - } - } - - if (rpp_recv_all() == -1) - { - return(-1); - } - - rpp_send_out(); - - return(0); - } /* END rpp_flush() */ - - - - - -/* -** Create a new socket if needed and bind a local port. -** If port is 0, pick a free port number. -*/ - -int rpp_bind( - - uint port) - - { - - struct sockaddr_in from; - int flags; - - if (rpp_fd == -1) - { - if ((rpp_fd = socket(PF_INET, SOCK_DGRAM, 0)) == -1) - { - return(-1); - } - - /* set close on exec */ - - if ((flags = fcntl(rpp_fd, F_GETFD)) == -1) - { - close(rpp_fd); - - rpp_fd = -1; - - return(-1); - } - - flags |= FD_CLOEXEC; - - if (fcntl(rpp_fd, F_SETFD, flags) == -1) - { - close(rpp_fd); - - rpp_fd = -1; - - return(-1); - } - - /* set no delay */ - - if ((flags = fcntl(rpp_fd, F_GETFL)) == -1) - { - close(rpp_fd); - - rpp_fd = -1; - - return(-1); - } - -#if defined(FNDELAY) && !defined(__hpux) - flags |= FNDELAY; - -#else - flags |= O_NONBLOCK; - -#endif - - if (fcntl(rpp_fd, F_SETFL, flags) == -1) - { - close(rpp_fd); - - rpp_fd = -1; - - return(-1); - } - } /* END if (rpp_fd == -1) */ - - if (rpp_fd_array != NULL) - { - int i; - - for (i = 0;i < rpp_fd_num;i++) - { - if (rpp_fd_array[i] == rpp_fd) - { - return(rpp_fd); - } - } - } - - memset(&from, '\0', sizeof(from)); - - from.sin_family = AF_INET; - from.sin_addr.s_addr = htonl(INADDR_ANY); - from.sin_port = htons((u_short)port); - - if (bind(rpp_fd, (struct sockaddr *)&from, sizeof(from)) == -1) - { - return(-1); - } - - - LOCAL_DBPRT((DBTO, "bind to port %d\n", - - ntohs(from.sin_port))) - - if (rpp_fd_array == NULL) - { - rpp_fd_array = (int *)malloc(sizeof(int)); - - rpp_fd_num = 1; - -#if defined(HAVE_ATEXIT) - atexit(rpp_shutdown); -#elif defined(HAVE_ON_EXIT) - on_exit(rpp_shutdown_on_exit, NULL); -#else - /* atexit() or on_exit() must be defined */ - - abort compile -#endif /* HAVE_ATEXIT */ - } - else - { - rpp_fd_num++; - - rpp_fd_array = (int *)realloc(rpp_fd_array, sizeof(int) * rpp_fd_num); - } - - assert(rpp_fd_array); - - rpp_fd_array[rpp_fd_num-1] = rpp_fd; - - return(rpp_fd); - } - - - - - - -/** - * Allocate a communication stream - return -1 on FAILURE - */ - -int rpp_open( - - char *name, /* I */ - uint port, /* I */ - char *EMsg) /* O (optional,minsize=1024) */ - - { - DOID("rpp_open") - - int i, stream; - - struct hostent *hp; - - struct stream *sp; - - LOCAL_DBPRT((DBTO, "%s: entered %s:%d\n", - id, - name, - port)) - - if (EMsg != NULL) - EMsg[0] = '\0'; - - if (rpp_bind(0) == -1) /* bind if we need to */ - { - if (EMsg != NULL) - sprintf(EMsg, "cannot bind rpp socket"); - - /* FAILURE */ - - return(-1); - } - - /* First, we look up the IP address for this name. */ - - if ((hp = gethostbyname(name)) == NULL) - { - LOCAL_DBPRT((DBTO, "%s: host %s not found\n", - id, - name)) - - errno = ENOENT; - - if (EMsg != NULL) - { - sprintf(EMsg, "hostname resolution for '%s' failed, errno=%d", - name, - h_errno); - } - - /* FAILURE */ - - return(-1); - } - - /* - ** Look for previously existant stream to the given - ** host. If one is found in an open state, just - ** return it. - */ - - for (i = 0;i < stream_num;i++) - { - sp = &stream_array[i]; - - if (sp->state <= RPP_FREE) - continue; - - if (memcmp(&sp->addr.sin_addr, hp->h_addr, hp->h_length)) - continue; - - if (sp->addr.sin_port != htons((unsigned short)port)) - continue; - - if (sp->addr.sin_family != hp->h_addrtype) - continue; - - if (sp->state > RPP_CLOSE_PEND) - { - LOCAL_DBPRT((DBTO, "%s: OLD STREAM state %d reopened %d\n", - id, - sp->state, - sp->open_key)) - - clear_stream(sp); /* old stream */ - } - else - { - LOCAL_DBPRT((DBTO, "%s: reopen of %s, sp->retry %d, global %d\n", - id, - netaddr(&sp->addr), - sp->retry, - RPPRetry)) - - sp->retry = RPPRetry; - - /* SUCCESS */ - - return(i); - } - } - - stream = rpp_create_sp(); - - if (stream == -1) - { - if (EMsg != NULL) - { - sprintf(EMsg, "cannot create new stream"); - } - - /* FAILURE */ - - return(-1); - } - - sp = &stream_array[stream]; - - if (open_key == 0) - open_key = (int)time(0) & 0x0fff; - - /* - ** We save the address returned for the name given so we - ** can send out on the preferred interface. - */ - - memcpy(&sp->addr.sin_addr, hp->h_addr, hp->h_length); - - sp->addr.sin_port = htons((unsigned short)port); - - sp->addr.sin_family = hp->h_addrtype; - - sp->fd = rpp_fd; - - sp->retry = RPPRetry; - - if (hp->h_addr_list[1] == NULL) - { - if ((hp = rpp_get_cname(&sp->addr)) == NULL) - { - errno = ENOENT; - - if (EMsg != NULL) - { - sprintf(EMsg, "cannot lookup cname for host '%s'", - name); - } - - /* FAILURE */ - - return(-1); - } - } - - rpp_alist(hp, sp); - - if(server_alias) - { - hp = gethostbyname(server_alias); - - if(hp) - { - if(sp->addr_array == NULL) - { - sp->addr_array = (struct in_addr *)calloc(1, sizeof(struct in_addr)); - if(sp->addr_array) - { - memcpy(&sp->addr_array[0], hp->h_addr_list[0], hp->h_length); - } - } - else - { - struct in_addr *tmp_array; - int j; - - for(i = 0; &sp->addr_array[i] != NULL; i++); - - tmp_array = ( struct in_addr *)calloc(i, sizeof(struct in_addr)); - - if(tmp_array) - { - for(j = 0; j < i; j++) - { - memcpy(&tmp_array[j], &sp->addr_array[j], hp->h_length); - } - memcpy(&tmp_array[i], hp->h_addr_list[0], hp->h_length); - } - } - } - } - - - - sp->stream_id = stream; /* use my streamid for HELLO1 */ - sp->state = RPP_OPEN_WAIT; - sp->open_key = open_key++; - - rpp_form_pkt(stream, RPP_HELLO1, sp->open_key, NULL, 0); - - sp->stream_id = -1; /* don't know his stream id yet */ - - if (rpp_recv_all() == -1) - { - if (EMsg != NULL) - { - sprintf(EMsg, "rpp_recv_all failed"); - } - - /* FAILURE */ - - return(-1); - } - - /* SUCCESS */ - - rpp_send_out(); - - return(stream); - } /* END rpp_open() */ - - - - -/* -** Return the network address for a stream. -*/ - -struct sockaddr_in *rpp_getaddr( - - int index) - - { - DOID("getaddr") - - struct stream *sp; - - LOCAL_DBPRT((DBTO, "%s: entered index %d\n", - id, index)) - - if ((index < 0) || (index >= stream_num)) - { - errno = EINVAL; - - return(NULL); - } - - sp = &stream_array[index]; - - if (sp->state <= RPP_FREE) - { - errno = ENOTCONN; - - return(NULL); - } - - return(&sp->addr); - } - - - - -/* -** Free all memory and close the socket. -*/ - -void rpp_terminate(void) - - { - - struct stream *sp; - - struct send_packet *spp; - - struct pending *ppp; - - struct recv_packet *rpp; - int i; - - for (i = 0;i < rpp_fd_num;i++) - close(rpp_fd_array[i]); - - if (rpp_fd_array) - { - free(rpp_fd_array); - - rpp_fd_array = NULL; - rpp_fd_num = 0; - } - - for (i = 0;i < stream_num;i++) - { - sp = &stream_array[i]; - - if (sp->state == RPP_DEAD) - continue; - - for (ppp = sp->pend_head;ppp != NULL;ppp = sp->pend_head) - { - free(ppp->data); - - sp->pend_head = ppp->next; - - free(ppp); - } - - for (rpp = sp->recv_head;rpp != NULL;rpp = sp->recv_head) - { - if (rpp->data != NULL) - free(rpp->data); - - sp->recv_head = rpp->next; - - free(rpp); - } - - for (spp = sp->send_head;spp != NULL;spp = sp->send_head) - { - free(spp->data); - - sp->send_head = spp->next; - - free(spp); - } - } - - pthread_mutex_lock(master_list_mutex); - - top = NULL; - - bottom = NULL; - - pthread_mutex_unlock(master_list_mutex); - - if (stream_array) - free(stream_array); - - stream_num = 0; - - stream_array = NULL; - - rpp_fd = -1; - - return; - } /* END rpp_terminate() */ - - - - -/* -** Trampoline for on_exit -*/ - -void rpp_shutdown_on_exit( - - int foo, - void *bar) - - { - rpp_shutdown(); - - return; - } /* END rpp_shutdown_on_exit() */ - - - - - -/* -** Shutdown the library. Flush and close all open streams -** and call rpp_terminate(). -*/ - -void -rpp_shutdown(void) - - { - int timeouts, num, i; - fd_set fdset; - - struct timeval tv; - - FD_ZERO(&fdset); - - for (i = 0;i < stream_num;i++) - { - rpp_close(i); - } - - for (timeouts = 0;timeouts < 3;) - { - for (i = 0;i < stream_num;i++) - { - if (stream_array[i].state > RPP_FREE) - break; - } - - if (i == stream_num) - break; - - LOCAL_DBPRT((DBTO, "shutdown: stream %d state %d\n", - i, - stream_array[i].state)) - - if ((num = rpp_recv_all()) == -1) - break; - - rpp_send_out(); - - if (num == -3) - { - /* got nothing -- wait a bit */ - - tv.tv_sec = RPPTimeOut; - tv.tv_usec = 0; - - for (i = 0;i < rpp_fd_num;i++) - FD_SET(rpp_fd_array[i], &fdset); - - i = select(FD_SETSIZE, &fdset, NULL, NULL, &tv); - - if (i == 0) - timeouts++; - - if (i == -1) - break; - } - } /* END for (timeouts) */ - - rpp_terminate(); - - return; - } /* END rpp_shutdown() */ - - - - - - -/* -** Terminate a connection stream. -** Return 0 if it all went well, -1 on error. -*/ - -int rpp_close( - - int index) - - { - DOID("close") - - struct stream *sp; - - LOCAL_DBPRT((DBTO, "%s: entered index %d\n", - id, index)) - - if ((index < 0) || (index >= stream_num)) - { - errno = EINVAL; - - return(-1); - } - - sp = &stream_array[index]; - - switch (sp->state) - { - - case RPP_STALE: - - clear_stream(sp); - - return(0); - - /*NOTREACHED*/ - - break; - - case RPP_CLOSE_PEND: - - sp->state = RPP_LAST_ACK; - - break; - - case RPP_OPEN_WAIT: - - case RPP_CONNECT: - - if (sp->pend_head != NULL) - { - if (rpp_dopending(index, TRUE)) - { - return(-1); - } - } - - sp->state = RPP_CLOSE_WAIT1; - - break; - - default: - - errno = ENOTCONN; - - return(-1); /* stream closed */ - - /*NOTREACHED*/ - - break; - } - - rpp_form_pkt(index, RPP_GOODBYE, sp->send_sequence, NULL, 0); - - if (rpp_recv_all() == -1) - { - return(-1); - } - - rpp_send_out(); - - return(0); - } /* END rpp_close() */ - - - - - -/* -** Add information to the stream given by index. -** Return -1 on error, otherwise number of bytes written. -*/ - -int rpp_write( - - int index, - void *buf, - int len) - - { - DOID("write") - - struct stream *sp; - - struct pending *pp; - - int hold, residual, more; - - LOCAL_DBPRT((DBTO, "%s: entered index %d size %d\n", - id, index, len)) - - if ((index < 0) || (index >= stream_num) || (len < 0)) - { - errno = EINVAL; - - return(-1); - } - - if (len == 0) - { - return(0); - } - - sp = &stream_array[index]; - - rpp_stale(sp); /* check freshness */ - - switch (sp->state) - { - - case RPP_STALE: - - errno = ETIMEDOUT; - - return(-1); - - /*NOTREACHED*/ - - break; - - case RPP_CLOSE_PEND: - - errno = EPIPE; - - return(-1); - - /*NOTREACHED*/ - - break; - - case RPP_OPEN_PEND: /* shouldn't happen */ - - case RPP_DEAD: - - case RPP_FREE: - - case RPP_CLOSE_WAIT1: /* stream closed */ - - case RPP_CLOSE_WAIT2: - - case RPP_LAST_ACK: - - errno = ENOTCONN; - - return(-1); - - /*NOTREACHED*/ - - break; - - default: - - /* NO-OP */ - - break; - } - - residual = 0; - - while (residual < len) - { - hold = sp->pend_attempt % RPP_PKT_DATA; - - if (((pp = sp->pend_tail) == NULL) || (hold == 0)) - { - pp = (struct pending *)malloc(sizeof(struct pending)); - - if (sp->pend_tail == NULL) - sp->pend_head = pp; - else - sp->pend_tail->next = pp; - - sp->pend_tail = pp; - - pp->data = (u_char *)malloc(RPP_PKT_SIZE); - - assert(pp->data != NULL); - - pp->next = NULL; - } - - more = MIN(len - residual, RPP_PKT_DATA - hold); - - memcpy(&pp->data[hold], (char *)buf + residual, more); - - residual += more; - - sp->pend_attempt += more; - } - - if (rpp_recv_all() == -1) - { - return(-1); - } - - rpp_send_out(); - - return(residual); - } /* END rpp_write() */ - - - - - -/* -** Check a stream to see if it needs attention. -*/ - -static int rpp_attention( - - int index) /* I */ - - { - DOID("attention") - - int mesg, count; - int seq; - - struct stream *sp; - - struct recv_packet *pp; - - sp = &stream_array[index]; - - LOCAL_DBPRT((DBTO, "%s: stream %d in state %d addr %s\n", - id, index, sp->state, netaddr(&sp->addr))) - - rpp_stale(sp); - - switch (sp->state) - { - case RPP_STALE: /* need to report error */ - - return(TRUE); - - /*NOTREACHED*/ - - break; - - case RPP_CLOSE_PEND: /* we haven't closed yet */ - - case RPP_CONNECT: /* check for message */ - - /* NO-OP */ - - break; - - default: - - return(FALSE); - - /*NOTREACHED*/ - - break; - } /* END switch (sp->state) */ - - if ((sp->msg_cnt > 0) && (sp->recv_attempt <= sp->msg_cnt)) - { - return(TRUE); /* message to read */ - } - - mesg = FALSE; - - count = 0; - - for (pp = sp->recv_head, seq = sp->recv_sequence;pp != NULL;pp = pp->next, seq++) - { - count += pp->len; - - if (pp->sequence != seq) - break; - - if (pp->type != RPP_DATA) - { - /* end of message */ - - mesg = TRUE; - - break; - } - } - - if (mesg == TRUE) - sp->msg_cnt = count; - - return(mesg); - } /* END rpp_attention() */ - - - - - -/* -** Check some state before reading or skipping. If it is -** okay to continue, return 1. Otherwise, return <= 0. -*/ - -static int rpp_okay( - - int index) /* I */ - - { - - struct stream *sp; - fd_set fdset; - - struct timeval tv; - - FD_ZERO(&fdset); - - while (rpp_attention(index) == FALSE) - { - int i; - - tv.tv_sec = RPPTimeOut; - tv.tv_usec = 0; - - for (i = 0;i < rpp_fd_num;i++) - FD_SET(rpp_fd_array[i], &fdset); - - i = select(FD_SETSIZE, &fdset, NULL, NULL, &tv); - - if ((i == -1) || (i == 0)) - { - /* if tiemout or select failure, return FAILURE (CRI) */ - - return(-1); - } - - if (rpp_recv_all() == -1) - { - return(-1); - } - - rpp_send_out(); - } - - sp = &stream_array[index]; - - if (sp->state == RPP_STALE) - { - /* stale output */ - errno = ETIMEDOUT; - - return(-1); - } - - if (sp->recv_attempt == sp->msg_cnt) - { - /* end of message */ - - if (sp->state == RPP_CLOSE_PEND) - { - return(-2); - } - - /* SUCCESS */ - - return(0); - } - - /* okay to return */ - - return(1); - } /* END rpp_okay() */ - - - - - - -/* -** Read a message. Return data up to the end of a message -** or the end of the provided buffer. -** Return -1 on error, -2 if other side has closed, otherwise -** number of bytes read. -*/ - -int rpp_read( - - int index, /* I */ - void *buf, /* O */ - int len) /* I */ - - { - DOID("read") - - int hiwater, cpylen, hold, ret, xlen; - - struct recv_packet *pp; - - struct stream *sp; - - LOCAL_DBPRT((DBTO, "%s: entered index %d\n", - id, index)) - - errno = 0; - - if ((index < 0) || (index >= stream_num) || (len < 0)) - { - errno = EINVAL; - - return(-1); - } - - if (len == 0) - { - /* no data to read, return SUCCESS */ - - return(0); - } - - sp = &stream_array[index]; - - switch (sp->state) - { - - case RPP_DEAD: - - case RPP_FREE: - - case RPP_CLOSE_WAIT1: - - case RPP_CLOSE_WAIT2: - - case RPP_LAST_ACK: - - errno = ENOTCONN; - - return(-1); /* stream closed */ - - /*NOTREACHED*/ - - break; - - default: - - /* NO-OP */ - - break; - } - - if ((ret = rpp_okay(index)) <= 0) - { - return(ret); - } - - sp = &stream_array[index]; - - cpylen = 0; /* find packet to copy from */ - - for (pp = sp->recv_head;pp != NULL;pp = pp->next) - { - int bump = cpylen + pp->len; - - if (sp->recv_attempt < bump) - break; - - cpylen = bump; - } /* END for (pp) */ - - hiwater = 0; - - xlen = MIN(len, sp->msg_cnt); - - hold = sp->recv_attempt - cpylen; /* start point in pkt data */ - - while ((pp != NULL) && (xlen > hiwater)) - { - /* got room */ - - cpylen = MIN(pp->len - hold, xlen - hiwater); - - memcpy((char *)buf + hiwater, &pp->data[hold], cpylen); - - hiwater += cpylen; - - sp->recv_attempt += cpylen; - - hold = 0; - - pp = pp->next; - } /* END while () */ - - return(hiwater); - } /* END rpp_read() */ - - - - - -/* -** Commit data which has been read up to recv_attempt if flag -** is TRUE. Otherwise, set recv_attempt back to the previous -** commit point recv_commit. -** Return -1 on error, FALSE on decommit or if end-of-message has -** not been reached, TRUE if end-of-message has been reached. -*/ - -int rpp_rcommit( - - int index, /* I */ - int flag) /* I */ - - { - DOID("rcommit") - - struct stream *sp; - - LOCAL_DBPRT((DBTO, "%s: entered index %d\n", - id, - index)) - - if ((index < 0) || (index >= stream_num)) - { - errno = EINVAL; - - return(-1); - } - - sp = &stream_array[index]; - - switch (sp->state) - { - - case RPP_CLOSE_WAIT1: /* stream closed */ - - case RPP_CLOSE_WAIT2: - - case RPP_LAST_ACK: - - case RPP_OPEN_PEND: /* shouldn't happen */ - - case RPP_FREE: - - case RPP_DEAD: - - errno = ENOTCONN; - - return(-1); - - /*NOTREACHED*/ - - break; - - default: - - /* NO-OP */ - - break; - } - - if (flag == FALSE) - { - /* no commit */ - - sp->recv_attempt = sp->recv_commit; - - return(0); - } - - sp->recv_commit = sp->recv_attempt; - - if (sp->recv_commit == sp->msg_cnt) - { - /* return TRUE, end of message reached */ - - return(1); - } - - return(0); - } /* END rpp_rcommit() */ - - - - - -/* -** Reset end-of-message condition on a stream. Any packets -** on the receive queue are freed. -** Return -1 on error, 0 otherwise. -*/ - -int rpp_eom( - - int index) - - { - DOID("eom") - - struct stream *sp; - - struct recv_packet *pp; - - LOCAL_DBPRT((DBTO, "%s: entered index %d\n", - id, - index)) - - if ((index < 0) || (index >= stream_num)) - { - errno = EINVAL; - - return(-1); - } - - sp = &stream_array[index]; - - switch (sp->state) - { - - case RPP_CLOSE_WAIT1: /* stream closed */ - - case RPP_CLOSE_WAIT2: - - case RPP_LAST_ACK: - - case RPP_OPEN_PEND: /* shouldn't happen */ - - case RPP_FREE: - - case RPP_DEAD: - - errno = ENOTCONN; - - return(-1); - - /*NOTREACHED*/ - - break; - - default: - - /* NO-OP */ - - break; - } - - /* - ** work though recv packets - */ - - for (pp = sp->recv_head;pp != NULL;pp = sp->recv_head) - { - if (pp->type == RPP_GOODBYE) /* stream finished */ - break; - - if (sp->msg_cnt < pp->len) - break; - - sp->recv_sequence++; - - sp->msg_cnt -= pp->len; - - if (pp->data) - free(pp->data); - - sp->recv_head = pp->next; - - free(pp); - } - - if (sp->recv_head == NULL) - sp->recv_tail = NULL; - - sp->recv_attempt = 0; - - sp->recv_commit = 0; - - return(0); - } /* END rpp_eom() */ - - - - - - -/* -** Commit data which has been written up to pend_attempt if flag -** is TRUE. Otherwise, set pend_attempt back to the previous -** commit point pend_commit. -** Return -1 on error, 0 otherwise. -*/ - -int rpp_wcommit( - - int index, - int flag) - - { - DOID("wcommit") - - struct pending *pp, *next; - - struct stream *sp; - - LOCAL_DBPRT((DBTO, "%s: entered index %d\n", - id, - index)) - - if ((index < 0) || (index >= stream_num)) - { - errno = EINVAL; - - return(-1); - } - - sp = &stream_array[index]; - - switch (sp->state) - { - - case RPP_CLOSE_PEND: - - errno = EPIPE; - - return(-1); - - /*NOTREACHED*/ - - break; - - case RPP_STALE: - - errno = ETIMEDOUT; - - return(-1); - - /*NOTREACHED*/ - - break; - - case RPP_CLOSE_WAIT1: /* stream closed */ - - case RPP_CLOSE_WAIT2: - - case RPP_LAST_ACK: - - case RPP_OPEN_PEND: /* shouldn't happen */ - - case RPP_FREE: - - case RPP_DEAD: - - errno = ENOTCONN; - - return(-1); - - break; - - default: - - /* NO-OP */ - - break; - } /* END switch (sp->state) */ - - if (flag) - { - /* commit */ - - if (rpp_dopending(index, FALSE)) - { - return(-1); - } - - if (rpp_recv_all() == -1) - { - return(-1); - } - - rpp_send_out(); - - return(0); - } - - sp->pend_attempt = sp->pend_commit; - - if (sp->pend_head == NULL) - { - return(0); - } - - for (pp = sp->pend_head->next;pp;pp = next) - { - free(pp->data); - - next = pp->next; - - free(pp); - } /* for (pp) */ - - sp->pend_head->next = NULL; - - sp->pend_tail = sp->pend_head; - - return(0); - } /* rpp_wcommit() */ - - - - - -/* -** Skip len characters of a message. -*/ - -int rpp_skip( - - int index, - int len) - - { - DOID("skip") - - struct stream *sp; - int ret, hiwater; - - LOCAL_DBPRT((DBTO, "%s: entered index %d\n", - id, - index)) - - if ((index < 0) || (index >= stream_num)) - { - errno = EINVAL; - - return(-1); - } - - sp = &stream_array[index]; - - switch (sp->state) - { - - case RPP_DEAD: - - case RPP_FREE: - - case RPP_CLOSE_WAIT1: - - case RPP_CLOSE_WAIT2: - - case RPP_LAST_ACK: - - errno = ENOTCONN; - - return(-1); /* stream closed */ - - /*NOTREACHED*/ - - break; - - default: - - /* NO-OP */ - - break; - } - - if ((ret = rpp_okay(index)) <= 0) - { - /* FAILURE - may be 0, -1, or -2 */ - - return(ret); - } - - sp = &stream_array[index]; - - hiwater = MIN(sp->msg_cnt - sp->recv_attempt, len); - - sp->recv_attempt += hiwater; - - return(hiwater); - } /* END rpp_skip() */ - - - - -/** - * Mark this stream as being serviced currently - */ -void started_servicing( - - int index) - - { - pthread_mutex_lock(stream_mutexes+index); - stream_array[index].being_attended = TRUE; - pthread_mutex_unlock(stream_mutexes+index); - } /* END started_servicing() */ - - - - - -/** - * Mark this stream as no longer being serviced - */ -void done_servicing( - - int index) - - { - pthread_mutex_lock(stream_mutexes+index); - stream_array[index].being_attended = FALSE; - pthread_mutex_unlock(stream_mutexes+index); - } /* END done_servicing() */ - - - -/** - * @return TRUE if this stream is being serviced, false otherwise - */ -int being_serviced( - - int index) - - { - int rc; - - pthread_mutex_lock(stream_mutexes+index); - rc = stream_array[index].being_attended; - pthread_mutex_unlock(stream_mutexes+index); - - return(rc); - } - - - - -/* -** Check for any stream with a message waiting and -** return the stream number or a -1 if there are none. -*/ - -int rpp_poll(void) - - { - DOID("poll") - - int i; - - LOCAL_DBPRT((DBTO, "%s: entered streams %d\n", - id, - stream_num)) - - /* - ** Read socket to get any packets - */ - - for (;;) - { - i = rpp_recv_all(); - - if ((i == -1) || (i == -3)) - break; - } - - if (i == -1) - { - return(-1); - } - - /* see if any stream has a message waiting */ - - for (i = 0;i < stream_num;i++) - { - if ((rpp_attention(i)) && - (!being_serviced(i))) - break; - } - - if (i < stream_num) /* found one */ - { - return(i); - } - - rpp_send_out(); - - /* unknown stream identifier */ - - return(-2); - } - - - - -/* -** Process any stream i/o. -** Return 0 or a -1 if there was an error. -*/ - -int rpp_io(void) - - { - DOID("io") - - int i; - - LOCAL_DBPRT((DBTO, "%s: entered streams %d\n", - id, - stream_num)) - - /* - ** Read socket to get any packets - */ - - for (;;) - { - i = rpp_recv_all(); - - if (i == -1 || i == -3) - break; - } - - if (i == -1) - { - return(-1); - } - - rpp_send_out(); - - return(0); - } /* END rpp_io() */ - - - - - - -/* -** Read a character. -** Returns >=0 the char read -** -1 error or EOD -** -2 EOF -*/ - -int rpp_getc( - - int index) - - { - int ret; - u_char c; - - if ((ret = rpp_read(index, &c, 1)) == 1) - { - /* SUCCESS */ - - return((int)c); - } - - if (ret == -2) - { - /* FAILURE: type is ??? */ - - return(-2); - } - - /* FAILURE */ - - return(-1); - } /* END rpp_getc() */ - - - - -/* -** Write a character. -*/ - -int rpp_putc( - - int index, - int c) - - { - u_char x = (u_char)c; - - if (rpp_write(index, &x, 1) != 1) - { - return(-1); - } - - return(0); - } - - - - -int RPPConfigure( - - int SRPPTimeOut, /* I */ - int SRPPRetry) /* I */ - - { - if (SRPPTimeOut > 0) - RPPTimeOut = SRPPTimeOut; - - if (SRPPRetry > 1) /* always need an "extra" retry to invalidate existing conns */ - RPPRetry = SRPPRetry; - - return(0); - } - - - - -int RPPReset(void) - - { - RPPTimeOut = DEFAULT_RPP_TIMEOUT; - RPPRetry = DEFAULT_RPP_RETRY; - - return(0); - } - -int rpp_get_stream_state(int index) -{ - struct stream *sp; - - sp = &stream_array[index]; - - if(sp) - { - return(sp->state); - } - - return(-1); -} - -/* END rpp.c */ - diff --git a/src/lib/Libifl/tcp_dis.c b/src/lib/Libifl/tcp_dis.c index 6503de9f2a..1887c2a130 100644 --- a/src/lib/Libifl/tcp_dis.c +++ b/src/lib/Libifl/tcp_dis.c @@ -256,7 +256,7 @@ int tcp_read( newsize = (tdis_buf_len + *read_len) * 2; if ((ptr = (char *)calloc(1, newsize+1)) == NULL) { - log_err(ENOMEM,__func__,"Could not allocate memory to read buffer"); + log_err(ENOMEM,__func__,(char *)"Could not allocate memory to read buffer"); rc = PBSE_MEM_MALLOC; free(new_data); return rc; @@ -668,7 +668,7 @@ struct tcp_chan * DIS_tcp_setup( if ((chan = (struct tcp_chan *)calloc(1, sizeof(struct tcp_chan))) == NULL) { - log_err(ENOMEM, "DIS_tcp_setup", "calloc failure"); + log_err(ENOMEM, (char *)"DIS_tcp_setup", (char *)"calloc failure"); return(NULL); } @@ -680,7 +680,7 @@ struct tcp_chan * DIS_tcp_setup( if ((tp->tdis_thebuf = (char *)calloc(1, THE_BUF_SIZE+1)) == NULL) { free(chan); - log_err(errno,"DIS_tcp_setup","calloc failure"); + log_err(errno,(char *)"DIS_tcp_setup",(char *)"calloc failure"); return(NULL); } @@ -693,7 +693,7 @@ struct tcp_chan * DIS_tcp_setup( { free(chan->readbuf.tdis_thebuf); free(chan); - log_err(errno,"DIS_tcp_setup","calloc failure"); + log_err(errno,(char *)"DIS_tcp_setup",(char *)"calloc failure"); return(NULL); } diff --git a/src/lib/Libifl/test/Makefile.am b/src/lib/Libifl/test/Makefile.am index 81c8f91785..50840394da 100644 --- a/src/lib/Libifl/test/Makefile.am +++ b/src/lib/Libifl/test/Makefile.am @@ -1 +1 @@ -SUBDIRS = PBSD_gpuctrl2 PBSD_manage2 PBSD_manager_caps PBSD_msg2 PBSD_rdrpy PBSD_sig2 PBSD_status PBSD_status2 PBSD_submit_caps PBS_attr dec_Authen dec_CpyFil dec_Gpu dec_JobCred dec_JobFile dec_JobId dec_JobObit dec_Manage dec_MoveJob dec_MsgJob dec_QueueJob dec_Reg dec_ReqExt dec_ReqHdr dec_Resc dec_ReturnFile dec_RunJob dec_Shut dec_Sig dec_Status dec_Track dec_attrl dec_attropl dec_rpyc dec_rpys dec_svrattrl enc_CpyFil enc_Gpu enc_JobCred enc_JobFile enc_JobId enc_JobObit enc_Manage enc_MoveJob enc_MsgJob enc_QueueJob enc_QueueJob_hash enc_Reg enc_ReqExt enc_ReqHdr enc_ReturnFile enc_RunJob enc_Shut enc_Sig enc_Status enc_Track enc_attrl enc_attropl enc_attropl_hash enc_reply enc_svrattrl get_svrport list_link nonblock pbsD_alterjo pbsD_asyrun pbsD_chkptjob pbsD_connect pbsD_deljob pbsD_gpuctrl pbsD_holdjob pbsD_locjob pbsD_manager pbsD_movejob pbsD_msgjob pbsD_orderjo pbsD_rerunjo pbsD_resc pbsD_rlsjob pbsD_runjob pbsD_selectj pbsD_sigjob pbsD_stagein pbsD_statjob pbsD_statnode pbsD_statque pbsD_statsrv pbsD_submit pbsD_submit_hash pbsD_termin pbs_geterrmg pbs_statfree rpp tcp_dis tm torquecfg trq_auth +SUBDIRS = PBSD_gpuctrl2 PBSD_manage2 PBSD_manager_caps PBSD_msg2 PBSD_rdrpy PBSD_sig2 PBSD_status PBSD_status2 PBSD_submit_caps PBS_attr dec_Authen dec_CpyFil dec_Gpu dec_JobCred dec_JobFile dec_JobId dec_JobObit dec_Manage dec_MoveJob dec_MsgJob dec_QueueJob dec_Reg dec_ReqExt dec_ReqHdr dec_Resc dec_ReturnFile dec_RunJob dec_Shut dec_Sig dec_Status dec_Track dec_attrl dec_attropl dec_rpyc dec_rpys dec_svrattrl enc_CpyFil enc_Gpu enc_JobCred enc_JobFile enc_JobId enc_JobObit enc_Manage enc_MoveJob enc_MsgJob enc_QueueJob enc_QueueJob_hash enc_Reg enc_ReqExt enc_ReqHdr enc_ReturnFile enc_RunJob enc_Shut enc_Sig enc_Status enc_Track enc_attrl enc_attropl enc_attropl_hash enc_reply enc_svrattrl get_svrport list_link nonblock pbsD_alterjo pbsD_asyrun pbsD_chkptjob pbsD_connect pbsD_deljob pbsD_gpuctrl pbsD_holdjob pbsD_locjob pbsD_manager pbsD_movejob pbsD_msgjob pbsD_orderjo pbsD_rerunjo pbsD_resc pbsD_rlsjob pbsD_runjob pbsD_selectj pbsD_sigjob pbsD_stagein pbsD_statjob pbsD_statnode pbsD_statque pbsD_statsrv pbsD_submit pbsD_submit_hash pbsD_termin pbs_geterrmg pbs_statfree tcp_dis tm torquecfg trq_auth diff --git a/src/lib/Libifl/test/rpp/Makefile.am b/src/lib/Libifl/test/rpp/Makefile.am deleted file mode 100644 index 7ff023fb76..0000000000 --- a/src/lib/Libifl/test/rpp/Makefile.am +++ /dev/null @@ -1,27 +0,0 @@ -PROG_ROOT = ../.. - -AM_CFLAGS = -g -DTEST_FUNCTION -I${PROG_ROOT}/ -I${PROG_ROOT}/${PBS_MACH} --coverage - -lib_LTLIBRARIES = librpp.la - -AM_LDFLAGS = @CHECK_LIBS@ ${lib_LTLIBRARIES} - -check_PROGRAMS = test_rpp - -librpp_la_SOURCES = scaffolding.c ${PROG_ROOT}/rpp.c -librpp_la_LDFLAGS = @CHECK_LIBS@ -shared - -test_rpp_SOURCES = test_rpp.c - -check_SCRIPTS = coverage_run.sh - -TESTS = ${check_PROGRAMS} coverage_run.sh - -coverage_run.sh: - echo 'cp -p .libs/rpp.gc* . >/dev/null 2>&1' > $@ - echo 'RESULTS=($$(gcov rpp.gcda))' >> $@ - echo 'PARSED_RESULT="TOTALCOV -- $${RESULTS[1]}: Lines($${RESULTS[5]})- $${RESULTS[3]}"' >> $@ - echo 'echo -e "\033[40m\033[1;33m$$PARSED_RESULT\033[0m"' >> $@ - chmod +x $@ - -CLEANFILES = coverage_run.sh *.gcno *.gcda *.gcov core *.lo diff --git a/src/lib/Libifl/test/rpp/scaffolding.c b/src/lib/Libifl/test/rpp/scaffolding.c deleted file mode 100644 index 9364e0598c..0000000000 --- a/src/lib/Libifl/test/rpp/scaffolding.c +++ /dev/null @@ -1,10 +0,0 @@ -#include "license_pbs.h" /* See here for the software license */ -#include -#include /* fprintf */ - -void log_err(int errnum, const char *routine, char *text) - { - fprintf(stderr, "The call to log_err needs to be mocked!!\n"); - exit(1); - } - diff --git a/src/lib/Libifl/test/rpp/test_rpp.c b/src/lib/Libifl/test/rpp/test_rpp.c deleted file mode 100644 index ea63b8e20d..0000000000 --- a/src/lib/Libifl/test/rpp/test_rpp.c +++ /dev/null @@ -1,53 +0,0 @@ -#include "license_pbs.h" /* See here for the software license */ -#include "lib_ifl.h" -#include "test_rpp.h" -#include -#include - - -#include "pbs_error.h" - -START_TEST(test_one) - { - - - } -END_TEST - -START_TEST(test_two) - { - - - } -END_TEST - -Suite *rpp_suite(void) - { - Suite *s = suite_create("rpp_suite methods"); - TCase *tc_core = tcase_create("test_one"); - tcase_add_test(tc_core, test_one); - suite_add_tcase(s, tc_core); - - tc_core = tcase_create("test_two"); - tcase_add_test(tc_core, test_two); - suite_add_tcase(s, tc_core); - - return s; - } - -void rundebug() - { - } - -int main(void) - { - int number_failed = 0; - SRunner *sr = NULL; - rundebug(); - sr = srunner_create(rpp_suite()); - srunner_set_log(sr, "rpp_suite.log"); - srunner_run_all(sr, CK_NORMAL); - number_failed = srunner_ntests_failed(sr); - srunner_free(sr); - return number_failed; - } diff --git a/src/lib/Libifl/test/rpp/test_rpp.h b/src/lib/Libifl/test/rpp/test_rpp.h deleted file mode 100644 index 7da3d7621e..0000000000 --- a/src/lib/Libifl/test/rpp/test_rpp.h +++ /dev/null @@ -1,11 +0,0 @@ -#include "license_pbs.h" /* See here for the software license */ -#ifndef _RPP_CT_H -#define _RPP_CT_H -#include - -#define RPP_SUITE 1 -Suite *rpp_suite(); -#define METH_2 2 -Suite *meth_2_suite(); - -#endif /* _RPP_CT_H */ diff --git a/src/lib/Libifl/tm.c b/src/lib/Libifl/tm.c index 6a7649adc8..54bd7e01ce 100644 --- a/src/lib/Libifl/tm.c +++ b/src/lib/Libifl/tm.c @@ -1158,7 +1158,7 @@ tm_publish( goto tm_publish_cleanup; } - if (diswcs(chan, info, len) != DIS_SUCCESS) + if (diswcs(chan, (char *)info, len) != DIS_SUCCESS) { rc = TM_ESYSTEM; goto tm_publish_cleanup; @@ -1848,12 +1848,12 @@ int tm_adopt( /* Fabricate the tm state as best we can - not really needed */ if ((tm_jobid = getenv("PBS_JOBID")) == NULL) - tm_jobid = "ADOPT JOB"; + tm_jobid = (char *)"ADOPT JOB"; tm_jobid_len = strlen(tm_jobid); if ((tm_jobcookie = getenv("PBS_JOBCOOKIE")) == NULL) - tm_jobcookie = "ADOPT COOKIE"; + tm_jobcookie = (char *)"ADOPT COOKIE"; tm_jobcookie_len = strlen(tm_jobcookie); diff --git a/src/lib/Libifl/torquecfg.c b/src/lib/Libifl/torquecfg.c index 3dcc643209..bbb2ab61d3 100644 --- a/src/lib/Libifl/torquecfg.c +++ b/src/lib/Libifl/torquecfg.c @@ -151,7 +151,7 @@ char *trq_get_if_name() return(NULL); } - ptr = get_trq_param(TRQ_IFNAME, torque_cfg_buf); + ptr = get_trq_param((char *)TRQ_IFNAME, torque_cfg_buf); if (ptr == NULL) { if (torque_cfg_buf) diff --git a/src/lib/Libifl/trq_auth.c b/src/lib/Libifl/trq_auth.c index 51250ca735..c447d5aa71 100644 --- a/src/lib/Libifl/trq_auth.c +++ b/src/lib/Libifl/trq_auth.c @@ -229,7 +229,7 @@ void *process_svr_conn( void *sock) { - char *className = "trqauthd"; + char *className = (char *)"trqauthd"; int rc = PBSE_NONE; char *server_name = NULL; int server_port = 0; diff --git a/src/lib/Liblog/chk_file_sec.c b/src/lib/Liblog/chk_file_sec.c index c0dc60c55e..6de0083583 100644 --- a/src/lib/Liblog/chk_file_sec.c +++ b/src/lib/Liblog/chk_file_sec.c @@ -403,13 +403,13 @@ int IamRoot() if (!load_netapi (hNetapi,hAdvapi)) { - log_err(-1, "IamRoot","Cann`t load netapi32.dll and advapi32.dll libraries\n"); + log_err(-1, "IamRoot", (char *)"Cann`t load netapi32.dll and advapi32.dll libraries\n"); return 0; } if (netgetdcname (NULL, NULL, (void *) &servername) != ERROR_SUCCESS) { - log_err(-1, "IamRoot","Cann`t get the name of the primary domain controller\n"); + log_err(-1, "IamRoot",(char *)"Cann`t get the name of the primary domain controller\n"); } uid=getuid(); @@ -419,14 +419,14 @@ int IamRoot() if ((p = getpwuid(uid))==NULL) { - log_err(-1, "IamRoot","WARNING!!! No password entry for currient user. Check your /etc/passwd file.\n"); + log_err(-1, "IamRoot", (char *)"WARNING!!! No password entry for currient user. Check your /etc/passwd file.\n"); return 0; } if (check_local_user_privileges(p->pw_name,0) || check_domain_user_privileges(servername,p->pw_name,0)) return 1; - log_err(-1, "IamRoot","WARNING!!! Must be run with Administrator privileges.\n"); + log_err(-1, "IamRoot", (char *)"WARNING!!! Must be run with Administrator privileges.\n"); return 0; } @@ -458,7 +458,7 @@ int IamUser() return 1; } - log_err(-1, "IamUser","WARNING!!! Check your /etc/group and /etc/passwd files.\n"); + log_err(-1, "IamUser", (char *)"WARNING!!! Check your /etc/group and /etc/passwd files.\n"); return 0; } /* END IamUser() */ @@ -481,11 +481,11 @@ int IamUserByName(char *userName) if (IamAdminByName(userName)) { sprintf(buff, "WARNING!!! Can`t run job with Administrator privileges. Your should limit preveleges for \"%s\"!",userName); - log_err(-1, "IamUserByName", buff); + log_err(-1, "IamUserByName", (char *)buff); return 0; } sprintf(buff, "WARNING!!! Can`t find user \"%s\"!",userName); - log_err(-1, "IamUserByName", buff); + log_err(-1, "IamUserByName", (char *)buff); return 0; } @@ -753,7 +753,7 @@ int chk_file_sec( if (rc != 0) { - if ((error_buf = calloc(1, LOG_BUF_SIZE)) == NULL) + if ((error_buf = (char *)calloc(1, LOG_BUF_SIZE)) == NULL) { if (chk_file_sec_stderr) { @@ -763,7 +763,7 @@ int chk_file_sec( } else { - log_err(rc, "chk_file_sec", "calloc failed"); + log_err(rc, "chk_file_sec", (char *)"calloc failed"); } } else diff --git a/src/lib/Liblog/pbs_log.c b/src/lib/Liblog/pbs_log.c index 5d981648d7..5c9213efb8 100644 --- a/src/lib/Liblog/pbs_log.c +++ b/src/lib/Liblog/pbs_log.c @@ -129,7 +129,7 @@ char job_log_directory[_POSIX_PATH_MAX/2]; char log_host[1024]; char log_suffix[1024]; -char *msg_daemonname = "unset"; +char *msg_daemonname = (char *)"unset"; /* Local Data */ @@ -158,15 +158,15 @@ pthread_mutex_t *job_log_mutex; */ static char *class_names[] = { - "n/a", - "Svr", - "Que", - "Job", - "Req", - "Fil", - "Act", - "node", - "trqauthd" + (char *)"n/a", + (char *)"Svr", + (char *)"Que", + (char *)"Job", + (char *)"Req", + (char *)"Fil", + (char *)"Act", + (char *)"node", + (char *)"trqauthd" }; /* External functions called */ @@ -296,10 +296,10 @@ int log_init( if (hostname != NULL) snprintf(log_host, sizeof(log_host), "%s", hostname); - log_mutex = calloc(1, sizeof(pthread_mutex_t)); + log_mutex = (pthread_mutex_t *)calloc(1, sizeof(pthread_mutex_t)); pthread_mutex_init(log_mutex, NULL); - job_log_mutex = calloc(1, sizeof(pthread_mutex_t)); + job_log_mutex = (pthread_mutex_t *)calloc(1, sizeof(pthread_mutex_t)); pthread_mutex_init(job_log_mutex, NULL); return(0); @@ -388,8 +388,8 @@ int log_open( log_record( PBSEVENT_SYSTEM, PBS_EVENTCLASS_SERVER, - "Log", - "Log opened"); + (char *)"Log", + (char *)"Log opened"); pthread_mutex_lock(log_mutex); @@ -412,14 +412,13 @@ int job_log_open( char *directory) /* normal log directory */ { - char id[] = "job_log_open"; char buf[_POSIX_PATH_MAX]; char err_log[256]; int fds; if (job_log_opened > 0) { - log_err(-1, id, "job log already open"); + log_err(-1, (char *)__func__, (char *)"job log already open"); return(1); /* already open */ } @@ -437,7 +436,7 @@ int job_log_open( else if (*filename != '/') { sprintf(err_log, "must use absolute file path: %s", filename); - log_err(-1, id, err_log); + log_err(-1, (char *)__func__, err_log); return(-1); /* must be absolute path */ } @@ -446,7 +445,7 @@ int job_log_open( job_log_opened = -1; /* note that open failed */ sprintf(err_log, "could not open %s ", filename); - log_err(errno, id, err_log); + log_err(errno, (char *)__func__, err_log); return(-1); } @@ -457,7 +456,7 @@ int job_log_open( if (job_log_opened < 0) { close(fds); - log_err(errno, id, "failed to dup job log file descriptor"); + log_err(errno, __func__, (char *)"failed to dup job log file descriptor"); return(-1); } @@ -710,7 +709,6 @@ const char *log_get_severity_string( /* record job information of completed job to job log */ int log_job_record(char *buf) { - char id[] = "log_job_record"; struct tm *ptm; struct tm tmpPtm; time_t now; @@ -729,7 +727,7 @@ int log_job_record(char *buf) if (job_log_opened < 1) { - log_err(-1, id, "job_log_opened < 1"); + log_err(-1, __func__, (char *)"job_log_opened < 1"); pthread_mutex_unlock(job_log_mutex); return(-1); } @@ -894,7 +892,7 @@ void log_record( if (logfile != NULL) { pthread_mutex_unlock(log_mutex); - log_err(rc, __func__, "PBS cannot write to its log"); + log_err(rc, __func__, (char *)"PBS cannot write to its log"); fclose(logfile); pthread_mutex_lock(log_mutex); } @@ -930,7 +928,7 @@ void log_close( PBSEVENT_SYSTEM, PBS_EVENTCLASS_SERVER, "Log", - "Log closed"); + (char *)"Log closed"); pthread_mutex_lock(log_mutex); } @@ -968,7 +966,7 @@ void job_log_close( PBSEVENT_SYSTEM, PBS_EVENTCLASS_SERVER, "Log", - "Log closed"); + (char *)"Log closed"); } fclose(joblogfile); @@ -1199,7 +1197,7 @@ void log_roll( if (err != 0) { - log_err(err, "log_roll", "error while rollng logs"); + log_err(err, "log_roll", (char *)"error while rollng logs"); } else { @@ -1207,7 +1205,7 @@ void log_roll( PBSEVENT_SYSTEM, PBS_EVENTCLASS_SERVER, "Log", - "Log Rolled"); + (char *)"Log Rolled"); } return; @@ -1320,7 +1318,7 @@ void job_log_roll( if (err != 0) { - log_err(err, "log_roll", "error while rollng logs"); + log_err(err, "log_roll", (char *)"error while rollng logs"); } else { @@ -1328,7 +1326,7 @@ void job_log_roll( PBSEVENT_SYSTEM, PBS_EVENTCLASS_SERVER, "Job Log", - "Job Log Rolled"); + (char *)"Job Log Rolled"); } pthread_mutex_unlock(job_log_mutex); @@ -1367,14 +1365,14 @@ long log_size(void) pthread_mutex_unlock(log_mutex); /* log_err through log_ext will lock the log_mutex, so release log_mutex before calling log_err */ - log_err(errno, "log_size", "PBS cannot fstat logfile"); + log_err(errno, "log_size", (char *)"PBS cannot fstat logfile"); return(0); } if (!log_opened) { pthread_mutex_unlock(log_mutex); - log_err(EAGAIN, "log_size", "PBS cannot find size of log file because logfile has not been opened"); + log_err(EAGAIN, "log_size", (char *)"PBS cannot find size of log file because logfile has not been opened"); return(0); } @@ -1408,7 +1406,7 @@ long job_log_size(void) { /* FAILURE */ - log_err(errno, __func__, "PBS cannot fstat joblogfile"); + log_err(errno, __func__, (char *)"PBS cannot fstat joblogfile"); pthread_mutex_unlock(job_log_mutex); return(0); diff --git a/src/lib/Liblog/pbs_messages.c b/src/lib/Liblog/pbs_messages.c index e29c4d9c15..25e0226af2 100644 --- a/src/lib/Liblog/pbs_messages.c +++ b/src/lib/Liblog/pbs_messages.c @@ -93,85 +93,85 @@ * This first set of messages are recorded by the server or mom to the log. */ -char *msg_abt_err = "Unable to abort Job %s which was in substate %d"; -char *msg_badexit = "Abnormal exit status 0x%x: "; -char *msg_badwait = "Invalid time in work task for waiting, job = %s"; -char *msg_deletejob = "Job deleted"; -char *msg_delrunjobsig = "Job sent signal %s on delete"; -char *msg_err_malloc = "malloc failed"; -char *msg_err_noqueue = "Unable to requeue job, queue is not defined"; -char *msg_err_purgejob = "Unlink of job file failed"; -char *msg_err_unlink = "Unlink of %s file %s failed"; -char *msg_illregister = "Illegal op in register request received for job %s"; -char *msg_info_server = "Torque Server Version = %s, loglevel = %d"; -char *msg_info_mom = "Torque Mom Version = %s, loglevel = %d"; -char *msg_init_abt = "Job aborted on PBS Server initialization"; -char *msg_init_baddb = "Unable to read server database"; -char *msg_init_badjob = "Recover of job %s failed"; -char *msg_init_chdir = "unable to change to directory %s"; -char *msg_init_expctq = "Expected %d, recovered %d queues"; -char *msg_init_exptjobs = "Expected %d, recovered %d jobs"; -char *msg_init_nojobs = "No jobs to open"; -char *msg_init_noqueues = "No queues to open"; -char *msg_init_norerun = "Unable to rerun job at Server initialization"; -char *msg_init_queued = "Requeued in queue: "; -char *msg_init_recovque = "Recovered queue %s"; -char *msg_init_substate = "Requeueing job, substate: %d "; -char *msg_init_unkstate = "Unable to recover job in strange substate: %d"; -char *msg_isodedecode = "Decode of request failed"; -char *msg_issuebad = "attempt to issue invalid request of type %d"; -char *msg_job_abort = "Aborted by PBS Server "; -char *msg_job_del = "job deleted"; -char *msg_jobholdset = "Holds %s set at request of %s@%s"; -char *msg_jobholdrel = "Holds %s released at request of %s@%s"; -char *msg_job_end = "Execution terminated"; -char *msg_job_end_stat = "Exit_status=%d"; -char *msg_job_end_sig = "Terminated on signal %d"; -char *msg_jobmod = "Job Modified"; -char *msg_jobnew = "Job Queued at request of %s@%s, owner = %s, job name = %s, queue = %s"; -char *msg_jobrerun = "Job Rerun"; -char *msg_jobrun = "Job Run"; -char *msg_job_start = "Begun execution"; -char *msg_job_stageinfail = "File stage in failed, see below.\nJob will be retried later, please investigate and correct problem."; -char *msg_job_copychkptfail = "Checkpoint file copy failed, see below.\nJob will be retried later, please investigate and correct problem."; -char *msg_job_otherfail = "An error has occurred processing your job, see below."; -char *msg_leftrunning = "job running on at Server shutdown"; -char *msg_manager = "%s at request of %s@%s"; -char *msg_man_cre = "created"; -char *msg_man_del = "deleted"; -char *msg_man_set = "attributes set: "; -char *msg_man_uns = "attributes unset: "; -char *msg_messagejob = "Message request to job status %d"; -char *msg_mombadhold = "MOM rejected hold request: %d"; -char *msg_mombadmodify = "MOM rejected modify request, error: %d"; -char *msg_momsetlim = "Job start failed. Can't set \"%s\" limit: %s.\n"; -char *msg_momnoexec1 = "Job cannot be executed\nSee Administrator for help"; -char *msg_momnoexec2 = "Job cannot be executed\nSee job standard error file"; -char *msg_momjoboverlimit = "Job exceeded some resource limit (walltime, mem, etc.). Job was aborted\nSee Administrator for help"; -char *msg_movejob = "Job moved to "; -char *msg_norelytomom = "Server could not connect to MOM"; -char *msg_obitnojob = "Job Obit notice received from %s has error %d"; -char *msg_obitnocpy = "Post job file processing error; job %s on host %s"; -char *msg_obitnodel = "Unable to delete files for job %s, on host %s"; -char *msg_on_shutdown = " on Server shutdown"; -char *msg_orighost = "Job missing PBS_O_HOST value"; -char *msg_permlog = "Unauthorized Request, request type: %d, Object: %s, Name: %s, request from: %s@%s"; -char *msg_postmomnojob = "Job not found after hold reply from MOM"; -char *msg_request = "Type %s request received from %s@%s, sock=%d"; -char *msg_regrej = "Dependency request for job rejected by "; -char *msg_registerdel = "Job deleted as result of dependency on job %s"; -char *msg_registerrel = "Dependency on job %s released."; -char *msg_routexceed = "Route queue lifetime exceeded"; -char *msg_script_open = "Unable to open script file"; -char *msg_script_write = "Unable to write script file"; -char *msg_shutdown_op = "Shutdown request from %s@%s "; -char *msg_shutdown_start = "Starting to shutdown the server, type is "; -char *msg_startup1 = "Server %s started, initialization type = %d"; -char *msg_startup2 = "Server Ready, pid = %d, loglevel=%d"; -char *msg_startup3 = "%s %s: %s mode and %s exist, \ndo you wish to continue y/(n)?"; -char *msg_svdbopen = "Unable to open server data base"; -char *msg_svdbnosv = "Unable to save server data base"; -char *msg_svrdown = "Server shutdown completed"; +char *msg_abt_err = (char *)"Unable to abort Job %s which was in substate %d"; +char *msg_badexit = (char *)"Abnormal exit status 0x%x: "; +char *msg_badwait = (char *)"Invalid time in work task for waiting, job = %s"; +char *msg_deletejob = (char *)"Job deleted"; +char *msg_delrunjobsig = (char *)"Job sent signal %s on delete"; +char *msg_err_malloc = (char *)"malloc failed"; +char *msg_err_noqueue = (char *)"Unable to requeue job, queue is not defined"; +char *msg_err_purgejob = (char *)"Unlink of job file failed"; +char *msg_err_unlink = (char *)"Unlink of %s file %s failed"; +char *msg_illregister = (char *)"Illegal op in register request received for job %s"; +char *msg_info_server = (char *)"Torque Server Version = %s, loglevel = %d"; +char *msg_info_mom = (char *)"Torque Mom Version = %s, loglevel = %d"; +char *msg_init_abt = (char *)"Job aborted on PBS Server initialization"; +char *msg_init_baddb = (char *)"Unable to read server database"; +char *msg_init_badjob = (char *)"Recover of job %s failed"; +char *msg_init_chdir = (char *)"unable to change to directory %s"; +char *msg_init_expctq = (char *)"Expected %d, recovered %d queues"; +char *msg_init_exptjobs = (char *)"Expected %d, recovered %d jobs"; +char *msg_init_nojobs = (char *)"No jobs to open"; +char *msg_init_noqueues = (char *)"No queues to open"; +char *msg_init_norerun = (char *)"Unable to rerun job at Server initialization"; +char *msg_init_queued = (char *)"Requeued in queue: "; +char *msg_init_recovque = (char *)"Recovered queue %s"; +char *msg_init_substate = (char *)"Requeueing job, substate: %d "; +char *msg_init_unkstate = (char *)"Unable to recover job in strange substate: %d"; +char *msg_isodedecode = (char *)"Decode of request failed"; +char *msg_issuebad = (char *)"attempt to issue invalid request of type %d"; +char *msg_job_abort = (char *)"Aborted by PBS Server "; +char *msg_job_del = (char *)"job deleted"; +char *msg_jobholdset = (char *)"Holds %s set at request of %s@%s"; +char *msg_jobholdrel = (char *)"Holds %s released at request of %s@%s"; +char *msg_job_end = (char *)"Execution terminated"; +char *msg_job_end_stat = (char *)"Exit_status=%d"; +char *msg_job_end_sig = (char *)"Terminated on signal %d"; +char *msg_jobmod = (char *)"Job Modified"; +char *msg_jobnew = (char *)"Job Queued at request of %s@%s, owner = %s, job name = %s, queue = %s"; +char *msg_jobrerun = (char *)"Job Rerun"; +char *msg_jobrun = (char *)"Job Run"; +char *msg_job_start = (char *)"Begun execution"; +char *msg_job_stageinfail = (char *)"File stage in failed, see below.\nJob will be retried later, please investigate and correct problem."; +char *msg_job_copychkptfail = (char *)"Checkpoint file copy failed, see below.\nJob will be retried later, please investigate and correct problem."; +char *msg_job_otherfail = (char *)"An error has occurred processing your job, see below."; +char *msg_leftrunning = (char *)"job running on at Server shutdown"; +char *msg_manager = (char *)"%s at request of %s@%s"; +char *msg_man_cre = (char *)"created"; +char *msg_man_del = (char *)"deleted"; +char *msg_man_set = (char *)"attributes set: "; +char *msg_man_uns = (char *)"attributes unset: "; +char *msg_messagejob = (char *)"Message request to job status %d"; +char *msg_mombadhold = (char *)"MOM rejected hold request: %d"; +char *msg_mombadmodify = (char *)"MOM rejected modify request, error: %d"; +char *msg_momsetlim = (char *)"Job start failed. Can't set \"%s\" limit: %s.\n"; +char *msg_momnoexec1 = (char *)"Job cannot be executed\nSee Administrator for help"; +char *msg_momnoexec2 = (char *)"Job cannot be executed\nSee job standard error file"; +char *msg_momjoboverlimit = (char *)"Job exceeded some resource limit (walltime, mem, etc.). Job was aborted\nSee Administrator for help"; +char *msg_movejob = (char *)"Job moved to "; +char *msg_norelytomom = (char *)"Server could not connect to MOM"; +char *msg_obitnojob = (char *)"Job Obit notice received from %s has error %d"; +char *msg_obitnocpy = (char *)"Post job file processing error; job %s on host %s"; +char *msg_obitnodel = (char *)"Unable to delete files for job %s, on host %s"; +char *msg_on_shutdown = (char *)" on Server shutdown"; +char *msg_orighost = (char *)"Job missing PBS_O_HOST value"; +char *msg_permlog = (char *)"Unauthorized Request, request type: %d, Object: %s, Name: %s, request from: %s@%s"; +char *msg_postmomnojob = (char *)"Job not found after hold reply from MOM"; +char *msg_request = (char *)"Type %s request received from %s@%s, sock=%d"; +char *msg_regrej = (char *)"Dependency request for job rejected by "; +char *msg_registerdel = (char *)"Job deleted as result of dependency on job %s"; +char *msg_registerrel = (char *)"Dependency on job %s released."; +char *msg_routexceed = (char *)"Route queue lifetime exceeded"; +char *msg_script_open = (char *)"Unable to open script file"; +char *msg_script_write = (char *)"Unable to write script file"; +char *msg_shutdown_op = (char *)"Shutdown request from %s@%s "; +char *msg_shutdown_start = (char *)"Starting to shutdown the server, type is "; +char *msg_startup1 = (char *)"Server %s started, initialization type = %d"; +char *msg_startup2 = (char *)"Server Ready, pid = %d, loglevel=%d"; +char *msg_startup3 = (char *)"%s %s: %s mode and %s exist, \ndo you wish to continue y/(n)?"; +char *msg_svdbopen = (char *)"Unable to open server data base"; +char *msg_svdbnosv = (char *)"Unable to save server data base"; +char *msg_svrdown = (char *)"Server shutdown completed"; /* This construct pulls the text parts from the batch types definitions * @@ -188,12 +188,12 @@ static const char *PBatchReqType[] = #define NPBatchReqType (sizeof(PBatchReqType)/sizeof(PBatchReqType[0])) /* used by server/req_manager.c */ -char *msg_attrtype = "Warning: type of queue %s incompatible with attribute %s"; +char *msg_attrtype = (char *)"Warning: type of queue %s incompatible with attribute %s"; /* used by server/run_sched.c */ -char *msg_sched_called = "Scheduler was sent the command %s"; -char *msg_sched_nocall = "Could not contact Scheduler"; -char *msg_listnr_called = "Listener %d sent event %s"; -char *msg_listnr_nocall = "Could not contact Listener"; +char *msg_sched_called = (char *)"Scheduler was sent the command %s"; +char *msg_sched_nocall = (char *)"Could not contact Scheduler"; +char *msg_listnr_called = (char *)"Listener %d sent event %s"; +char *msg_listnr_nocall = (char *)"Could not contact Listener"; /* pbs_err_db generators * diff --git a/src/lib/Liblog/setup_env.c b/src/lib/Liblog/setup_env.c index cbc86ce175..ba1ab7fd07 100644 --- a/src/lib/Liblog/setup_env.c +++ b/src/lib/Liblog/setup_env.c @@ -150,7 +150,7 @@ int setup_env( if (evbufsize < len) { - if ((envbuf = calloc(1, PBS_ENV_CHUNCK)) == NULL) + if ((envbuf = (char *)calloc(1, PBS_ENV_CHUNCK)) == NULL) { fclose(efile); @@ -223,7 +223,7 @@ int setup_env( err: - log_err(-1, "setup_env", "could not set up the environment"); + log_err(-1, "setup_env", (char *)"could not set up the environment"); return(-1); } /* END setup_env() */ diff --git a/src/lib/Libnet/conn_table.c b/src/lib/Libnet/conn_table.c index 71e2be79ac..3b932c9ac1 100644 --- a/src/lib/Libnet/conn_table.c +++ b/src/lib/Libnet/conn_table.c @@ -31,7 +31,7 @@ int get_connection_entry( lock_conn_table(); if (connection[pos].ch_mutex == NULL) { - if ((tmp_mut = calloc(1, sizeof(pthread_mutex_t))) == NULL) + if ((tmp_mut = (pthread_mutex_t *)calloc(1, sizeof(pthread_mutex_t))) == NULL) rc = PBSE_MEM_MALLOC; else { diff --git a/src/lib/Libnet/get_hostaddr.c b/src/lib/Libnet/get_hostaddr.c index ee781ce192..9461544af8 100644 --- a/src/lib/Libnet/get_hostaddr.c +++ b/src/lib/Libnet/get_hostaddr.c @@ -97,13 +97,52 @@ #include "../Liblog/log_event.h" #if !defined(H_ERRNO_DECLARED) && !defined(_AIX) -extern int h_errno; +/*extern int h_errno;*/ #endif #ifdef _AIX extern const char *hstrerror(int); #endif +/* + ** Put a human readable representation of a network addres passed + ** in as a long and return a staticly allocated string. + */ +char * netaddr_long(long ap, char *out) + { + u_long ipadd; + + ipadd = ap; + + sprintf(out, "%ld.%ld.%ld.%ld", + (ipadd & 0xff000000) >> 24, + (ipadd & 0x00ff0000) >> 16, + (ipadd & 0x0000ff00) >> 8, + (ipadd & 0x000000ff)); + + return out; + } + +/* + ** Put a human readable representation of a network addres into + ** a staticly allocated string. + */ +char * netaddr(struct sockaddr_in *ap) + { + static char out[80]; + char tmp[80]; + + if (ap == NULL) + return "unknown"; + + netaddr_long( ntohl(ap->sin_addr.s_addr), tmp); + + sprintf(out, "%s:%d", tmp, ntohs(ap->sin_port)); + + return out; + } + + /* * get_hostaddr.c - contains functions to provide the internal * internet address for a host and to provide the port diff --git a/src/lib/Libnet/net_cache.c b/src/lib/Libnet/net_cache.c index f3a9aacea1..919bbaef59 100644 --- a/src/lib/Libnet/net_cache.c +++ b/src/lib/Libnet/net_cache.c @@ -110,7 +110,7 @@ void initialize_network_info() cache.nc_namekey = create_hash(INITIAL_HASH_SIZE); cache.nc_saikey = create_hash(INITIAL_HASH_SIZE); - cache.nc_mutex = calloc(1, sizeof(pthread_mutex_t)); + cache.nc_mutex = (pthread_mutex_t *)calloc(1, sizeof(pthread_mutex_t)); pthread_mutex_init(cache.nc_mutex, NULL); } /* END initialize_network_info() */ @@ -227,7 +227,7 @@ network_info *get_network_info_holder( { /* initialize the network info holder */ - network_info *ni = calloc(1, sizeof(network_info)); + network_info *ni = (network_info *)calloc(1, sizeof(network_info)); ni->hostname = strdup(hostname); diff --git a/src/lib/Libnet/net_common.c b/src/lib/Libnet/net_common.c index 274fe46a08..e0f4a07953 100644 --- a/src/lib/Libnet/net_common.c +++ b/src/lib/Libnet/net_common.c @@ -298,7 +298,7 @@ int socket_connect( int socket_connect_addr( - int *local_socket, + int *socket, struct sockaddr *remote, size_t remote_size, int is_privileged, @@ -309,19 +309,20 @@ int socket_connect_addr( int rc = PBSE_NONE; char tmp_buf[LOCAL_LOG_BUF_SIZE+1]; const char id[] = "socket_connect_addr"; + int local_socket = *socket; - while ((rc = connect(*local_socket, remote, remote_size)) != 0) + while (((rc = connect(local_socket, remote, remote_size)) != 0) && (cntr < RES_PORT_RETRY)) { + cntr++; /* fprintf(stdout, "rc != 0 (%d)-(%d) (port_number=%d)\n", rc, errno, *local_socket); */ switch (errno) { case ECONNREFUSED: /* Connection refused */ - snprintf(tmp_buf, LOCAL_LOG_BUF_SIZE, "cannot connect to port %d in %s - connection refused", *local_socket, id); + snprintf(tmp_buf, LOCAL_LOG_BUF_SIZE, "cannot connect to port %d in %s - connection refused", local_socket, id); *error_msg = strdup(tmp_buf); rc = PBS_NET_RC_RETRY; - close(*local_socket); - *local_socket = -1; - cntr = 0; + close(local_socket); + local_socket = -1; break; case EINPROGRESS: /* Operation now in progress */ @@ -330,7 +331,7 @@ int socket_connect_addr( case ETIMEDOUT: /* Connection timed out */ case EAGAIN: /* Operation would block */ case EINTR: /* Interrupted system call */ - if ((rc = socket_wait_for_write(*local_socket)) == PBSE_NONE) + if ((rc = socket_wait_for_write(local_socket)) == PBSE_NONE) { /* no network failures detected, socket available */ break; @@ -344,10 +345,10 @@ int socket_connect_addr( rc = PBSE_SOCKET_FAULT; /* 3 connect attempts are made to each socket */ /* Fail on RES_PORT_RETRY */ - if (cntr++ < RES_PORT_RETRY) + if (cntr < RES_PORT_RETRY) { - close(*local_socket); - if ((*local_socket = socket_get_tcp_priv()) < 0) + close(local_socket); + if ((local_socket = socket_get_tcp_priv()) < 0) rc = PBSE_SOCKET_FAULT; else { @@ -357,26 +358,23 @@ int socket_connect_addr( } else { - close(*local_socket); - *local_socket = -1; - /* Hit RES_PORT_RETRY, exit */ - cntr = 0; + close(local_socket); + local_socket = -1; } } break; default: - snprintf(tmp_buf, LOCAL_LOG_BUF_SIZE, "cannot connect to port %d in %s - errno:%d %s", *local_socket, id, errno, strerror(errno)); + snprintf(tmp_buf, LOCAL_LOG_BUF_SIZE, "cannot connect to port %d in %s - errno:%d %s", local_socket, id, errno, strerror(errno)); *error_msg = strdup(tmp_buf); - close(*local_socket); + close(local_socket); rc = PBSE_SOCKET_FAULT; - cntr = 0; - *local_socket = -1; + local_socket = -1; break; } - if (cntr == 0) - break; } + if (rc == PBSE_NONE) + *socket = local_socket; return rc; } /* END socket_connect() */ @@ -625,7 +623,7 @@ int socket_read( if (rc != PBSE_NONE) { } - else if ((*the_str = calloc(1, avail_bytes+1)) == NULL) + else if ((*the_str = (char *)calloc(1, avail_bytes+1)) == NULL) { rc = PBSE_MEM_MALLOC; } diff --git a/src/lib/Libnet/net_server.c b/src/lib/Libnet/net_server.c index 9da7ef3361..2c9c210fee 100644 --- a/src/lib/Libnet/net_server.c +++ b/src/lib/Libnet/net_server.c @@ -133,7 +133,7 @@ extern char local_host_name[]; void initialize_connections_table(); -extern time_t time(time_t *); +/*extern time_t time(time_t *);*/ struct in_addr net_serveraddr; char *net_server_name = NULL; char pbs_server_name[PBS_MAXSERVERNAME + 1]; @@ -339,10 +339,10 @@ int init_network( /* initialize global "read" socket FD bitmap */ GlobalSocketReadSet = (fd_set *)calloc(1,sizeof(char) * get_fdset_size()); - global_sock_read_mutex = calloc(1, sizeof(pthread_mutex_t)); + global_sock_read_mutex = (pthread_mutex_t *)calloc(1, sizeof(pthread_mutex_t)); pthread_mutex_init(global_sock_read_mutex,&t_attr); - num_connections_mutex = calloc(1, sizeof(pthread_mutex_t)); + num_connections_mutex = (pthread_mutex_t *)calloc(1, sizeof(pthread_mutex_t)); pthread_mutex_init(num_connections_mutex,&t_attr); type = Primary; @@ -461,7 +461,7 @@ int init_network( /* allocate a minute's worth of counter structs */ if (nc_list_mutex == NULL) { - nc_list_mutex = calloc(1, sizeof(pthread_mutex_t)); + nc_list_mutex = (pthread_mutex_t *)calloc(1, sizeof(pthread_mutex_t)); pthread_mutex_init(nc_list_mutex,NULL); pthread_mutex_lock(nc_list_mutex); @@ -618,7 +618,7 @@ int wait_request( free(SelectSet); - log_err(errno, __func__, "Unable to select sockets to read requests"); + log_err(errno, __func__, (char *)"Unable to select sockets to read requests"); return(-1); } /* END else (errno == EINTR) */ @@ -1029,7 +1029,7 @@ void close_conn( svr_conn[sd].cn_addr = 0; svr_conn[sd].cn_handle = -1; svr_conn[sd].cn_active = Idle; - svr_conn[sd].cn_func = (void *(*)())0; + svr_conn[sd].cn_func = (void *(*)(void *))0; svr_conn[sd].cn_authen = 0; svr_conn[sd].cn_stay_open = FALSE; @@ -1222,7 +1222,7 @@ char *netaddr_pbs_net_t( char *return_value; if (ipadd == 0) - return "unknown"; + return (char *)"unknown"; sprintf(out, "%ld.%ld.%ld.%ld", (ipadd & 0xff000000) >> 24, @@ -1230,7 +1230,7 @@ char *netaddr_pbs_net_t( (ipadd & 0x0000ff00) >> 8, (ipadd & 0x000000ff)); - return_value = calloc(1, strlen(out) + 1); + return_value = (char *)calloc(1, strlen(out) + 1); strcpy(return_value,out); return(return_value); diff --git a/src/lib/Libnet/rm.c b/src/lib/Libnet/rm.c index cabba4e8b9..e6b7acff27 100644 --- a/src/lib/Libnet/rm.c +++ b/src/lib/Libnet/rm.c @@ -190,7 +190,7 @@ int openrm( { if (gotport == 0) { - gotport = get_svrport(PBS_MANAGER_SERVICE_NAME, "tcp", + gotport = get_svrport((char *)PBS_MANAGER_SERVICE_NAME, (char *)"tcp", PBS_MANAGER_SERVICE_PORT); } /* END if (gotport == 0) */ diff --git a/src/lib/Libnet/server_core.c b/src/lib/Libnet/server_core.c index 0f3af256e7..279a7da387 100644 --- a/src/lib/Libnet/server_core.c +++ b/src/lib/Libnet/server_core.c @@ -137,7 +137,7 @@ int start_listener( } pthread_attr_destroy(&t_attr); log_event(PBSEVENT_JOB, PBS_EVENTCLASS_JOB, "net_srvr", - "Socket close of network listener requested"); + (char *)"Socket close of network listener requested"); } close(listen_socket); @@ -271,7 +271,7 @@ int start_listener_addrinfo( } pthread_attr_destroy(&t_attr); log_event(PBSEVENT_JOB, PBS_EVENTCLASS_JOB, "net_srvr", - "Socket close of network listener requested"); + (char *)"Socket close of network listener requested"); } close(listen_socket); diff --git a/src/lib/Libpbs/Makefile.am b/src/lib/Libpbs/Makefile.am index 2254f61826..7e6b00fcb4 100644 --- a/src/lib/Libpbs/Makefile.am +++ b/src/lib/Libpbs/Makefile.am @@ -71,7 +71,7 @@ libtorque_la_SOURCES = ../Libcsv/csv.c ../Libdis/dis.c \ ../Libifl/pbsD_submit.c ../Libifl/PBSD_submit_caps.c \ ../Libifl/pbsD_submit_hash.c \ ../Libifl/pbsD_termin.c ../Libifl/pbs_geterrmg.c \ - ../Libifl/pbs_statfree.c ../Libifl/rpp.c \ + ../Libifl/pbs_statfree.c \ ../Libifl/tcp_dis.c ../Libifl/tm.c ../Libifl/list_link.c \ ../Libifl/trq_auth.c ../Libifl/torquecfg.c \ ../Libcmds/ck_job_name.c ../Libcmds/cnt2server.c \ diff --git a/src/lib/Libutils/u_MXML.c b/src/lib/Libutils/u_MXML.c index 2f9a8eadc6..05c83fbbc1 100644 --- a/src/lib/Libutils/u_MXML.c +++ b/src/lib/Libutils/u_MXML.c @@ -449,7 +449,7 @@ int MXMLAppendAttr( len = strlen(E->AVal[ATok]) + strlen(AVal) + 2; - tmpAVal = realloc( + tmpAVal = (char *)realloc( E->AVal[ATok], len); diff --git a/src/lib/Libutils/u_dynamic_string.c b/src/lib/Libutils/u_dynamic_string.c index 41610054b3..8b6b647796 100644 --- a/src/lib/Libutils/u_dynamic_string.c +++ b/src/lib/Libutils/u_dynamic_string.c @@ -134,7 +134,7 @@ int resize_if_needed( /* need to resize */ difference = new_size - ds->size; - if ((tmp = realloc(ds->str, new_size)) == NULL) + if ((tmp = (char *)realloc(ds->str, new_size)) == NULL) return(ENOMEM); ds->str = tmp; @@ -351,7 +351,7 @@ dynamic_string *get_dynamic_string( const char *str) /* I (optional) */ { - dynamic_string *ds = calloc(1, sizeof(dynamic_string)); + dynamic_string *ds = (dynamic_string *)calloc(1, sizeof(dynamic_string)); if (ds == NULL) return(ds); @@ -361,7 +361,7 @@ dynamic_string *get_dynamic_string( else ds->size = DS_INITIAL_SIZE; - ds->str = calloc(1, ds->size); + ds->str = (char *)calloc(1, ds->size); if (ds->str == NULL) { diff --git a/src/lib/Libutils/u_hash_map.c b/src/lib/Libutils/u_hash_map.c index 9fcb1961c1..327f086d55 100644 --- a/src/lib/Libutils/u_hash_map.c +++ b/src/lib/Libutils/u_hash_map.c @@ -104,7 +104,7 @@ hash_map *get_hash_map( int size_param) { - hash_map *hm = calloc(1, sizeof(hash_map)); + hash_map *hm = (hash_map *)calloc(1, sizeof(hash_map)); int size; if (size_param == -1) @@ -115,7 +115,7 @@ hash_map *get_hash_map( hm->hm_ra = initialize_resizable_array(size); hm->hm_ht = create_hash(size); - hm->hm_mutex = calloc(1, sizeof(pthread_mutex_t)); + hm->hm_mutex = (pthread_mutex_t *)calloc(1, sizeof(pthread_mutex_t)); pthread_mutex_init(hm->hm_mutex, NULL); return(hm); @@ -182,7 +182,7 @@ int add_to_hash_map( if ((index = insert_thing(hm->hm_ra, obj)) == -1) { rc = ENOMEM; - log_err(rc, __func__, "Memory failure"); + log_err(rc, __func__, (char *)"Memory failure"); } else add_hash(hm->hm_ht, index, key); diff --git a/src/lib/Libutils/u_hash_map_structs.c b/src/lib/Libutils/u_hash_map_structs.c index f06f40d584..ecc3a67ac4 100644 --- a/src/lib/Libutils/u_hash_map_structs.c +++ b/src/lib/Libutils/u_hash_map_structs.c @@ -300,7 +300,7 @@ int hash_add_hash( { int cntr = 0; job_data *en, *tmp; - for (en=src; en != NULL; en=en->hh.next) + for (en=src; en != NULL; en=(job_data *)en->hh.next) { if (overwrite_existing) { @@ -322,7 +322,7 @@ int hash_strlen( { int len = 0; job_data *en; - for (en=src; en != NULL; en=en->hh.next) + for (en=src; en != NULL; en=(job_data *)en->hh.next) { len += strlen(en->name); if (en->value != NULL) diff --git a/src/lib/Libutils/u_hash_table.c b/src/lib/Libutils/u_hash_table.c index 19c5e9100f..34f81ba4b1 100644 --- a/src/lib/Libutils/u_hash_table.c +++ b/src/lib/Libutils/u_hash_table.c @@ -604,12 +604,12 @@ hash_table_t *create_hash( int size) { - hash_table_t *ht = calloc(1, sizeof(hash_table_t)); + hash_table_t *ht = (hash_table_t *)calloc(1, sizeof(hash_table_t)); size_t amount = sizeof(bucket *) * size; ht->size = size; ht->num = 0; - ht->buckets = calloc(1, amount); + ht->buckets = (bucket **)calloc(1, amount); return(ht); } /* END create_hash() */ @@ -703,7 +703,7 @@ int get_hash( if (key == NULL) return(-1); - len = strlen(key); + len = strlen((char *)key); counter = ht->size >> 1; #ifdef HASH_LITTLE_ENDIAN @@ -734,9 +734,9 @@ void add_to_bucket( if (buckets[index] == NULL) { /* empty bucket, just add it here */ - buckets[index] = calloc(1, sizeof(bucket)); + buckets[index] = (bucket *)calloc(1, sizeof(bucket)); buckets[index]->value = value; - buckets[index]->key = key; + buckets[index]->key = (char *)key; buckets[index]->next = NULL; } else @@ -747,9 +747,9 @@ void add_to_bucket( while (b->next != NULL) b = b->next; - b->next = calloc(1, sizeof(bucket)); + b->next = (bucket *)calloc(1, sizeof(bucket)); b->next->value = value; - b->next->key = key; + b->next->key = (char *)key; b->next->next = NULL; } } /* END add_to_bucket() */ @@ -773,7 +773,7 @@ int add_hash( int old_bucket_size = ht->size; int new_bucket_size = ht->size * 2; size_t amount = new_bucket_size * sizeof(bucket *); - bucket **tmp = calloc(1, amount); + bucket **tmp = (bucket **)calloc(1, amount); int i; int new_index; @@ -894,7 +894,7 @@ int get_value_hash( b = ht->buckets[hash_index]; while (b != NULL) { - if (!strcmp(b->key, key)) + if (!strcmp(b->key, (char *)key)) { value = b->value; break; diff --git a/src/lib/Libutils/u_lock_ctl.c b/src/lib/Libutils/u_lock_ctl.c index f9300b68e8..ad2c04572f 100644 --- a/src/lib/Libutils/u_lock_ctl.c +++ b/src/lib/Libutils/u_lock_ctl.c @@ -84,7 +84,7 @@ int lock_startup() { if (pthread_mutex_lock(locks->startup) != 0) { - log_err(-1,"mutex_lock","ALERT: cannot lock startup mutex!\n"); + log_err(-1,"mutex_lock",(char *)"ALERT: cannot lock startup mutex!\n"); return(PBSE_MUTEX); } } @@ -101,7 +101,7 @@ int unlock_startup() { if (pthread_mutex_unlock(locks->startup) != 0) { - log_err(-1,"mutex_unlock","ALERT: cannot unlock startup mutex!\n"); + log_err(-1,"mutex_unlock",(char *)"ALERT: cannot unlock startup mutex!\n"); return(PBSE_MUTEX); } @@ -124,7 +124,7 @@ int lock_conn_table() if (pthread_mutex_lock(locks->conn_table) != 0) { - log_err(-1,"mutex_lock","ALERT: cannot lock conn_table mutex!\n"); + log_err(-1,"mutex_lock",(char *)"ALERT: cannot lock conn_table mutex!\n"); return(PBSE_MUTEX); } } @@ -140,7 +140,7 @@ int unlock_conn_table() { if (pthread_mutex_unlock(locks->conn_table) != 0) { - log_err(-1, "mutex_unlock", "ALERT: cannot unlock conn_table mutex!\n"); + log_err(-1, "mutex_unlock", (char *)"ALERT: cannot unlock conn_table mutex!\n"); return(PBSE_MUTEX); } @@ -162,7 +162,7 @@ int lock_ss() if (pthread_mutex_lock(locks->setup_save) != 0) { - log_err(-1,"mutex_lock","ALERT: cannot lock setup_save mutex!\n"); + log_err(-1,"mutex_lock",(char *)"ALERT: cannot lock setup_save mutex!\n"); return(PBSE_MUTEX); } } @@ -178,7 +178,7 @@ int unlock_ss() { if (pthread_mutex_unlock(locks->setup_save) != 0) { - log_err(-1,"mutex_unlock","ALERT: cannot unlock setup_save mutex!\n"); + log_err(-1,"mutex_unlock",(char *)"ALERT: cannot unlock setup_save mutex!\n"); return(PBSE_MUTEX); } diff --git a/src/lib/Libutils/u_memmgr.c b/src/lib/Libutils/u_memmgr.c index 0f421e8f0c..bc34c25a2e 100644 --- a/src/lib/Libutils/u_memmgr.c +++ b/src/lib/Libutils/u_memmgr.c @@ -37,7 +37,7 @@ int memmgr_init(memmgr **mgr, int mgr_size) mm->alloc_size = MEMMGR_DEFAULT_SIZE; else mm->alloc_size = mgr_size; - mm->the_mem = calloc_track(1, mm->alloc_size); + mm->the_mem = (unsigned char *)calloc_track(1, mm->alloc_size); if (mm->the_mem == NULL) rc = -2; else @@ -252,7 +252,7 @@ void *memmgr_realloc(memmgr **mgr, void *ptr, int new_size) /* as it's the only thing, realloc the current block */ if ((tmp = realloc(mm->the_mem, new_alloc)) != NULL) { - mm->the_mem = tmp; + mm->the_mem = (unsigned char *)tmp; memset(mm->the_mem + mm->alloc_size, 0, new_alloc - mm->alloc_size); res_mem = mm->the_mem + sizeof(int); mm->alloc_size = new_alloc; diff --git a/src/lib/Libutils/u_mom_hierarchy.c b/src/lib/Libutils/u_mom_hierarchy.c index cdcb634a97..0a2203112f 100644 --- a/src/lib/Libutils/u_mom_hierarchy.c +++ b/src/lib/Libutils/u_mom_hierarchy.c @@ -146,7 +146,7 @@ void free_mom_hierarchy( mom_hierarchy_t *initialize_mom_hierarchy() { - mom_hierarchy_t *nt = calloc(1, sizeof(mom_hierarchy_t)); + mom_hierarchy_t *nt = (mom_hierarchy_t *)calloc(1, sizeof(mom_hierarchy_t)); nt->paths = initialize_resizable_array(INITIAL_SIZE_NETWORK); if (nt->paths == NULL) @@ -177,7 +177,7 @@ int add_network_entry( { int rc; - node_comm_t *nc = calloc(1, sizeof(node_comm_t)); + node_comm_t *nc = (node_comm_t *)calloc(1, sizeof(node_comm_t)); resizable_array *levels; resizable_array *node_comm_entries; @@ -232,7 +232,7 @@ int add_network_entry( nc->sock_addr.sin_port = htons(rm_port); nc->stream = -1; - if ((nc->name = calloc(1, strlen(name) + 1)) == NULL) + if ((nc->name = (char *)calloc(1, strlen(name) + 1)) == NULL) { free(nc); return(ENOMEM); @@ -293,7 +293,6 @@ int tcp_connect_sockaddr( size_t sa_size) /* I */ { - char *id = "tcp_connect_sockaddr"; int rc = PBSE_NONE; int stream = -1; char *err_msg = NULL; @@ -318,17 +317,17 @@ int tcp_connect_sockaddr( if ((stream = socket_get_tcp_priv()) < 0) { /* FAILED */ - log_err(errno,id,"Failed when trying to get privileged port - socket_get_tcp_priv() failed"); + log_err(errno,__func__,(char *)"Failed when trying to get privileged port - socket_get_tcp_priv() failed"); } else if ((rc = socket_connect_addr(&stream, sa, sa_size, 1, &err_msg)) != PBSE_NONE) { /* FAILED */ tmp_ip = inet_ntoa(((struct sockaddr_in *)sa)->sin_addr); snprintf(local_err_buf, LOCAL_LOG_BUF, "Failed when trying to open tcp connection - connect() failed [rc = %d] [addr = %s:%d]", rc, tmp_ip, htons(((struct sockaddr_in *)sa)->sin_port)); - log_err(errno,id,local_err_buf); + log_err(errno,__func__,local_err_buf); if (err_msg != NULL) { - log_err(errno,id,err_msg); + log_err(errno,__func__,err_msg); free(err_msg); } } diff --git a/src/lib/Libutils/u_mu.c b/src/lib/Libutils/u_mu.c index b92cc882a3..acccfeaf18 100644 --- a/src/lib/Libutils/u_mu.c +++ b/src/lib/Libutils/u_mu.c @@ -339,7 +339,6 @@ int write_buffer( int fds) { - char *id = "write_buffer"; int written; while ((written = write(fds,buf,len)) != len) @@ -354,7 +353,7 @@ int write_buffer( } else { - log_err(errno,id,"Unable to write to file or socket"); + log_err(errno,__func__,(char *)"Unable to write to file or socket"); return(-1); } diff --git a/src/lib/Libutils/u_resizable_array.c b/src/lib/Libutils/u_resizable_array.c index 8de5e939a8..74e365764b 100644 --- a/src/lib/Libutils/u_resizable_array.c +++ b/src/lib/Libutils/u_resizable_array.c @@ -136,7 +136,6 @@ int check_and_resize( resizable_array *ra) { - static char *id = "check_and_resize"; slot *tmp; size_t remaining; size_t size; @@ -146,9 +145,9 @@ int check_and_resize( /* double the size if we're out of space */ size = (ra->max * 2) * sizeof(slot); - if ((tmp = realloc(ra->slots,size)) == NULL) + if ((tmp = (slot *)realloc(ra->slots,size)) == NULL) { - log_err(ENOMEM,id,"No memory left to resize the array"); + log_err(ENOMEM,__func__,(char *)"No memory left to resize the array"); return(ENOMEM); } @@ -557,7 +556,7 @@ resizable_array *initialize_resizable_array( int size) { - resizable_array *ra = calloc(1, sizeof(resizable_array)); + resizable_array *ra = (resizable_array*)calloc(1, sizeof(resizable_array)); size_t amount = sizeof(slot) * size; ra->max = size; @@ -565,7 +564,7 @@ resizable_array *initialize_resizable_array( ra->next_slot = 1; ra->last = 0; - ra->slots = calloc(1, amount); + ra->slots = (slot *)calloc(1, amount); return(ra); } /* END initialize_resizable_array() */ diff --git a/src/lib/Libutils/u_threadpool.c b/src/lib/Libutils/u_threadpool.c index a278aa4006..8654deb8a6 100644 --- a/src/lib/Libutils/u_threadpool.c +++ b/src/lib/Libutils/u_threadpool.c @@ -213,7 +213,6 @@ static void *work_thread( void *a) { - static char *id = "work_thread"; int rc; @@ -228,7 +227,7 @@ static void *work_thread( if (request_pool == NULL) { - log_err(-1,id,"Pool doesn't exist, and thread is active??\nTerminating"); + log_err(-1,__func__,(char *) "Pool doesn't exist, and thread is active??\nTerminating"); return(NULL); } diff --git a/src/lib/Libutils/u_tree.c b/src/lib/Libutils/u_tree.c index 5671a76f55..8da551e1f4 100644 --- a/src/lib/Libutils/u_tree.c +++ b/src/lib/Libutils/u_tree.c @@ -392,7 +392,7 @@ int AVL_list_add_item( if ((*max_len - *current_len) < 23) { *max_len = *max_len + 1024; - tmp_buf = calloc(1, *max_len + 1); + tmp_buf = (char *)calloc(1, *max_len + 1); if (tmp_buf == NULL) return PBSE_MEM_MALLOC; memcpy(tmp_buf, *r_buf, *current_len); diff --git a/src/lib/Libutils/u_xml.c b/src/lib/Libutils/u_xml.c index 2cef9948fa..e86cc2723c 100644 --- a/src/lib/Libutils/u_xml.c +++ b/src/lib/Libutils/u_xml.c @@ -114,7 +114,7 @@ int get_parent_and_child( if (ptr == NULL) { - log_err(-1, __func__ ,"No parent tag found\n"); + log_err(-1, __func__ ,(char *)"No parent tag found\n"); return(-1); } @@ -158,7 +158,7 @@ int get_parent_and_child( if (child_end == NULL) { - log_err(-1, __func__, "Cannot find closing tag\n"); + log_err(-1, __func__, (char *)"Cannot find closing tag\n"); return(-1); } diff --git a/src/resmom/catch_child.c b/src/resmom/catch_child.c index c657b6bfac..e5e823c8c7 100644 --- a/src/resmom/catch_child.c +++ b/src/resmom/catch_child.c @@ -827,7 +827,7 @@ int run_epilogues( { if (run_pelog(PE_EPILOGUSERJOB, path_epiloguserjob, pjob, io_type) != 0) { - log_err(-1, __func__, "user local epilog failed"); + log_err(-1, __func__, (char *)"user local epilog failed"); } free(path_epiloguserjob); @@ -836,7 +836,7 @@ int run_epilogues( } if (run_pelog(PE_EPILOGUSER, path_epiloguser, pjob, io_type) != 0) - log_err(-1, __func__, "user epilog failed - interactive job"); + log_err(-1, __func__, (char *)"user epilog failed - interactive job"); if ((rc = run_pelog(PE_EPILOG, path_epilog, pjob, io_type)) != 0) { @@ -848,11 +848,11 @@ int run_epilogues( else { if (run_pelog(PE_EPILOGUSER, path_epiloguserp, pjob, io_type) != 0) - log_err(-1, __func__, "user epilog failed - interactive job"); + log_err(-1, __func__, (char *)"user epilog failed - interactive job"); if (run_pelog(PE_EPILOG, path_epilogp, pjob, PE_IO_TYPE_STD) != 0) { - log_err(-1, __func__, "parallel epilog failed"); + log_err(-1, __func__, (char *)"parallel epilog failed"); } } diff --git a/src/resmom/checkpoint.c b/src/resmom/checkpoint.c index 195065107a..f1c6c5edb3 100644 --- a/src/resmom/checkpoint.c +++ b/src/resmom/checkpoint.c @@ -196,7 +196,7 @@ int mom_checkpoint_execute_job( if (arg[1] == NULL) { - log_err(errno, __func__, "cannot alloc env"); + log_err(errno, __func__, (char *)"cannot alloc env"); return(-1); } @@ -920,7 +920,7 @@ int blcr_checkpoint_job( pjob->ji_qs.ji_un.ji_momt.ji_exuid, pjob->ji_qs.ji_un.ji_momt.ji_exgid) == -1) { - log_err(errno, __func__, "cannot change checkpoint directory owner"); + log_err(errno, __func__, (char *)"cannot change checkpoint directory owner"); } } @@ -928,7 +928,7 @@ int blcr_checkpoint_job( if (checkpoint_script_name[0] == '\0') { - log_err(PBSE_RMEXIST, __func__, "No checkpoint script defined"); + log_err(PBSE_RMEXIST, __func__, (char *)"No checkpoint script defined"); if (preq != NULL) { @@ -1571,7 +1571,7 @@ int start_checkpoint( { /* error on fork */ - log_err(errno, __func__, "cannot fork child process for checkpoint"); + log_err(errno, __func__, (char *)"cannot fork child process for checkpoint"); return(PBSE_SYSTEM); } @@ -1740,7 +1740,7 @@ int blcr_restart_job( if (restart_script_name[0] == '\0') { - log_err(PBSE_RMEXIST, __func__, "No restart script defined"); + log_err(PBSE_RMEXIST, __func__, (char *)"No restart script defined"); return(PBSE_RMEXIST); } @@ -1757,7 +1757,7 @@ int blcr_restart_job( null and we need to create a task We'll just create one task*/ if ((ptask = pbs_task_create(pjob, TM_NULL_TASK)) == NULL) { - log_err(PBSE_RMNOPARAM, __func__, "Job has no tasks"); + log_err(PBSE_RMNOPARAM, __func__, (char *)"Job has no tasks"); return(PBSE_RMNOPARAM); } @@ -1839,7 +1839,7 @@ int blcr_restart_job( pjob->ji_qs.ji_un.ji_momt.ji_exuid, pjob->ji_qs.ji_un.ji_momt.ji_exgid) == -1) { - log_err(errno, __func__, "cannot change checkpoint restart file owner"); + log_err(errno, __func__, (char *)"cannot change checkpoint restart file owner"); } @@ -2343,7 +2343,7 @@ int create_missing_files( { if (fchown(fd, pjob->ji_qs.ji_un.ji_momt.ji_exuid, pjob->ji_qs.ji_un.ji_momt.ji_exgid) == -1) { - log_err(errno, "create_missing_files", "cannot change file owner"); + log_err(errno, "create_missing_files", (char *)"cannot change file owner"); } close(fd); ++files_created; @@ -2379,7 +2379,7 @@ int create_missing_files( { if (fchown(fd, pjob->ji_qs.ji_un.ji_momt.ji_exuid, pjob->ji_qs.ji_un.ji_momt.ji_exgid) == -1) { - log_err(errno, "create_missing_files", "cannot change file ownership"); + log_err(errno, "create_missing_files", (char *)"cannot change file ownership"); } close(fd); ++files_created; diff --git a/src/resmom/cygwin/mom_mach.c b/src/resmom/cygwin/mom_mach.c index 32e4328077..8e9cae672f 100644 --- a/src/resmom/cygwin/mom_mach.c +++ b/src/resmom/cygwin/mom_mach.c @@ -341,7 +341,7 @@ proc_stat_t *get_proc_stat( /* FAILURE */ if (!Hertz_errored) - log_err(errno, "get_proc_stat", "sysconf(_SC_CLK_TCK) failed, unable to monitor processes"); + log_err(errno, "get_proc_stat", (char *)"sysconf(_SC_CLK_TCK) failed, unable to monitor processes"); Hertz_errored = 1; @@ -514,7 +514,7 @@ void dep_initialize(void) if ((pdir = opendir(procfs)) == NULL) { - log_err(errno, id, "opendir"); + log_err(errno, id, (char *)"opendir"); return; } @@ -1481,7 +1481,7 @@ mom_open_poll(void) if (proc_array == NULL) { - log_err(errno, id, "calloc"); + log_err(errno, id, (char *)"calloc"); return(PBSE_SYSTEM); } @@ -1577,7 +1577,7 @@ mom_get_sample(void) if (proc_array == NULL) { - log_err(errno, id, "unable to realloc space for proc_array sample"); + log_err(errno, id, (char *)"unable to realloc space for proc_array sample"); return(PBSE_SYSTEM); } @@ -2245,7 +2245,7 @@ mom_close_poll(void) { if (closedir(pdir) != 0) { - log_err(errno, id, "closedir"); + log_err(errno, id, (char *)"closedir"); return(PBSE_SYSTEM); } @@ -2840,7 +2840,7 @@ char *sessions( if (hold == NULL) { - log_err(errno, id, "realloc"); + log_err(errno, id, (char *)"realloc"); rm_errno = RM_ERR_SYSTEM; @@ -3037,7 +3037,7 @@ char *nusers( if ((uids = (uid_t *)calloc(maxuid, sizeof(uid_t))) == NULL) { - log_err(errno, id, "no memory"); + log_err(errno, id, (char *)"no memory"); rm_errno = RM_ERR_SYSTEM; @@ -3082,7 +3082,7 @@ char *nusers( if (hold == NULL) { - log_err(errno, id, "realloc"); + log_err(errno, id, (char *)"realloc"); rm_errno = RM_ERR_SYSTEM; @@ -3128,7 +3128,7 @@ static char *totmem( if ((mm = get_proc_mem()) == NULL) { - log_err(errno, id, "get_proc_mem"); + log_err(errno, id, (char *)"get_proc_mem"); rm_errno = RM_ERR_SYSTEM; @@ -3381,7 +3381,7 @@ char *size_fs( if (statfs(param, &fsbuf) == -1) { - log_err(errno, id, "statfs"); + log_err(errno, id, (char *)"statfs"); rm_errno = RM_ERR_BADPARAM; @@ -3422,7 +3422,7 @@ char *size_file( if (stat(param, &sbuf) == -1) { - log_err(errno, id, "stat"); + log_err(errno, id, (char *)"stat"); rm_errno = RM_ERR_BADPARAM; @@ -3680,7 +3680,7 @@ static char *walltime( if ((now = time(NULL)) <= 0) { - log_err(errno, id, "time"); + log_err(errno, id, (char *)"time"); rm_errno = RM_ERR_SYSTEM; @@ -3745,7 +3745,7 @@ int get_la( if (fscanf(fp, "%f", &load) != 1) { - log_err(errno, id, "fscanf of load in /proc/loadavg"); + log_err(errno, id, (char *)"fscanf of load in /proc/loadavg"); fclose(fp); @@ -3911,7 +3911,7 @@ static char *quota( if ((m = setmntent(MOUNTED, "r")) == NULL) { - log_err(errno, id, "setmntent"); + log_err(errno, id, (char *)"setmntent"); rm_errno = RM_ERR_SYSTEM; return NULL; } @@ -3997,7 +3997,7 @@ static char *quota( (caddr_t)&qi) == -1) { - log_err(errno, id, "quotactl"); + log_err(errno, id, (char *)"quotactl"); rm_errno = RM_ERR_SYSTEM; diff --git a/src/resmom/darwin/mom_mach.c b/src/resmom/darwin/mom_mach.c index b9cc9e7cde..cc442dc7ed 100644 --- a/src/resmom/darwin/mom_mach.c +++ b/src/resmom/darwin/mom_mach.c @@ -2099,7 +2099,7 @@ char *sessions( if ((jids = (pid_t *)calloc(nproc, sizeof(pid_t))) == NULL) { - log_err(errno, id, "no memory"); + log_err(errno, id, (char *)"no memory"); rm_errno = RM_ERR_SYSTEM; return NULL; } @@ -2296,7 +2296,7 @@ char *nusers( if ((uids = (uid_t *)calloc(nproc, sizeof(uid_t))) == NULL) { - log_err(errno, id, "no memory"); + log_err(errno, id, (char *)"no memory"); rm_errno = RM_ERR_SYSTEM; return NULL; } @@ -2403,7 +2403,7 @@ static char *totmem( sprintf(log_buffer, "sysctl failed with errno %d", errno); - log_err(-1, id, "log_buffer"); + log_err(-1, id, (char *)"log_buffer"); return(NULL); } @@ -2473,7 +2473,7 @@ static char *availmem( { sprintf(log_buffer, "sysctl failed with errno %d", errno); - log_err(-1, id, "log_buffer"); + log_err(-1, id, (char *)"log_buffer"); return(NULL); } @@ -2488,7 +2488,7 @@ static char *availmem( if (host_statistics(mach_host_self(), HOST_VM_INFO, (host_info_t)&stat, &count) != KERN_SUCCESS) { - log_err(-1, id, "host_statistics failed"); + log_err(-1, id, (char *)"host_statistics failed"); rm_errno = RM_ERR_SYSTEM; return(NULL); } @@ -2625,7 +2625,7 @@ static char *physmem( if (sysctlbyname("hw.memsize", &physmem, &len, NULL, 0) < 0) { - log_err(errno, id, "sysctl"); + log_err(errno, id, (char *)"sysctl"); rm_errno = RM_ERR_SYSTEM; @@ -2651,7 +2651,7 @@ static char *physmem( if (sysctl(mib, 2, &physmem, &len, NULL, 0) < 0) { - log_err(errno, id, "sysctl"); + log_err(errno, id, (char *)"sysctl"); rm_errno = RM_ERR_SYSTEM; @@ -2693,7 +2693,7 @@ char *size_fs( if (statfs(param, &fsbuf) == -1) { - log_err(errno, id, "statfs"); + log_err(errno, id, (char *)"statfs"); rm_errno = RM_ERR_BADPARAM; return NULL; } @@ -2729,7 +2729,7 @@ char *size_file( if (stat(param, &sbuf) == -1) { - log_err(errno, id, "stat"); + log_err(errno, id, (char *)"stat"); rm_errno = RM_ERR_BADPARAM; return NULL; } @@ -2822,7 +2822,7 @@ idletime(struct rm_attribute *attrib) if ((dp = opendir("/dev")) == NULL) { - log_err(errno, id, "opendir /dev"); + log_err(errno, id, (char *)"opendir /dev"); rm_errno = RM_ERR_SYSTEM; return NULL; } @@ -2903,7 +2903,7 @@ walltime(struct rm_attribute *attrib) if ((now = time(NULL)) <= 0) { - log_err(errno, id, "time"); + log_err(errno, id, (char *)"time"); rm_errno = RM_ERR_SYSTEM; return NULL; } @@ -2967,7 +2967,7 @@ int get_la( if (sysctl(mib, 2, &la, &len, NULL, 0) < 0) { - log_err(errno, id, "sysctl(VM_LOADAVG)"); + log_err(errno, id, (char *)"sysctl(VM_LOADAVG)"); return (rm_errno = RM_ERR_SYSTEM); } @@ -3101,7 +3101,7 @@ static char *quota( if (setfsent() == 0) { - log_err(errno, id, "setfsent"); + log_err(errno, id, (char *)"setfsent"); rm_errno = RM_ERR_SYSTEM; return NULL; } @@ -3166,7 +3166,7 @@ static char *quota( if (quotactl(fs->fs_file, Q_GETQUOTA, uid, (char *)&qi) == -1) { - log_err(errno, id, "quotactl"); + log_err(errno, id, (char *)"quotactl"); rm_errno = RM_ERR_SYSTEM; return (NULL); } diff --git a/src/resmom/hpux11/mom_mach.c b/src/resmom/hpux11/mom_mach.c index 0c0f2a1a90..e2e3c38c93 100644 --- a/src/resmom/hpux11/mom_mach.c +++ b/src/resmom/hpux11/mom_mach.c @@ -1523,7 +1523,7 @@ sessions(struct rm_attribute *attrib) if ((jids = (pid_t *)calloc(maxjid, sizeof(pid_t))) == NULL) { - log_err(errno, id, "no memory"); + log_err(errno, id, (char *)"no memory"); rm_errno = RM_ERR_SYSTEM; return NULL; } @@ -1565,7 +1565,7 @@ sessions(struct rm_attribute *attrib) if (hold == NULL) { - log_err(errno, id, "realloc"); + log_err(errno, id, (char *)"realloc"); rm_errno = RM_ERR_SYSTEM; free(jids); return NULL; @@ -1716,7 +1716,7 @@ nusers(struct rm_attribute *attrib) if ((uids = (uid_t *)calloc(maxuid, sizeof(uid_t))) == NULL) { - log_err(errno, id, "no memory"); + log_err(errno, id, (char *)"no memory"); rm_errno = RM_ERR_SYSTEM; return NULL; } @@ -1752,7 +1752,7 @@ nusers(struct rm_attribute *attrib) if (hold == NULL) { - log_err(errno, id, "realloc"); + log_err(errno, id, (char *)"realloc"); rm_errno = RM_ERR_SYSTEM; free(uids); return NULL; @@ -1975,7 +1975,7 @@ char *size_fs( if (statvfs(param, &fsbuf) == -1) { - log_err(errno, id, "statvfs"); + log_err(errno, id, (char *)"statvfs"); rm_errno = RM_ERR_BADPARAM; @@ -2018,7 +2018,7 @@ char *size_file( if (stat(param, &sbuf) == -1) { - log_err(errno, id, "stat"); + log_err(errno, id, (char *)"stat"); rm_errno = RM_ERR_BADPARAM; @@ -2102,14 +2102,14 @@ char *idletime( if (attrib) { - log_err(-1, id, extra_parm); + log_err(-1, id, (char *)extra_parm); rm_errno = RM_ERR_BADPARAM; return NULL; } if ((dp = opendir("/dev/pts")) == NULL) { - log_err(errno, id, "opendir /dev"); + log_err(errno, id, (char *)"opendir /dev"); rm_errno = RM_ERR_SYSTEM; return NULL; } @@ -2190,7 +2190,7 @@ walltime(struct rm_attribute *attrib) if ((now = time(NULL)) <= 0) { - log_err(errno, id, "time"); + log_err(errno, id, (char *)"time"); rm_errno = RM_ERR_SYSTEM; return NULL; } diff --git a/src/resmom/irix6array/mom_mach.c b/src/resmom/irix6array/mom_mach.c index 30fd0533c2..26329bcdaf 100644 --- a/src/resmom/irix6array/mom_mach.c +++ b/src/resmom/irix6array/mom_mach.c @@ -262,7 +262,7 @@ dep_initialize(void) if ((pdir = opendir(procfs)) == NULL) { - log_err(errno, id, "opendir"); + log_err(errno, id, (char *)"opendir"); return; } @@ -280,14 +280,14 @@ dep_initialize(void) if ((i = fcntl(kfd, F_GETFD)) == -1) { - log_err(errno, id, "F_GETFD"); + log_err(errno, id, (char *)"F_GETFD"); } i |= FD_CLOEXEC; if (fcntl(kfd, F_SETFD, i) == -1) { - log_err(errno, id, "F_SETFD"); + log_err(errno, id, (char *)"F_SETFD"); } return; @@ -1001,7 +1001,7 @@ mom_open_poll(void) if (proc_array == NULL) { - log_err(errno, id, "calloc"); + log_err(errno, id, (char *)"calloc"); return (PBSE_SYSTEM); } @@ -1112,7 +1112,7 @@ mom_get_sample(void) if ((num = ioctl(fd, PIOCMAP_SGI, &maparg)) == -1) { if (errno != ENOENT) - log_err(errno, id, "ioctl(PIOCMAP_SGI)"); + log_err(errno, id, (char *)"ioctl(PIOCMAP_SGI)"); free(map); @@ -1536,7 +1536,7 @@ mom_close_poll(void) { if (closedir(pdir) != 0) { - log_err(errno, id, "closedir"); + log_err(errno, id, (char *)"closedir"); return (PBSE_SYSTEM); } } @@ -1651,7 +1651,7 @@ mach_restart(task *ptask, char *file) if ((pdir = opendir(procfs)) == NULL) { - log_err(errno, "mach_restart", "opendir"); + log_err(errno, "mach_restart", (char *)"opendir"); } return ((int)rc); @@ -1738,7 +1738,7 @@ totmem(struct rm_attribute *attrib) if (statfs(procfs, &fsbuf, sizeof(struct statfs), 0) == -1) { - log_err(errno, id, "statfs"); + log_err(errno, id, (char *)"statfs"); rm_errno = RM_ERR_SYSTEM; return NULL; } @@ -1771,7 +1771,7 @@ availmem(struct rm_attribute *attrib) if (statfs(procfs, &fsbuf, sizeof(struct statfs), 0) == -1) { - log_err(errno, id, "statfs"); + log_err(errno, id, (char *)"statfs"); rm_errno = RM_ERR_SYSTEM; return NULL; } @@ -1830,7 +1830,7 @@ physmem(struct rm_attribute *attrib) if (read(kfd, (char *)&pmem, sizeof(pmem)) != sizeof(pmem)) { - log_err(errno, id, "read"); + log_err(errno, id, (char *)"read"); rm_errno = RM_ERR_SYSTEM; return NULL; } @@ -1862,7 +1862,7 @@ size_fs(char *param) if (statfs(param, &fsbuf, sizeof(struct statfs), 0) == -1) { - log_err(errno, id, "statfs"); + log_err(errno, id, (char *)"statfs"); rm_errno = RM_ERR_BADPARAM; return NULL; } @@ -1895,7 +1895,7 @@ size_file(char *param) if (stat64(param, &sbuf) == -1) { - log_err(errno, id, "stat"); + log_err(errno, id, (char *)"stat"); rm_errno = RM_ERR_BADPARAM; return NULL; } @@ -1974,7 +1974,7 @@ idletime(struct rm_attribute *attrib) if ((dp = opendir("/dev")) == NULL) { - log_err(errno, id, "opendir /dev"); + log_err(errno, id, (char *)"opendir /dev"); rm_errno = RM_ERR_SYSTEM; return NULL; } @@ -2020,7 +2020,7 @@ get_la(double *rv) if (read(kfd, (char *)&load, sizeof(load)) != sizeof(load)) { - log_err(errno, id, "read"); + log_err(errno, id, (char *)"read"); return (rm_errno = RM_ERR_SYSTEM); } @@ -2155,7 +2155,7 @@ quota(struct rm_attribute *attrib) if ((m = setmntent(MOUNTED, "r")) == NULL) { - log_err(errno, id, "setmntent"); + log_err(errno, id, (char *)"setmntent"); rm_errno = RM_ERR_SYSTEM; return NULL; } @@ -2230,7 +2230,7 @@ quota(struct rm_attribute *attrib) if (quotactl(Q_GETQUOTA, me->mnt_fsname, uid, (caddr_t)&qi) == -1) { - log_err(errno, id, "quotactl"); + log_err(errno, id, (char *)"quotactl"); rm_errno = RM_ERR_SYSTEM; return NULL; } @@ -2309,7 +2309,7 @@ availmask(struct rm_attribute *attrib) if (nprocs < 1) { - log_err(errno, id, "sysmp(MP_NPROCS"); + log_err(errno, id, (char *)"sysmp(MP_NPROCS"); rm_errno = RM_ERR_SYSTEM; return (NULL); } @@ -2317,7 +2317,7 @@ availmask(struct rm_attribute *attrib) if (sysmp(MP_NUMA_GETCPUNODEMAP, (void *)cpumap, sizeof(cnodeid_t) * nprocs) != 0) { - log_err(errno, id, "sysmp(MP_NUMA_GETCPUNODEMAP"); + log_err(errno, id, (char *)"sysmp(MP_NUMA_GETCPUNODEMAP"); rm_errno = RM_ERR_SYSTEM; return (NULL); } diff --git a/src/resmom/linux/cpuset.c b/src/resmom/linux/cpuset.c index 1c8486e9c0..a46b4b0852 100644 --- a/src/resmom/linux/cpuset.c +++ b/src/resmom/linux/cpuset.c @@ -207,7 +207,7 @@ int init_cpusets(void) /* Allocate a cpuset */ if ((cp = cpuset_alloc()) == NULL) { - log_err(errno, __func__, "failed to allocate cpuset"); + log_err(errno, __func__, (char *)"failed to allocate cpuset"); return(-1); } @@ -215,11 +215,11 @@ int init_cpusets(void) if ((rc = cpuset_query(cp, TROOTCPUSET_BASE)) == -1) { if (errno == ENOSYS) - log_err(errno, __func__, "failed to query root cpuset, cpusets not supported on this system"); + log_err(errno, __func__, (char *)"failed to query root cpuset, cpusets not supported on this system"); else if (errno == ENODEV) - log_err(errno, __func__, "failed to query root cpuset, cpusets not enabled on this system"); + log_err(errno, __func__, (char *)"failed to query root cpuset, cpusets not enabled on this system"); else - log_err(errno, __func__, "failed to query root cpuset"); + log_err(errno, __func__, (char *)"failed to query root cpuset"); } cpuset_free(cp); @@ -939,7 +939,7 @@ void cleanup_torque_cpuset(void) if ((dir = opendir(TTORQUECPUSET_PATH)) == NULL) { - log_err(errno, __func__, "failed to open TORQUE cpuset hierarchy"); + log_err(errno, __func__, (char *)"failed to open TORQUE cpuset hierarchy"); return; } @@ -1056,7 +1056,7 @@ int init_torque_cpuset(void) if (((cpus = hwloc_bitmap_alloc()) == NULL) || ((mems = hwloc_bitmap_alloc()) == NULL)) { - log_err(ENOMEM, __func__, "failed to allocate bitmap"); + log_err(ENOMEM, __func__, (char *)"failed to allocate bitmap"); return(-1); } @@ -1139,12 +1139,12 @@ int init_torque_cpuset(void) /* Allocate bitmaps before querying boot cpuset */ if ((bootcpus = hwloc_bitmap_alloc()) == NULL) { - log_err(errno, __func__, "failed to allocate bitmap"); + log_err(errno, __func__, (char *)"failed to allocate bitmap"); goto finish; } if ((bootmems = hwloc_bitmap_alloc()) == NULL) { - log_err(errno, __func__, "failed to allocate bitmap"); + log_err(errno, __func__, (char *)"failed to allocate bitmap"); goto finish; } @@ -1306,7 +1306,7 @@ int create_job_cpuset( if (((cpus = hwloc_bitmap_alloc()) == NULL) || ((mems = hwloc_bitmap_alloc()) == NULL)) { - log_err(errno, __func__, "failed to allocate bitmap"); + log_err(errno, __func__, (char *)"failed to allocate bitmap"); goto finish; } @@ -1356,7 +1356,7 @@ int create_job_cpuset( /* Allocate bitmap for cpus of TORQUE cpuset */ if ((tcpus = hwloc_bitmap_alloc()) == NULL) { - log_err(errno, __func__, "failed to allocate bitmap"); + log_err(errno, __func__, (char *)"failed to allocate bitmap"); goto finish; } @@ -1908,7 +1908,7 @@ struct pidl *get_cpuset_pidlist( if ((pp = (struct pidl *)calloc(1,sizeof(struct pidl))) == NULL) { - log_err(errno, __func__, "calloc"); + log_err(errno, __func__, (char *)"calloc"); break; } @@ -1997,7 +1997,7 @@ struct pidl *get_cpuset_pidlist( if ((pp = (struct pidl *)calloc(1, sizeof(struct pidl))) == NULL) { - log_err(errno, __func__, "calloc"); + log_err(errno, __func__, (char *)"calloc"); break; } else diff --git a/src/resmom/linux/mom_mach.c b/src/resmom/linux/mom_mach.c index e4a32df140..409c74f9c0 100644 --- a/src/resmom/linux/mom_mach.c +++ b/src/resmom/linux/mom_mach.c @@ -301,7 +301,7 @@ proc_stat_t *get_proc_stat( /* FAILURE */ if (!Hertz_errored) - log_err(errno, "get_proc_stat", "sysconf(_SC_CLK_TCK) failed, unable to monitor processes"); + log_err(errno, "get_proc_stat", (char *)"sysconf(_SC_CLK_TCK) failed, unable to monitor processes"); Hertz_errored = 1; @@ -693,7 +693,7 @@ void dep_initialize(void) if ((pdir = opendir(procfs)) == NULL) { - log_err(errno, id, "opendir"); + log_err(errno, id, (char *)"opendir"); return; } @@ -1779,7 +1779,7 @@ int mom_open_poll(void) if (proc_array == NULL) { - log_err(errno, id, "calloc"); + log_err(errno, id, (char *)"calloc"); return(PBSE_SYSTEM); } @@ -1899,7 +1899,7 @@ int mom_get_sample(void) if (hold == NULL) { - log_err(errno, id, "unable to realloc space for proc_array sample"); + log_err(errno, id, (char *)"unable to realloc space for proc_array sample"); return(PBSE_SYSTEM); } @@ -2679,7 +2679,7 @@ int mom_close_poll(void) { if (closedir(pdir) != 0) { - log_err(errno, id, "closedir"); + log_err(errno, id, (char *)"closedir"); return(PBSE_SYSTEM); } @@ -3344,7 +3344,7 @@ char *sessions( /* not found */ if ((sp = (struct pidl *)calloc(1, sizeof(struct pidl))) == NULL) { - log_err(errno, id, "no memory"); + log_err(errno, id, (char *)"no memory"); rm_errno = RM_ERR_SYSTEM; if (sids) free_pidlist(sids); @@ -3640,7 +3640,7 @@ char *nusers( if (hold == NULL) { - log_err(errno, id, "realloc"); + log_err(errno, id, (char *)"realloc"); rm_errno = RM_ERR_SYSTEM; @@ -3703,7 +3703,7 @@ static char *totmem( if ((mm = get_proc_mem()) == NULL) { - log_err(errno, id, "get_proc_mem"); + log_err(errno, id, (char *)"get_proc_mem"); rm_errno = RM_ERR_SYSTEM; @@ -3749,7 +3749,7 @@ static char *availmem( if ((mm = get_proc_mem()) == NULL) { - log_err(errno, id, "get_proc_mem"); + log_err(errno, id, (char *)"get_proc_mem"); rm_errno = RM_ERR_SYSTEM; @@ -4041,7 +4041,7 @@ char *size_fs( if (statfs(param, &fsbuf) == -1) { - log_err(errno, id, "statfs"); + log_err(errno, id, (char *)"statfs"); rm_errno = RM_ERR_BADPARAM; @@ -4087,7 +4087,7 @@ char *size_file( if (stat(param, &sbuf) == -1) { - log_err(errno, id, "stat"); + log_err(errno, id, (char *)"stat"); rm_errno = RM_ERR_BADPARAM; @@ -4354,7 +4354,7 @@ char *idletime( if ((dp = opendir("/dev")) == NULL) { - log_err(errno, id, "opendir /dev"); + log_err(errno, id, (char *)"opendir /dev"); rm_errno = RM_ERR_SYSTEM; @@ -4451,7 +4451,7 @@ static char *walltime( if ((now = time(NULL)) <= 0) { - log_err(errno, id, "time"); + log_err(errno, id, (char *)"time"); rm_errno = RM_ERR_SYSTEM; @@ -4516,7 +4516,7 @@ int get_la( if (fscanf(fp, "%f", &load) != 1) { - log_err(errno, id, "fscanf of load in /proc/loadavg"); + log_err(errno, id, (char *)"fscanf of load in /proc/loadavg"); fclose(fp); @@ -4593,7 +4593,7 @@ void collect_cpuact(void) { if ((cpu_array = (proc_cpu_t *)calloc(system_ncpus, sizeof(proc_cpu_t))) == NULL) { - log_err(errno, id, "failed to allocate memory"); + log_err(errno, id, (char *)"failed to allocate memory"); return; } } @@ -4848,7 +4848,7 @@ static char *quota( if ((m = setmntent(MOUNTED, "r")) == NULL) { - log_err(errno, id, "setmntent"); + log_err(errno, id, (char *)"setmntent"); rm_errno = RM_ERR_SYSTEM; return NULL; } @@ -4932,7 +4932,7 @@ static char *quota( uid, (caddr_t)&qi) == -1) { - log_err(errno, id, "quotactl"); + log_err(errno, id, (char *)"quotactl"); rm_errno = RM_ERR_SYSTEM; @@ -5050,7 +5050,7 @@ static char *netload( if (rc < 0) { - log_err(errno, id, "fscanf of header lines in /proc/net/dev"); + log_err(errno, id, (char *)"fscanf of header lines in /proc/net/dev"); fclose(fp); diff --git a/src/resmom/linux/mom_start.c b/src/resmom/linux/mom_start.c index f2ea8b87fa..6993afd703 100644 --- a/src/resmom/linux/mom_start.c +++ b/src/resmom/linux/mom_start.c @@ -503,8 +503,7 @@ int open_master( if (status < 0) { - log_err(errno, "open_master", - "failed in openpty()"); + log_err(errno, "open_master", (char *)"failed in openpty()"); return(-1); } diff --git a/src/resmom/mic.c b/src/resmom/mic.c index 818681e80f..11ec1726ea 100644 --- a/src/resmom/mic.c +++ b/src/resmom/mic.c @@ -224,7 +224,7 @@ int add_mic_status( if (COIEngineGetCount(COI_ISA_MIC, &num_engines) != COI_SUCCESS) { - log_err(-1, __func__, "Mics are present but apparently not configured correctly - can't get count"); + log_err(-1, __func__, (char *)"Mics are present but apparently not configured correctly - can't get count"); return(PBSE_SYSTEM); } diff --git a/src/resmom/mom_comm.c b/src/resmom/mom_comm.c index 51e298e7a4..2eb9ca34bf 100644 --- a/src/resmom/mom_comm.c +++ b/src/resmom/mom_comm.c @@ -296,7 +296,7 @@ int task_save( if (fds < 0) { - log_err(errno, __func__, "error on open"); + log_err(errno, __func__, (char *)"error on open"); return(-1); } @@ -316,7 +316,7 @@ int task_save( if (lseek(fds, (off_t)(TaskID*sizeof(ptask->ti_qs)), SEEK_SET) < 0) #endif { - log_err(errno, __func__, "lseek"); + log_err(errno, __func__, (char *)"lseek"); close(fds); @@ -344,7 +344,7 @@ int task_save( if (lseek(fds, (off_t)(TaskID*sizeof(ptask->ti_qs)), SEEK_SET) < 0) #endif { - log_err(errno, __func__, "lseek"); + log_err(errno, __func__, (char *)"lseek"); close(fds); @@ -354,7 +354,7 @@ int task_save( continue; } - log_err(errno, __func__, "quickwrite"); + log_err(errno, __func__, (char *)"quickwrite"); close(fds); @@ -443,7 +443,7 @@ task *pbs_task_create( { sprintf(log_buffer, "Ran into reserved task IDs on job %s", pjob->ji_qs.ji_jobid); - log_err(-1, __func__, log_buffer); + log_err(-1, __func__, (char *)log_buffer); return(NULL); } @@ -459,7 +459,7 @@ task *pbs_task_create( * be in production code, so I figure this is better than that --dbeer */ if (rd == NULL) { - log_err(-1, __func__, "No tasks per node resource definition? TORQUE is very broken!"); + log_err(-1, __func__, (char *)"No tasks per node resource definition? TORQUE is very broken!"); return(NULL); } @@ -477,7 +477,7 @@ task *pbs_task_create( if (ptask == NULL) { - log_err(ENOMEM, __func__, "No memory to allocate task! IMMINENT FAILURE"); + log_err(ENOMEM, __func__, (char *)"No memory to allocate task! IMMINENT FAILURE"); return(NULL); } @@ -624,7 +624,7 @@ int task_recov( if (fds < 0) { - log_err(errno, __func__, "open of task file"); + log_err(errno, __func__, (char *)"open of task file"); unlink(namebuf); @@ -651,7 +651,7 @@ int task_recov( if ((pt = pbs_task_create(pjob, tid)) == NULL) { - log_err(errno, __func__, "cannot create task"); + log_err(errno, __func__, (char *)"cannot create task"); close(fds); @@ -1008,7 +1008,7 @@ hnodent *find_node( if (getpeername(stream,&connecting_stack_addr,&len) != 0) { - log_err(errno, __func__, "Couldn't find connecting information for this stream"); + log_err(errno, __func__, (char *)"Couldn't find connecting information for this stream"); return(NULL); } @@ -1463,7 +1463,7 @@ int check_ms( if (pjob->ji_qs.ji_svrflags & JOB_SVFLG_HERE) { - log_err(-1, __func__, "Mother Superior talking to herself"); + log_err(-1, __func__, (char *)"Mother Superior talking to herself"); return(TRUE); } @@ -1880,8 +1880,7 @@ void send_im_error( else rc = DIS_tcp_wflush(local_chan); - if(socket >= 0) - close(socket); + close(socket); if (local_chan != NULL) { @@ -1964,8 +1963,7 @@ int reply_to_join_job_as_sister( else ret = DIS_tcp_wflush(local_chan); - if(socket >= 0) - close(socket); + close(socket); if (local_chan != NULL) { @@ -2381,7 +2379,7 @@ int im_join_job_as_sister( sprintf(log_buffer, "Could not create cpuset for job %s.\n", pjob->ji_qs.ji_jobid); - log_err(-1, __func__, log_buffer); + log_err(-1, __func__, (char *)log_buffer); } } @@ -2410,7 +2408,7 @@ int im_join_job_as_sister( { send_im_error(PBSE_SYSTEM,1,pjob,cookie,event,fromtask); - log_err(-1, __func__, "cannot load sp switch table"); + log_err(-1, __func__, (char *)"cannot load sp switch table"); mom_job_purge(pjob); @@ -2877,9 +2875,7 @@ int im_spawn_task( else ret = DIS_tcp_wflush(local_chan); - if(socket >= 0) - close(local_socket); - + close(local_socket); if (local_chan != NULL) DIS_tcp_cleanup(local_chan); @@ -3060,9 +3056,7 @@ int im_signal_task( else DIS_tcp_wflush(local_chan); - if(socket >= 0) - close(socket); - + close(socket); if (local_chan != NULL) DIS_tcp_cleanup(local_chan); @@ -3214,7 +3208,7 @@ int im_obit_task( if (op == NULL) { - log_err(ENOMEM, __func__, "Cannot allocate memory for the obit entry"); + log_err(ENOMEM, __func__, (char *)"Cannot allocate memory for the obit entry"); } else { @@ -3633,7 +3627,7 @@ int im_get_tid( if ((pjob->ji_qs.ji_svrflags & JOB_SVFLG_HERE) == 0) { - log_err(-1, __func__, "got GET_TID and I'm not MS"); + log_err(-1, __func__, (char *)"got GET_TID and I'm not MS"); return(IM_FAILURE); } @@ -3652,7 +3646,7 @@ int im_get_tid( if (IS_ADOPTED_TASK(pjob->ji_taskid)) { - log_err(-1, __func__, "Ran into reserved task ids"); + log_err(-1, __func__, (char *)"Ran into reserved task ids"); return(IM_FAILURE); } @@ -3706,7 +3700,7 @@ int handle_im_join_job_response( if ((pjob->ji_qs.ji_svrflags & JOB_SVFLG_HERE) == 0) { - log_err(-1, __func__, "got JOIN_JOB OKAY and I'm not MS"); + log_err(-1, __func__, (char *)"got JOIN_JOB OKAY and I'm not MS"); return(IM_FAILURE); } @@ -3804,7 +3798,7 @@ int handle_im_kill_job_response( if ((pjob->ji_qs.ji_svrflags & JOB_SVFLG_HERE) == 0) { - log_err(-1, __func__, "got KILL_JOB OKAY and I'm not MS"); + log_err(-1, __func__, (char *)"got KILL_JOB OKAY and I'm not MS"); return(IM_FAILURE); } @@ -4240,7 +4234,7 @@ int handle_im_poll_job_response( if ((pjob->ji_qs.ji_svrflags & JOB_SVFLG_HERE) == 0) { - log_err(-1, __func__, "got POLL_JOB and I'm not MS"); + log_err(-1, __func__, (char *)"got POLL_JOB and I'm not MS"); return(IM_FAILURE); } @@ -4918,7 +4912,7 @@ void im_request( if (ret == IM_FAILURE) { - log_err(-1, __func__, "im_spawn_task error"); + log_err(-1, __func__, (char *)"im_spawn_task error"); goto err; } @@ -4931,7 +4925,7 @@ void im_request( if (ret == IM_FAILURE) { - log_err(-1, __func__, "im_signal_task error"); + log_err(-1, __func__, (char *)"im_signal_task error"); goto err; } @@ -4944,7 +4938,7 @@ void im_request( if (ret == IM_FAILURE) { - log_err(-1, __func__, "im_obit_task error"); + log_err(-1, __func__, (char *)"im_obit_task error"); goto err; } @@ -4957,7 +4951,7 @@ void im_request( if (ret == IM_FAILURE) { - log_err(-1, __func__, "im_get_info error"); + log_err(-1, __func__, (char *)"im_get_info error"); goto err; } @@ -4970,7 +4964,7 @@ void im_request( if (ret == IM_FAILURE) { - log_err(-1, __func__, "im_get_resc_as_sister error"); + log_err(-1, __func__, (char *)"im_get_resc_as_sister error"); goto err; } @@ -4985,7 +4979,7 @@ void im_request( close_conn(chan->sock, FALSE); svr_conn[chan->sock].cn_stay_open = FALSE; chan->sock = -1; - log_err(-1, __func__, "check_ms error IM_POLL_JOB"); + log_err(-1, __func__, (char *)"check_ms error IM_POLL_JOB"); goto err; } @@ -5006,7 +5000,7 @@ void im_request( close_conn(chan->sock, FALSE); svr_conn[chan->sock].cn_stay_open = FALSE; chan->sock = -1; - log_err(-1, __func__, "check_ms error IM_ABORT_JOB"); + log_err(-1, __func__, (char *)"check_ms error IM_ABORT_JOB"); goto err; } @@ -5022,7 +5016,7 @@ void im_request( close_conn(chan->sock, FALSE); svr_conn[chan->sock].cn_stay_open = FALSE; chan->sock = -1; - log_err(-1, __func__, "im_get_tid error"); + log_err(-1, __func__, (char *)"im_get_tid error"); goto err; } @@ -5043,7 +5037,7 @@ void im_request( chan->sock = -1; if (ret == IM_FAILURE) { - log_err(-1, __func__, "handle_im_join_job_response error"); + log_err(-1, __func__, (char *)"handle_im_join_job_response error"); goto err; } @@ -5056,7 +5050,7 @@ void im_request( chan->sock = -1; if (ret == IM_FAILURE) { - log_err(-1, __func__, "handle_im_kill_job_response error"); + log_err(-1, __func__, (char *)"handle_im_kill_job_response error"); goto err; } @@ -5068,7 +5062,7 @@ void im_request( chan->sock = -1; if (ret == IM_FAILURE) { - log_err(-1, __func__, "handle_im_spawn_task_response error"); + log_err(-1, __func__, (char *)"handle_im_spawn_task_response error"); goto err; } @@ -5080,7 +5074,7 @@ void im_request( chan->sock = -1; if (ret == IM_FAILURE) { - log_err(-1, __func__, "handle_im_get_tasks_response error"); + log_err(-1, __func__, (char *)"handle_im_get_tasks_response error"); goto err; } @@ -5092,7 +5086,7 @@ void im_request( chan->sock = -1; if (ret == IM_FAILURE) { - log_err(-1, __func__, "handle_im_signal_task_response error"); + log_err(-1, __func__, (char *)"handle_im_signal_task_response error"); goto err; } @@ -5104,7 +5098,7 @@ void im_request( chan->sock = -1; if (ret == IM_FAILURE) { - log_err(-1, __func__, "handle_im_obit_task_response error"); + log_err(-1, __func__, (char *)"handle_im_obit_task_response error"); goto err; } @@ -5116,7 +5110,7 @@ void im_request( chan->sock = -1; if (ret == IM_FAILURE) { - log_err(-1, __func__, "handle_im_get_info_response error"); + log_err(-1, __func__, (char *)"handle_im_get_info_response error"); goto err; } @@ -5128,7 +5122,7 @@ void im_request( chan->sock = -1; if (ret == IM_FAILURE) { - log_err(-1, __func__, "handle_im_get_resc_response error"); + log_err(-1, __func__, (char *)"handle_im_get_resc_response error"); goto err; } @@ -5140,7 +5134,7 @@ void im_request( { close_conn(chan->sock, FALSE); chan->sock = -1; - log_err(-1, __func__, "handle_im_poll_job_response error"); + log_err(-1, __func__, (char *)"handle_im_poll_job_response error"); goto err; } close_conn(chan->sock, FALSE); @@ -5167,7 +5161,7 @@ void im_request( case IM_FAILURE: { - log_err(-1, __func__, "IM_FAILURE in IM_GET_TID handle response"); + log_err(-1, __func__, (char *)"IM_FAILURE in IM_GET_TID handle response"); goto err; } } @@ -5218,7 +5212,7 @@ void im_request( if (((pjob->ji_qs.ji_svrflags & JOB_SVFLG_INTERMEDIATE_MOM) == 0) && ((pjob->ji_qs.ji_svrflags & JOB_SVFLG_HERE) == 0)) { - log_err(-1, __func__, "got JOIN_JOB OKAY and I'm not an intermediate MOM or Mother Superior"); + log_err(-1, __func__, (char *)"got JOIN_JOB OKAY and I'm not an intermediate MOM or Mother Superior"); goto err; } @@ -5418,7 +5412,7 @@ void im_request( close_conn(chan->sock, FALSE); svr_conn[chan->sock].cn_stay_open = FALSE; chan->sock = -1; - log_err(-1, __func__, "Count not read cput||mem||vmem||nodeid"); + log_err(-1, __func__, (char *)"Count not read cput||mem||vmem||nodeid"); goto err; } @@ -5501,7 +5495,7 @@ void im_request( close_conn(chan->sock, FALSE); svr_conn[chan->sock].cn_stay_open = FALSE; chan->sock = -1; - log_err(-1, __func__, "Count not read cput||mem||vmem||nodeid"); + log_err(-1, __func__, (char *)"Count not read cput||mem||vmem||nodeid"); goto err; } @@ -5567,7 +5561,7 @@ void im_request( close_conn(chan->sock, FALSE); svr_conn[chan->sock].cn_stay_open = FALSE; chan->sock = -1; - log_err(-1, __func__, "KILL_JOB_RADIX OK received on a leaf node"); + log_err(-1, __func__, (char *)"KILL_JOB_RADIX OK received on a leaf node"); goto err; } @@ -5613,7 +5607,7 @@ void im_request( svr_conn[chan->sock].cn_stay_open = FALSE; chan->sock = -1; - log_err(-1, __func__, "Could not read error code"); + log_err(-1, __func__, (char *)"Could not read error code"); goto err; } @@ -5626,7 +5620,7 @@ void im_request( close_conn(chan->sock, FALSE); svr_conn[chan->sock].cn_stay_open = FALSE; - log_err(-1, __func__, "IM_GET_TID close_conn"); + log_err(-1, __func__, (char *)"IM_GET_TID close_conn"); goto err; } @@ -5647,7 +5641,7 @@ void im_request( */ if ((pjob->ji_qs.ji_svrflags & JOB_SVFLG_HERE) == 0) { - log_err(-1, __func__, "JOIN_JOB ERROR and I'm not MS"); + log_err(-1, __func__, (char *)"JOIN_JOB ERROR and I'm not MS"); goto err; } @@ -5666,7 +5660,7 @@ void im_request( if ((pjob->ji_qs.ji_svrflags & JOB_SVFLG_HERE) == 0) { - log_err(-1, __func__, "KILL_JOB ERROR and I'm not MS"); + log_err(-1, __func__, (char *)"KILL_JOB ERROR and I'm not MS"); goto err; } @@ -5774,7 +5768,7 @@ void im_request( if ((pjob->ji_qs.ji_svrflags & JOB_SVFLG_HERE) == 0) { - log_err(-1, __func__, "POLL_JOB ERROR and I'm not MS"); + log_err(-1, __func__, (char *)"POLL_JOB ERROR and I'm not MS"); goto err; } @@ -6125,7 +6119,7 @@ int tm_spawn_request( if (argv == NULL) { - log_err(ENOMEM, __func__, "No memory available, cannot calloc!"); + log_err(ENOMEM, __func__, (char *)"No memory available, cannot calloc!"); return(TM_ERROR); } @@ -6150,7 +6144,7 @@ int tm_spawn_request( if (envp == NULL) { - log_err(ENOMEM, __func__, "No memory available, cannot calloc!"); + log_err(ENOMEM, __func__, (char *)"No memory available, cannot calloc!"); return(TM_ERROR); } @@ -6781,7 +6775,7 @@ int tm_obit_request( if (op == NULL) { - log_err(ENOMEM, __func__, "No memory! Cannot calloc!"); + log_err(ENOMEM, __func__, (char *)"No memory! Cannot calloc!"); return(TM_ERROR); } @@ -7913,7 +7907,7 @@ int get_job_struct( if ((new_job = job_alloc()) == NULL) { /* out of memory */ - log_err(-1, __func__, "insufficient memory to create job"); + log_err(-1, __func__, (char *)"insufficient memory to create job"); ret = PBSE_SYSTEM; @@ -8082,11 +8076,7 @@ void fork_demux( int pipe_failed = FALSE; char buf[MAXLINE]; - if((maxfd = sysconf(_SC_OPEN_MAX)) < 0) - { - fprintf(stderr, "Unexpected return from sysconf."); - return; - } + maxfd = sysconf(_SC_OPEN_MAX); routem = (struct routefd *)calloc(sizeof(struct routefd), maxfd); if (routem == NULL) @@ -8118,7 +8108,7 @@ void fork_demux( close(pjob->ji_im_stdout); im_mom_stderr = dup(pjob->ji_im_stderr); - if (im_mom_stderr == -1) + if (im_mom_stdout == -1) { fprintf(stderr, "could not dup stdout in fork_demux"); free(routem); @@ -8135,7 +8125,7 @@ void fork_demux( /* create pipe so that child can tell us when the demux is opened */ if (pipe(pipes) == -1) { - log_err(errno, __func__, "Couldn't create the pipe!"); + log_err(errno, __func__, (char *)"Couldn't create the pipe!"); pipe_failed = TRUE; } @@ -8436,7 +8426,7 @@ received_node *get_received_node_entry( if (rn == NULL) { - log_err(ENOMEM, __func__, "No memory to allocate for status information\n"); + log_err(ENOMEM, __func__, (char *)"No memory to allocate for status information\n"); return(NULL); } @@ -8446,7 +8436,7 @@ received_node *get_received_node_entry( if (rn->statuses == NULL) { - log_err(ENOMEM, __func__, "No memory to allocate for status information\n"); + log_err(ENOMEM, __func__, (char *)"No memory to allocate for status information\n"); free(rn); return(NULL); } @@ -8466,7 +8456,7 @@ received_node *get_received_node_entry( index = insert_thing(received_statuses, rn); if (index == -1) - log_err(ENOMEM, __func__, "No memory to resize the received_statuses array...SYSTEM FAILURE\n"); + log_err(ENOMEM, __func__, (char *)"No memory to resize the received_statuses array...SYSTEM FAILURE\n"); else { add_hash(received_table, index, rn->hostname); diff --git a/src/resmom/mom_job_func.c b/src/resmom/mom_job_func.c index fc708a65aa..5620ba0614 100644 --- a/src/resmom/mom_job_func.c +++ b/src/resmom/mom_job_func.c @@ -289,7 +289,7 @@ int remtree( { if (errno != ENOENT) - log_err(errno, __func__, "stat"); + log_err(errno, __func__, (char *)"stat"); return(-1); } @@ -299,7 +299,7 @@ int remtree( if ((dir = opendir(dirname)) == NULL) { if (errno != ENOENT) - log_err(errno, __func__, "opendir"); + log_err(errno, __func__, (char *)"opendir"); return(-1); } @@ -326,7 +326,7 @@ int remtree( if (lstat(namebuf, &sb) == -1) #endif { - log_err(errno, __func__, "stat"); + log_err(errno, __func__, (char *)"stat"); rtnv = -1; @@ -484,7 +484,7 @@ job *job_alloc(void) if (pj == NULL) { - log_err(errno, "job_alloc", "no memory"); + log_err(errno, "job_alloc", (char *)"no memory"); return(NULL); } @@ -818,7 +818,7 @@ void mom_job_purge( if (jfdi == NULL) { - log_err(ENOMEM,__func__,"No space to allocate info for job file deletion"); + log_err(ENOMEM,__func__, (char *)"No space to allocate info for job file deletion"); return; } diff --git a/src/resmom/mom_main.c b/src/resmom/mom_main.c index 9255f19a31..6652205545 100644 --- a/src/resmom/mom_main.c +++ b/src/resmom/mom_main.c @@ -228,7 +228,7 @@ int is_login_node = FALSE; /* externs */ -extern char *server_alias; +char *server_alias = NULL; extern unsigned int pe_alarm_time; extern long MaxConnectTimeout; @@ -402,7 +402,6 @@ static unsigned long setapbasilprotocol(char *); static unsigned long setreportermom(char *); static unsigned long setloginnode(char *); static unsigned long setrejectjobsubmission(char *); -unsigned long rppthrottle(char *value); static struct specials { @@ -470,7 +469,6 @@ static struct specials { "memory_pressure_duration", setmempressdur }, #endif { "reduce_prolog_checks", setreduceprologchecks}, - { "rpp_throttle", rppthrottle }, { "thread_unlink_calls", setthreadunlinkcalls }, { "attempt_to_make_dir", setattempttomakedir }, { "ext_pwd_retry", setextpwdretry }, @@ -691,7 +689,7 @@ char *nullproc( struct rm_attribute *attrib) { - log_err(-1, __func__, "should not be called"); + log_err(-1, __func__, (char *)"should not be called"); return(NULL); } /* END nullproc() */ @@ -963,7 +961,7 @@ static char *reqvarattr( { /* FAILURE - cannot alloc memory */ - log_err(errno, __func__, "cannot alloc memory"); + log_err(errno, __func__, (char *)"cannot alloc memory"); return(" "); } @@ -1002,7 +1000,7 @@ static char *reqvarattr( if (list == NULL) { - log_err(errno, __func__, "cannot alloc memory"); + log_err(errno, __func__, (char *)"cannot alloc memory"); return(" "); } @@ -1051,7 +1049,7 @@ static char *reqvarattr( if (len == -1) { /* FAILURE - cannot read var script output */ - log_err(errno, __func__, "pipe read"); + log_err(errno, __func__, (char *)"pipe read"); sprintf(pva->va_value, "? %d", RM_ERR_SYSTEM); @@ -1111,7 +1109,7 @@ static char *reqvarattr( if (list == NULL) { - log_err(errno, __func__, "cannot alloc memory"); + log_err(errno, __func__, (char *)"cannot alloc memory"); return(" "); } @@ -1492,7 +1490,7 @@ void memcheck( return; } - log_err(-1, "memcheck", "memory allocation failed"); + log_err(-1, "memcheck", (char *)"memory allocation failed"); die(0); @@ -1749,7 +1747,7 @@ static u_long settmpdir( if (*Value != '/') { - log_err(-1, __func__, "tmpdir must be a full path"); + log_err(-1, __func__, (char *)"tmpdir must be a full path"); return(0); } @@ -1791,7 +1789,7 @@ static u_long setxauthpath( if (*Value != '/') { - log_err(-1, __func__, "xauthpath must be a full path"); + log_err(-1, __func__, (char *)"xauthpath must be a full path"); return(0); } @@ -1815,7 +1813,7 @@ static u_long setrcpcmd( if (*Value != '/') { - log_err(-1, __func__, "rcpcmd must be a full path"); + log_err(-1, __func__, (char *)"rcpcmd must be a full path"); /* FAILURE */ @@ -1883,7 +1881,7 @@ static u_long restricted( { /* FAILURE - cannot alloc memory */ - log_err(errno, __func__, "cannot alloc memory"); + log_err(errno, __func__, (char *)"cannot alloc memory"); return(-1); } @@ -1897,7 +1895,7 @@ static u_long restricted( { /* FAILURE - cannot alloc memory */ - log_err(errno, __func__, "cannot alloc memory"); + log_err(errno, __func__, (char *)"cannot alloc memory"); return(-1); } @@ -1916,7 +1914,7 @@ static u_long restricted( { /* FAILURE - cannot alloc memory */ - log_err(errno, __func__, "cannot alloc memory"); + log_err(errno, __func__, (char *)"cannot alloc memory"); return(-1); } @@ -2304,7 +2302,7 @@ static unsigned long setpreexec( snprintf(PRE_EXEC, sizeof(PRE_EXEC), "%s", value); #if SHELL_USE_ARGV == 0 - log_err(0, __func__, "pbs_mom not configured with enable-shell-user-argv option"); + log_err(0, __func__, (char *)"pbs_mom not configured with enable-shell-user-argv option"); #endif return(1); @@ -2856,21 +2854,6 @@ static unsigned long setlogfilemaxsize( } -unsigned long rppthrottle( - - char *value) /* I */ - - { - long rpp_throttle_time; - rpp_throttle_time = strtol(value, NULL, 10); - /* call into Libifl to tell it what the sleep time is */ - set_rpp_throttle_sleep_time(rpp_throttle_time); - - return(rpp_throttle_time); - } - - - static unsigned long setlogfilerolldepth( @@ -2972,7 +2955,7 @@ static u_long setvarattr( { /* FAILURE */ - log_err(errno, __func__, "no memory"); + log_err(errno, __func__, (char *)"no memory"); return(0); } @@ -3441,7 +3424,7 @@ void check_log(void) if (log_remove_old(path_log,(LOGKEEPDAYS * SECS_PER_DAY)) != 0) { - log_err(-1,"check_log","failure occurred when checking for old pbs_mom logs"); + log_err(-1,"check_log", (char *)"failure occurred when checking for old pbs_mom logs"); } } @@ -4010,7 +3993,7 @@ char *conf_res( if (attr != NULL) { /* too many params */ - log_err(-1, __func__, "too many params"); + log_err(-1, __func__, (char *)"too many params"); sprintf(ret_string, "? %d", RM_ERR_BADPARAM); @@ -4068,7 +4051,7 @@ char *conf_res( if (!used[i]) { /* parameter sent but not used */ - log_err(-1, __func__, "unused parameters"); + log_err(-1, __func__, (char *)"unused parameters"); sprintf(ret_string, "? %d", RM_ERR_BADPARAM); @@ -4083,7 +4066,7 @@ char *conf_res( if ((child = popen(ret_string, "r")) == NULL) { - log_err(errno, __func__, "popen"); + log_err(errno, __func__, (char *)"popen"); sprintf(ret_string, "? %d", RM_ERR_SYSTEM); @@ -4129,7 +4112,7 @@ char *conf_res( goto retryread; } - log_err(errno, __func__, "pipe read"); + log_err(errno, __func__, (char *)"pipe read"); sprintf(ret_string, "? %d", RM_ERR_SYSTEM); @@ -4211,9 +4194,6 @@ static void catch_hup( call_hup = 1; - rpp_dbprt = 1 - rpp_dbprt; /* toggle debug prints for RPP */ - - return; } /* END catch_hup() */ @@ -5345,7 +5325,7 @@ int rm_request( if (DIS_tcp_wflush(chan) == -1) { - log_err(errno, __func__, "flush"); + log_err(errno, __func__, (char *)"flush"); goto bad; } @@ -5362,14 +5342,14 @@ int rm_request( if (MOMConfigRReconfig == FALSE) { log_err(-1, __func__, - "remote reconfiguration disabled, ignoring request"); + (char *)"remote reconfiguration disabled, ignoring request"); goto bad; } if (restrictrm) { - log_err(-1, __func__, "restricted configure attempt"); + log_err(-1, __func__, (char *)"restricted configure attempt"); goto bad; } @@ -5446,7 +5426,7 @@ int rm_request( if (DIS_tcp_wflush(chan) == -1) { - log_err(errno, __func__, "flush"); + log_err(errno, __func__, (char *)"flush"); goto bad; } @@ -5459,7 +5439,7 @@ int rm_request( if (restrictrm) { - log_err(-1, __func__, "restricted shutdown attempt"); + log_err(-1, __func__, (char *)"restricted shutdown attempt"); goto bad; } @@ -5905,7 +5885,7 @@ int kill_job( { if (run_pelog(PE_EPILOGUSER, path_epilogpdel, pjob, PE_IO_TYPE_NULL) != 0) { - log_err(-1, __func__, "precancel epilog failed"); + log_err(-1, __func__, (char *)"precancel epilog failed"); sprintf(PBSNodeMsgBuf, "ERROR: precancel epilog failed"); } @@ -7279,19 +7259,19 @@ int setup_program_environment(void) /* load system topology */ if ((hwloc_topology_init(&topology) == -1)) { - log_err(-1, msg_daemonname, "Unable to init machine topology"); + log_err(-1, msg_daemonname, (char *)"Unable to init machine topology"); return(-1); } if ((hwloc_topology_set_flags(topology, HWLOC_TOPOLOGY_FLAG_WHOLE_SYSTEM) != 0)) { - log_err(-1, msg_daemonname, "Unable to configure machine topology"); + log_err(-1, msg_daemonname, (char *)"Unable to configure machine topology"); return(-1); } if ((hwloc_topology_load(topology) == -1)) { - log_err(-1, msg_daemonname, "Unable to load machine topology"); + log_err(-1, msg_daemonname, (char *)"Unable to load machine topology"); return(-1); } @@ -7332,7 +7312,7 @@ int setup_program_environment(void) if (setsid() == -1) { - log_err(errno, msg_daemonname, "setsid failed"); + log_err(errno, msg_daemonname, (char *)"setsid failed"); return(2); } @@ -7384,7 +7364,7 @@ int setup_program_environment(void) if (ftruncate(lockfds, (off_t)0) != 0) { - log_err(errno, msg_daemonname, "failed to truncate lockfile"); + log_err(errno, msg_daemonname, (char *)"failed to truncate lockfile"); return(2); } @@ -7394,7 +7374,7 @@ int setup_program_environment(void) if (write(lockfds, log_buffer, strlen(log_buffer) + 1) != (ssize_t)(strlen(log_buffer) + 1)) { - log_err(errno, msg_daemonname, "failed to write to lockfile"); + log_err(errno, msg_daemonname, (char *)"failed to write to lockfile"); return(2); } @@ -7406,7 +7386,7 @@ int setup_program_environment(void) if (plock(PROCLOCK) == -1) { - log_err(errno, msg_daemonname, "failed to lock mom into memory with plock"); + log_err(errno, msg_daemonname, (char *)"failed to lock mom into memory with plock"); } else { @@ -7586,7 +7566,7 @@ int setup_program_environment(void) if (c == -1) { - log_err(-1, msg_daemonname, "Unable to get my host name"); + log_err(-1, msg_daemonname, (char *)"Unable to get my host name"); return(-1); } @@ -7633,14 +7613,14 @@ int setup_program_environment(void) /* initialize machine-dependent polling routines */ if ((c = mom_open_poll()) != PBSE_NONE) { - log_err(c, msg_daemonname, "pre_poll failed"); + log_err(c, msg_daemonname, (char *)"pre_poll failed"); return(3); } if (mom_get_sample() != PBSE_NONE) { - log_err(c, msg_daemonname, "mom_get_sample failed after mom_open_poll"); + log_err(c, msg_daemonname, (char *)"mom_get_sample failed after mom_open_poll"); return(3); } @@ -7723,7 +7703,7 @@ int setup_program_environment(void) if ((received_statuses == NULL) || (received_table == NULL)) { - log_err(ENOMEM, __func__, "No memory!!!"); + log_err(ENOMEM, __func__, (char *)"No memory!!!"); return(-1); } @@ -8433,7 +8413,7 @@ void main_loop(void) /* unblock signals */ if (sigprocmask(SIG_UNBLOCK, &allsigs, NULL) == -1) - log_err(errno, __func__, "sigprocmask(UNBLOCK)"); + log_err(errno, __func__, (char *)"sigprocmask(UNBLOCK)"); time_now = time((time_t *)0); @@ -8460,13 +8440,13 @@ void main_loop(void) init_network(pbs_rm_port, tcp_request); } - log_err(-1, msg_daemonname, "wait_request failed"); + log_err(-1, msg_daemonname, (char *)"wait_request failed"); } /* block signals while we do things */ if (sigprocmask(SIG_BLOCK, &allsigs, NULL) == -1) - log_err(errno, __func__, "sigprocmask(BLOCK)"); + log_err(errno, __func__, (char *)"sigprocmask(BLOCK)"); if ((pjob = (job *)GET_NEXT(svr_alljobs)) == NULL) @@ -8591,7 +8571,7 @@ int read_layout_file() /* Allocate temp nodeset */ if ((nodeset = hwloc_bitmap_alloc()) == NULL) { - log_err(errno, __func__, "failed to allocate nodeset"); + log_err(errno, __func__, (char *)"failed to allocate nodeset"); return(-1); } @@ -8637,7 +8617,7 @@ int read_layout_file() /* Store nodeset of node_boards[i], may be empty */ if ((node_boards[i].nodeset = hwloc_bitmap_dup(nodeset)) == NULL) { - log_err(errno, __func__, "failed to duplicate nodeset"); + log_err(errno, __func__, (char *)"failed to duplicate nodeset"); return(-1); } @@ -8712,7 +8692,7 @@ int setup_nodeboards() /* Read mom.layout, init nodesets */ if ((rc = read_layout_file()) != PBSE_NONE) { - log_err(-1, __func__, "Could not read layout file!\n"); + log_err(-1, __func__, (char *)"Could not read layout file!\n"); exit(rc); } @@ -8727,7 +8707,7 @@ int setup_nodeboards() /* Allocate cpuset for this nodeboard */ if ((node_boards[i].cpuset = hwloc_bitmap_alloc()) == NULL) { - log_err(errno, __func__, "failed to allocate cpuset"); + log_err(errno, __func__, (char *)"failed to allocate cpuset"); exit(-1); } @@ -8774,7 +8754,7 @@ int setup_nodeboards() { if ((node_boards[i].path_meminfo = (char **)calloc(node_boards[i].num_nodes, sizeof(char *))) == NULL) { - log_err(errno, __func__, "failed to allocate memory"); + log_err(errno, __func__, (char *)"failed to allocate memory"); exit(-1); } @@ -8783,7 +8763,7 @@ int setup_nodeboards() { if ((node_boards[i].path_meminfo[k] = (char *)calloc(1, mempath_len)) == NULL) { - log_err(errno, __func__, "failed to allocate memory"); + log_err(errno, __func__, (char *)"failed to allocate memory"); exit(-1); } @@ -8944,7 +8924,7 @@ im_compose_info *create_compose_reply_info( ici->taskid = taskid; } else - log_err(ENOMEM, __func__, "Cannot allocate memory!"); + log_err(ENOMEM, __func__, (char *)"Cannot allocate memory!"); return(ici); } /* END create_compose_reply_info() */ diff --git a/src/resmom/mom_main.h b/src/resmom/mom_main.h index 022b83f2a2..505e7a8885 100644 --- a/src/resmom/mom_main.h +++ b/src/resmom/mom_main.h @@ -148,8 +148,6 @@ u_long addclient(char *name); /* static unsigned long setlogfilemaxsize(char *value); */ -unsigned long rppthrottle(char *value); - /* static unsigned long setlogfilerolldepth(char *value); */ /* static unsigned long setlogdirectory(char *value); */ diff --git a/src/resmom/mom_req_quejob.c b/src/resmom/mom_req_quejob.c index 3cda29d7ef..c5a25df2a7 100644 --- a/src/resmom/mom_req_quejob.c +++ b/src/resmom/mom_req_quejob.c @@ -229,7 +229,7 @@ void req_quejob( { /* request must be from server */ - log_err(errno, __func__, "request not from server"); + log_err(errno, __func__, (char *)"request not from server"); req_reject(PBSE_IVALREQ, 0, preq, NULL, "request not received from server"); @@ -280,7 +280,7 @@ void req_quejob( { /* FAILURE - job exists and is running */ - log_err(errno, __func__, "cannot queue new job, job exists and is running"); + log_err(errno, __func__, (char *)"cannot queue new job, job exists and is running"); req_reject(PBSE_JOBEXIST, 0, preq, NULL, "job is running"); @@ -585,7 +585,7 @@ void req_jobscript( if (pj == NULL) { - log_err(errno, __func__, "cannot locate new job"); + log_err(errno, __func__, (char *)"cannot locate new job"); req_reject(PBSE_IVALREQ, 0, preq, NULL, NULL); @@ -848,7 +848,7 @@ void req_rdytocommit( if (pj == NULL) { /* FAILURE */ - log_err(errno, "req_rdytocommit", "unknown job id"); + log_err(errno, "req_rdytocommit", (char *)"unknown job id"); req_reject(PBSE_UNKJOBID, 0, preq, NULL, NULL); @@ -858,7 +858,7 @@ void req_rdytocommit( if (pj->ji_qs.ji_substate != JOB_SUBSTATE_TRANSIN) { /* FAILURE */ - log_err(errno, "req_rdytocommit", "cannot commit job in unexpected state"); + log_err(errno, "req_rdytocommit", (char *)"cannot commit job in unexpected state"); req_reject(PBSE_IVALREQ, 0, preq, NULL, NULL); @@ -1004,7 +1004,7 @@ void req_commit( if (pj->ji_qs.ji_substate != JOB_SUBSTATE_TRANSICM) { - log_err(errno, "req_commit", "cannot commit job in unexpected state"); + log_err(errno, "req_commit", (char *)"cannot commit job in unexpected state"); req_reject(PBSE_IVALREQ, 0, preq, NULL, NULL); diff --git a/src/resmom/mom_server.c b/src/resmom/mom_server.c index 7320a3abc3..4350207114 100644 --- a/src/resmom/mom_server.c +++ b/src/resmom/mom_server.c @@ -1343,7 +1343,7 @@ void node_comm_error( { snprintf(log_buffer,sizeof(log_buffer), "%s %s", message, nc->name); - log_err(-1,"Node communication process",log_buffer); + log_err(-1, (char *)"Node communication process",log_buffer); close(nc->stream); nc->stream = -1; @@ -1560,7 +1560,7 @@ void mom_server_all_update_stat(void) } if (rc == COULD_NOT_CONTACT_SERVER) - log_err(-1, __func__, "Could not contact any of the servers to send an update"); + log_err(-1, __func__, (char *)"Could not contact any of the servers to send an update"); } else close(nc->stream); diff --git a/src/resmom/nvidia.c b/src/resmom/nvidia.c index 5f48a04d55..873ad6da1e 100644 --- a/src/resmom/nvidia.c +++ b/src/resmom/nvidia.c @@ -156,7 +156,7 @@ void log_nvml_error( log_err( PBSE_RMSYSTEM, id, - "Successful"); + (char *)"Successful"); } break; case NVML_ERROR_ALREADY_INITIALIZED: @@ -165,7 +165,7 @@ void log_nvml_error( log_err( PBSE_RMSYSTEM, id, - "Already initialized"); + (char *)"Already initialized"); } break; case NVML_ERROR_NO_PERMISSION: @@ -174,7 +174,7 @@ void log_nvml_error( log_err( PBSE_RMSYSTEM, id, - "No permission"); + (char *)"No permission"); } break; case NVML_ERROR_INVALID_ARGUMENT: @@ -183,7 +183,7 @@ void log_nvml_error( log_err( PBSE_RMSYSTEM, id, - "NVML invalid argument"); + (char *)"NVML invalid argument"); } break; case NVML_ERROR_NOT_FOUND: @@ -214,7 +214,7 @@ void log_nvml_error( log_err( PBSE_RMSYSTEM, id, - "Unknown error"); + (char *)"Unknown error"); } break; default: @@ -350,7 +350,7 @@ static int check_nvidia_module_loaded() log_err( errno, id, - "Failed to read /proc/modules"); + (char *)"Failed to read /proc/modules"); } return(FALSE); } @@ -374,7 +374,7 @@ static int check_nvidia_module_loaded() log_err( PBSE_RMSYSTEM, id, - "No Nvidia driver loaded"); + (char *)"No Nvidia driver loaded"); } fclose(file); @@ -400,7 +400,7 @@ static int check_nvidia_version_file() log_err( PBSE_RMSYSTEM, id, - "No Nvidia driver info available. Driver not supported?"); + (char *)"No Nvidia driver info available. Driver not supported?"); } return(FALSE); } @@ -1842,7 +1842,7 @@ void generate_server_gpustatus_smi( /* unknown driver version */ if (LOGLEVEL >= 3) { - log_err(PBSE_RMSYSTEM, __func__, "Unknown Nvidia driver version"); + log_err(PBSE_RMSYSTEM, __func__, (char *)"Unknown Nvidia driver version"); } /* need to advance dataptr so we don't recycle through same gpu */ diff --git a/src/resmom/prolog.c b/src/resmom/prolog.c index e9d69f86a6..377679c12b 100644 --- a/src/resmom/prolog.c +++ b/src/resmom/prolog.c @@ -324,7 +324,7 @@ int undo_set_euid_egid( (setegid(real_gid) != 0) || (setgroups(num_gids,real_gids) != 0)) { - log_err(errno,id,"Couldn't revert back to the root user - IMMINENT FAILURE but will try to continue\n"); + log_err(errno,id, (char *)"Couldn't revert back to the root user - IMMINENT FAILURE but will try to continue\n"); } return(-1); @@ -457,7 +457,7 @@ int run_pelog( real_gid = getgid(); if ((num_gids = getgroups(0, real_gids)) < 0) { - log_err(errno, __func__, "getgroups failed\n"); + log_err(errno, __func__, (char *)"getgroups failed\n"); return(-1); } @@ -473,14 +473,14 @@ int run_pelog( if (real_gids == NULL) { - log_err(ENOMEM, __func__, "Cannot allocate memory! FAILURE\n"); + log_err(ENOMEM, __func__, (char *)"Cannot allocate memory! FAILURE\n"); return(-1); } if (getgroups(num_gids,real_gids) < 0) { - log_err(errno, __func__, "getgroups failed\n"); + log_err(errno, __func__, (char *)"getgroups failed\n"); free(real_gids); return(-1); @@ -630,7 +630,7 @@ int run_pelog( { undo_set_euid_egid(which,real_uid,real_gid,num_gids,real_gids,__func__); free(real_gids); - return(pelog_err(pjob,pelog,-1,"permission Error")); + return(pelog_err(pjob,pelog,-1, (char *)"permission Error")); } } else @@ -644,7 +644,7 @@ int run_pelog( { undo_set_euid_egid(which,real_uid,real_gid,num_gids,real_gids,__func__); free(real_gids); - return(pelog_err(pjob,pelog,-1,"permission Error")); + return(pelog_err(pjob,pelog,-1, (char *)"permission Error")); } } else if ((sbuf.st_uid != 0) || @@ -654,7 +654,7 @@ int run_pelog( { undo_set_euid_egid(which,real_uid,real_gid,num_gids,real_gids,__func__); free(real_gids); - return(pelog_err(pjob,pelog,-1,"permission Error")); + return(pelog_err(pjob,pelog,-1, (char *)"permission Error")); } if ((which == PE_PROLOGUSER) || (which == PE_EPILOGUSER)) @@ -665,7 +665,7 @@ int run_pelog( { undo_set_euid_egid(which,real_uid,real_gid,num_gids,real_gids,__func__); free(real_gids); - return(pelog_err(pjob, pelog, -1, "permission Error")); + return(pelog_err(pjob, pelog, -1, (char *)"permission Error")); } } } /* END !reduceprologchecks */ @@ -676,7 +676,7 @@ int run_pelog( { undo_set_euid_egid(which,real_uid,real_gid,num_gids,real_gids,__func__); free(real_gids); - return(pelog_err(pjob, pelog, -2, "no pro/epilogue input file")); + return(pelog_err(pjob, pelog, -2, (char *)"no pro/epilogue input file")); } run_exit = 0; @@ -1294,25 +1294,25 @@ int run_pelog( case - 3: - pelog_err(pjob, pelog, run_exit, "child wait interrupted"); + pelog_err(pjob, pelog, run_exit, (char *)"child wait interrupted"); break; case - 4: - pelog_err(pjob, pelog, run_exit, "prolog/epilog timeout occurred, child cleaned up"); + pelog_err(pjob, pelog, run_exit, (char *)"prolog/epilog timeout occurred, child cleaned up"); break; case - 5: - pelog_err(pjob, pelog, run_exit, "prolog/epilog timeout occurred, cannot kill child"); + pelog_err(pjob, pelog, run_exit, (char *) "prolog/epilog timeout occurred, cannot kill child"); break; default: - pelog_err(pjob, pelog, run_exit, "nonzero p/e exit status"); + pelog_err(pjob, pelog, run_exit, (char *)"nonzero p/e exit status"); break; } /* END switch (run_exit) */ diff --git a/src/resmom/requests.c b/src/resmom/requests.c index 8554194c26..ee83047461 100644 --- a/src/resmom/requests.c +++ b/src/resmom/requests.c @@ -1269,7 +1269,7 @@ int message_job( if ((pjob->ji_qs.ji_svrflags & JOB_SVFLG_HERE) == 0) { - log_err(errno, "message_job", "cannot message job, not mother superior"); + log_err(errno, "message_job", (char *)"cannot message job, not mother superior"); return(PBSE_MOMREJECT); } @@ -1320,7 +1320,7 @@ int message_job( alarm(alarm_time); if (write(fds, text, len) != len) { - log_err(errno, "message_job", "unable to write message to job"); + log_err(errno, "message_job", (char *)"unable to write message to job"); rc = PBSE_INTERNAL; } @@ -1328,7 +1328,7 @@ int message_job( if (close(fds) != 0) { - log_err(errno, "message_job", "unable to write message to job"); + log_err(errno, "message_job", (char *)"unable to write message to job"); rc = PBSE_INTERNAL; } @@ -1755,7 +1755,7 @@ static void cray_susp_resum( { /* fork failed - still the main mom */ - log_err(-1, __func__, "cannot fork child for cray suspend"); + log_err(-1, __func__, (char *)"cannot fork child for cray suspend"); req_reject(PBSE_SYSTEM, errno, preq, NULL, NULL); @@ -3637,7 +3637,7 @@ void req_cpyfile( if ((mkdir(needdir, 01777) == -1) && (errno != EEXIST)) { - log_err(errno, __func__, "Failed to create jobs checkpoint directory"); + log_err(errno, __func__, (char *)"Failed to create jobs checkpoint directory"); } umask(saveumask); diff --git a/src/resmom/solaris7/mom_mach.c b/src/resmom/solaris7/mom_mach.c index 0fe97b030e..b0e62263d3 100644 --- a/src/resmom/solaris7/mom_mach.c +++ b/src/resmom/solaris7/mom_mach.c @@ -241,7 +241,7 @@ dep_initialize(void) if ((pdir = opendir(procfs)) == NULL) { - log_err(errno, id, "opendir"); + log_err(errno, id, (char *)"opendir"); return; } @@ -771,7 +771,7 @@ mom_open_poll(void) if (proc_info == NULL) { - log_err(errno, id, "calloc"); + log_err(errno, id, (char *)"calloc"); return (PBSE_SYSTEM); } @@ -1200,7 +1200,7 @@ mom_close_poll(void) { if (closedir(pdir) != 0) { - log_err(errno, id, "closedir"); + log_err(errno, id, (char *)"closedir"); return (PBSE_SYSTEM); } } @@ -1634,7 +1634,7 @@ sessions(struct rm_attribute *attrib) if ((jids = (pid_t *)calloc(maxjid, sizeof(pid_t))) == NULL) { - log_err(errno, id, "no memory"); + log_err(errno, id, (char *)"no memory"); rm_errno = RM_ERR_SYSTEM; return NULL; } @@ -1676,7 +1676,7 @@ sessions(struct rm_attribute *attrib) if (hold == NULL) { - log_err(errno, id, "realloc"); + log_err(errno, id, (char *)"realloc"); rm_errno = RM_ERR_SYSTEM; free(jids); return NULL; @@ -1818,14 +1818,14 @@ nusers(struct rm_attribute *attrib) if (attrib) { - log_err(-1, id, extra_parm); + log_err(-1, id, (char *)extra_parm); rm_errno = RM_ERR_BADPARAM; return NULL; } if ((uids = (uid_t *)calloc(maxuid, sizeof(uid_t))) == NULL) { - log_err(errno, id, "no memory"); + log_err(errno, id, (char *)"no memory"); rm_errno = RM_ERR_SYSTEM; return NULL; } @@ -1861,7 +1861,7 @@ nusers(struct rm_attribute *attrib) if (hold == NULL) { - log_err(errno, id, "realloc"); + log_err(errno, id, (char *)"realloc"); rm_errno = RM_ERR_SYSTEM; free(uids); return NULL; @@ -1952,7 +1952,7 @@ size_fs(char *param) if (statvfs(param, &fsbuf) == -1) { - log_err(errno, id, "statvfs"); + log_err(errno, id, (char *)"statvfs"); rm_errno = RM_ERR_BADPARAM; return NULL; } @@ -1981,7 +1981,7 @@ size_file(char *param) if (stat(param, &sbuf) == -1) { - log_err(errno, id, "stat"); + log_err(errno, id, (char *)"stat"); rm_errno = RM_ERR_BADPARAM; return NULL; } @@ -2060,7 +2060,7 @@ idletime(struct rm_attribute *attrib) if ((dp = opendir("/dev/pts")) == NULL) { - log_err(errno, id, "opendir /dev"); + log_err(errno, id, (char *)"opendir /dev"); rm_errno = RM_ERR_SYSTEM; return NULL; } @@ -2137,7 +2137,7 @@ walltime(struct rm_attribute *attrib) if ((now = time(NULL)) <= 0) { - log_err(errno, id, "time"); + log_err(errno, id, (char *)"time"); rm_errno = RM_ERR_SYSTEM; return NULL; } @@ -2189,7 +2189,7 @@ get_la(double *rv) if (getloadavg(la, 3) == -1) { - log_err(errno, id, "getloadavg"); + log_err(errno, id, (char *)"getloadavg"); return (rm_errno = RM_ERR_SYSTEM); } diff --git a/src/resmom/start_exec.c b/src/resmom/start_exec.c index 7ceb9a6e1e..da87fc2a85 100644 --- a/src/resmom/start_exec.c +++ b/src/resmom/start_exec.c @@ -826,7 +826,7 @@ static int open_pty( pjob->ji_qs.ji_un.ji_momt.ji_exgid) == -1) { close(pts); - log_err(errno, "open_pty", "cannot change slave's owner"); + log_err(errno, "open_pty", (char *)"cannot change slave's owner"); return -1; } @@ -972,7 +972,7 @@ static int open_std_out_err( } else { - log_err(errno, __func__, "unable to open standard output/error"); + log_err(errno, __func__, (char *)"unable to open standard output/error"); } return(-1); @@ -1043,7 +1043,7 @@ int mkdirtree( oldmask = umask(0000); - part = strtok(path, "/"); + part = strtok(path, (char *)"/"); if (part == NULL) { @@ -1578,7 +1578,7 @@ int mom_jobstarter_execute_job( if (arg[1] == NULL) { - log_err(errno,__func__,"cannot alloc env"); + log_err(errno,__func__, (char *)"cannot alloc env"); return(-1); } @@ -1797,7 +1797,7 @@ struct radix_buf **allocate_sister_list( /* create sister lists to send out to intermediate moms */ if ((sister_list = calloc((size_t)radix, sizeof(struct radix_buf *))) == NULL) { - log_err(ENOMEM,__func__,""); + log_err(ENOMEM,__func__, (char *)""); return(NULL); } @@ -1806,14 +1806,14 @@ struct radix_buf **allocate_sister_list( if ((sister_list[i] = calloc(1, sizeof(struct radix_buf))) == NULL) { free(sister_list); - log_err(ENOMEM,__func__,""); + log_err(ENOMEM,__func__, (char *)""); return(NULL); } if ((sister_list[i]->host_list = calloc(1, THE_LIST_SIZE)) == NULL) { free(sister_list); - log_err(ENOMEM,__func__,""); + log_err(ENOMEM,__func__, (char *)""); return(NULL); } @@ -2033,7 +2033,7 @@ int TMomFinalizeJob1( { /* FAILURE */ - log_err(-1, __func__, "Restart failed"); + log_err(-1, __func__, (char *)"Restart failed"); /* retry for any kind of changable thing */ @@ -2114,7 +2114,7 @@ int TMomFinalizeJob1( if ((TJE->ptc = open_master(&TJE->ptc_name)) < 0) { - log_err(errno, __func__, "cannot open master pty"); + log_err(errno, __func__, (char *)"cannot open master pty"); *SC = JOB_EXEC_RETRY; @@ -2589,7 +2589,7 @@ int write_attr_to_file( { fclose(file); - log_err(ENOMEM,__func__,"Couldn't allocate a string to work with? EPIC FAIL"); + log_err(ENOMEM,__func__, (char *)"Couldn't allocate a string to work with? EPIC FAIL"); return(ENOMEM); } @@ -2749,7 +2749,7 @@ int write_nodes_to_file( else { /* this should never happen */ - log_err(-1, __func__, "Numa enabled but no dash in hostname?"); + log_err(-1, __func__, (char *)"Numa enabled but no dash in hostname?"); } #endif /* def NUMA_SUPPORT */ @@ -2937,7 +2937,7 @@ void handle_prologs( if ((rc = run_pelog(PE_PROLOG, path_prolog, pjob, PE_IO_TYPE_ASIS)) != PBSE_NONE) { - log_err(-1, __func__, "prolog failed"); + log_err(-1, __func__, (char *)"prolog failed"); if ((TJE->is_interactive == FALSE) && (rc != 1)) @@ -2956,7 +2956,7 @@ void handle_prologs( /* run user prolog */ if ((rc = run_pelog(PE_PROLOGUSER, path_prologuser, pjob, PE_IO_TYPE_ASIS)) != PBSE_NONE) { - log_err(-1, __func__, "user prolog failed"); + log_err(-1, __func__, (char *)"user prolog failed"); if ((TJE->is_interactive == FALSE) && (rc != 1)) @@ -2987,7 +2987,7 @@ void handle_prologs( { if ((rc = run_pelog(PE_PROLOGUSERJOB, path_prologuserjob, pjob, PE_IO_TYPE_ASIS)) != PBSE_NONE) { - log_err(-1, __func__, "batch job local user prolog failed"); + log_err(-1, __func__, (char *)"batch job local user prolog failed"); free(path_prologuserjob); if ((TJE->is_interactive == FALSE) && @@ -3069,7 +3069,7 @@ int start_interactive_session( if ((phost == NULL) || ((phost = strchr(phost, '=')) == NULL)) { - log_err(-1, __func__, "PBS_O_HOST not set"); + log_err(-1, __func__, (char *)"PBS_O_HOST not set"); starter_return(TJE->upfds, TJE->downfds, JOB_EXEC_FAIL1, sjr); } @@ -3106,7 +3106,7 @@ int start_interactive_session( if ((*qsub_sock_ptr < 0)|| (write(*qsub_sock_ptr, pjob->ji_qs.ji_jobid, PBS_MAXSVRJOBID + 1) != PBS_MAXSVRJOBID + 1)) { - log_err(errno, __func__, "cannot write jobid"); + log_err(errno, __func__, (char *)"cannot write jobid"); starter_return(TJE->upfds, TJE->downfds, JOB_EXEC_FAIL1, sjr); } @@ -3114,7 +3114,7 @@ int start_interactive_session( /* receive terminal type and window size */ if ((termtype = rcvttype(*qsub_sock_ptr)) == NULL) { - log_err(errno, __func__, "cannot get termtype"); + log_err(errno, __func__, (char *)"cannot get termtype"); starter_return(TJE->upfds, TJE->downfds, JOB_EXEC_FAIL1, sjr); } @@ -3124,7 +3124,7 @@ int start_interactive_session( if (rcvwinsize(*qsub_sock_ptr) == -1) { - log_err(errno, __func__, "cannot get winsize"); + log_err(errno, __func__, (char *)"cannot get winsize"); starter_return(TJE->upfds, TJE->downfds, JOB_EXEC_FAIL1, sjr); } @@ -3141,7 +3141,7 @@ int start_interactive_session( /* open the slave pty as the controlling tty */ if ((*pts_ptr = open_pty(pjob)) < 0) { - log_err(errno, __func__, "cannot open slave"); + log_err(errno, __func__, (char *)"cannot open slave"); starter_return(TJE->upfds, TJE->downfds, JOB_EXEC_FAIL1, sjr); } @@ -3287,7 +3287,7 @@ void setup_interactive_job( shutdown(*qsub_sock_ptr, 2); /* change pty back to available after job is done */ - chmod(TJE->ptc_name, 0666); + chmod((char *)TJE->ptc_name, 0666); if (chown(TJE->ptc_name, 0, 0) == -1) { @@ -3299,7 +3299,7 @@ void setup_interactive_job( else { /* FAILURE - fork failed */ - log_err(errno, __func__, "cannot fork nanny"); + log_err(errno, __func__, (char *)"cannot fork nanny"); /* change pty back to available */ chmod(TJE->ptc_name, 0666); @@ -3367,7 +3367,7 @@ void set_job_script_as_stdin( if (script_in < 0) { - log_err(errno, __func__, "unable to open script"); + log_err(errno, __func__, (char *)"unable to open script"); starter_return(TJE->upfds, TJE->downfds, JOB_EXEC_FAIL1, sjr); } @@ -3412,7 +3412,7 @@ void setup_batch_job( /* NOTE: set arg2 to 5 to enable file open timeout check */ if (open_std_out_err(pjob, 0) == -1) { - log_err(-1, __func__, "unable to open stdout/stderr descriptors"); + log_err(-1, __func__, (char *)"unable to open stdout/stderr descriptors"); starter_return(TJE->upfds, TJE->downfds, JOB_EXEC_STDOUTFAIL, sjr); } @@ -3477,7 +3477,7 @@ void attempt_to_set_limits( } else { - log_err(errno, __func__, "mom_set_limits failed"); + log_err(errno, __func__, (char *)"mom_set_limits failed"); } starter_return(TJE->upfds, TJE->downfds, j, sjr); /* exits */ @@ -3614,7 +3614,7 @@ void setup_interactive_command_if_present( if (arg[aindex] == NULL) { - log_err(errno, __func__, "cannot alloc env"); + log_err(errno, __func__, (char *)"cannot alloc env"); starter_return(TJE->upfds, TJE->downfds, JOB_EXEC_FAIL2, sjr); } @@ -3629,7 +3629,7 @@ void setup_interactive_command_if_present( if (arg[aindex] == NULL) { - log_err(errno, __func__, "cannot alloc env"); + log_err(errno, __func__, (char *)"cannot alloc env"); starter_return(TJE->upfds, TJE->downfds, JOB_EXEC_FAIL2, sjr); } @@ -3697,7 +3697,7 @@ void add_preexec_if_needed( if (arg[aindex] == NULL) { - log_err(errno, __func__, "cannot alloc env"); + log_err(errno, __func__, (char *)"cannot alloc env"); starter_return(TJE->upfds, TJE->downfds, JOB_EXEC_FAIL2, sjr); } @@ -3755,7 +3755,7 @@ void launch_the_demux( if (arg[aindex] == NULL) { - log_err(errno, __func__, "cannot alloc env"); + log_err(errno, __func__, (char *)"cannot alloc env"); starter_return(TJE->upfds, TJE->downfds, JOB_EXEC_FAIL2, sjr); } @@ -3798,7 +3798,7 @@ void source_login_shells_or_not( if (arg[aindex] == NULL) { - log_err(errno, __func__, "cannot alloc env"); + log_err(errno, __func__, (char *)"cannot alloc env"); starter_return(TJE->upfds, TJE->downfds, JOB_EXEC_FAIL2, sjr); } @@ -3819,7 +3819,7 @@ void source_login_shells_or_not( if (arg[aindex] == NULL) { - log_err(errno, __func__, "cannot alloc env"); + log_err(errno, __func__, (char *)"cannot alloc env"); starter_return(TJE->upfds, TJE->downfds, JOB_EXEC_FAIL2, sjr); } @@ -3873,7 +3873,7 @@ int TMomFinalizeChild( if (pwdp == NULL) { - log_err(PBSE_BADUSER, __func__, "Running job with no password entry?"); + log_err(PBSE_BADUSER, __func__, (char *)"Running job with no password entry?"); starter_return(TJE->upfds, TJE->downfds, JOB_EXEC_RETRY, &sjr); @@ -3914,7 +3914,7 @@ int TMomFinalizeChild( /* Setup user env */ if (InitUserEnv(pjob, ptask, NULL, pwdp, shell) < 0) { - log_err(-1, __func__, "failed to setup user env"); + log_err(-1, __func__, (char *)"failed to setup user env"); starter_return(TJE->upfds, TJE->downfds, JOB_EXEC_RETRY, &sjr); } @@ -3943,7 +3943,7 @@ int TMomFinalizeChild( if ((j = CPACreatePartition(pjob, &vtable)) != 0) { - log_err(-1, __func__, "CPACreatePartition failed"); + log_err(-1, __func__, (char *)"CPACreatePartition failed"); starter_return(TJE->upfds, TJE->downfds, j, &sjr); /* exits */ @@ -3960,7 +3960,7 @@ int TMomFinalizeChild( if (j != 0) { - log_err(-1, __func__, "failed to set mach vars"); + log_err(-1, __func__, (char *)"failed to set mach vars"); starter_return(TJE->upfds, TJE->downfds, j, &sjr); /* exits */ @@ -4142,7 +4142,7 @@ int TMomFinalizeChild( if (arg[aindex] == NULL) { - log_err(errno, __func__, "cannot alloc env"); + log_err(errno, __func__, (char *)"cannot alloc env"); starter_return(TJE->upfds,TJE->downfds,JOB_EXEC_FAIL2,&sjr); @@ -4300,7 +4300,7 @@ int TMomFinalizeJob3( if (pjob == NULL) { - log_err(-1, __func__, "This function needs a valid job pointer"); + log_err(-1, __func__, (char *)"This function needs a valid job pointer"); return(FAILURE); } @@ -4829,7 +4829,7 @@ int start_process( if (InitUserEnv(pjob, ptask, envp, NULL, NULL) < 0) { - log_err(errno, __func__, "failed to setup user env"); + log_err(errno, __func__, (char *)"failed to setup user env"); starter_return(kid_write, kid_read, JOB_EXEC_RETRY, &sjr); @@ -4891,7 +4891,7 @@ int start_process( if ((fd0 = search_env_and_open("MPIEXEC_STDIN_PORT", ipaddr)) == -2) { - log_err(errno, __func__, "cannot locate MPIEXEC_STDIN_PORT"); + log_err(errno, __func__, (char *)"cannot locate MPIEXEC_STDIN_PORT"); starter_return(kid_write, kid_read, JOB_EXEC_FAIL1, &sjr); @@ -4902,7 +4902,7 @@ int start_process( if ((fd0 < 0) && ((fd0 = search_env_and_open("TM_STDIN_PORT", ipaddr)) == -2)) { - log_err(errno, __func__, "cannot locate TM_STDIN_PORT"); + log_err(errno, __func__, (char *)"cannot locate TM_STDIN_PORT"); starter_return(kid_write, kid_read, JOB_EXEC_FAIL1, &sjr); @@ -4915,7 +4915,7 @@ int start_process( if ((fd0 < 0) && (fd0 = open("/dev/null", O_RDONLY)) == -1) { - log_err(errno, __func__, "could not open dev/null"); + log_err(errno, __func__, (char *)"could not open dev/null"); close(0); } @@ -4931,7 +4931,7 @@ int start_process( if ((fd1 = search_env_and_open("MPIEXEC_STDOUT_PORT", ipaddr)) == -2) { - log_err(errno, __func__, "cannot locate MPIEXEC_STDOUT_PORT"); + log_err(errno, __func__, (char *)"cannot locate MPIEXEC_STDOUT_PORT"); starter_return(kid_write, kid_read, JOB_EXEC_FAIL1, &sjr); @@ -4944,7 +4944,7 @@ int start_process( { if ((fd1 = search_env_and_open("TM_STDOUT_PORT", ipaddr)) == -2) { - log_err(errno, __func__, "cannot locate TM_STDOUT_PORT"); + log_err(errno, __func__, (char *)"cannot locate TM_STDOUT_PORT"); starter_return(kid_write, kid_read, JOB_EXEC_FAIL1, &sjr); @@ -4956,7 +4956,7 @@ int start_process( if ((fd2 = search_env_and_open("MPIEXEC_STDERR_PORT", ipaddr)) == -2) { - log_err(errno, __func__, "cannot locate MPIEXEC_STDERR_PORT"); + log_err(errno, __func__, (char *)"cannot locate MPIEXEC_STDERR_PORT"); starter_return(kid_write, kid_read, JOB_EXEC_FAIL1, &sjr); @@ -4969,7 +4969,7 @@ int start_process( { if ((fd2 = search_env_and_open("TM_STDERR_PORT", ipaddr)) == -2) { - log_err(errno, __func__, "cannot locate TM_STDERR_PORT"); + log_err(errno, __func__, (char *)"cannot locate TM_STDERR_PORT"); starter_return(kid_write, kid_read, JOB_EXEC_FAIL1, &sjr); @@ -5018,7 +5018,7 @@ int start_process( if ((fd1 < 0) && ((fd1 = open_demux(ipaddr, pjob->ji_portout)) == -1)) { - log_err(errno, __func__, "cannot open mux stdout port"); + log_err(errno, __func__, (char *)"cannot open mux stdout port"); starter_return(kid_write, kid_read, JOB_EXEC_FAIL1, &sjr); @@ -5034,7 +5034,7 @@ int start_process( if ((fd2 < 0) && ((fd2 = open_demux(ipaddr, pjob->ji_porterr)) == -1)) { - log_err(errno, __func__, "cannot open mux stderr port"); + log_err(errno, __func__, (char *)"cannot open mux stderr port"); starter_return(kid_write, kid_read, JOB_EXEC_FAIL1, &sjr); @@ -5069,7 +5069,7 @@ int start_process( { if ((pts = open_pty(pjob)) < 0) { - log_err(errno, __func__, "cannot open slave pty"); + log_err(errno, __func__, (char *)"cannot open slave pty"); starter_return(kid_write, kid_read, JOB_EXEC_FAIL1, &sjr); @@ -5110,7 +5110,7 @@ int start_process( { if (open_std_out_err(pjob, -1) == -1) { - log_err(errno, __func__, "cannot open job stderr/stdout files"); + log_err(errno, __func__, (char *)"cannot open job stderr/stdout files"); starter_return(kid_write, kid_read, JOB_EXEC_FAIL1, &sjr); } @@ -5449,7 +5449,7 @@ void job_nodes( } else { - log_err(-1, __func__, "Cannot parse the nodes for a job without exec hosts being set"); + log_err(-1, __func__, (char *)"Cannot parse the nodes for a job without exec hosts being set"); return; } @@ -5459,7 +5459,7 @@ void job_nodes( if ((pjob->ji_hosts == NULL) || (pjob->ji_vnods == NULL)) { - log_err(-1,__func__,"Out of memory, system failure!\n"); + log_err(-1,__func__,"(char *)Out of memory, system failure!\n"); return; } @@ -5937,7 +5937,7 @@ int generate_cookie( { if ((tt = calloc(1, JOB_COOKIE_SIZE)) == NULL) { - log_err(ENOMEM, __func__, "cannot alloc memory"); + log_err(ENOMEM, __func__, (char *)"cannot alloc memory"); exec_bail(pjob, JOB_EXEC_FAIL1); @@ -6381,7 +6381,7 @@ pid_t fork_me( } else if (pid < 0) { - log_err(errno, "fork_me", "fork failed"); + log_err(errno, "fork_me", (char *)"fork failed"); } return(pid); @@ -6896,7 +6896,7 @@ int open_std_file( if ((path = std_file_name(pjob, which, &keeping)) == NULL) { - log_err(-1, __func__, "cannot determine filename"); + log_err(-1, __func__, (char *)"cannot determine filename"); /* FAILURE - cannot determine filename */ @@ -6980,7 +6980,7 @@ int open_std_file( if (S_ISLNK(statbuf.st_mode)) { - log_err(-1, __func__, "std file is symlink, someone is doing something fishy"); + log_err(-1, __func__, (char *)"std file is symlink, someone is doing something fishy"); goto reset_ids_fail; } @@ -7015,12 +7015,12 @@ int open_std_file( pjob->ji_qs.ji_un.ji_momt.ji_exuid, pjob->ji_qs.ji_un.ji_momt.ji_exgid) == -1) { - log_err(errno, __func__, "std file exists with the wrong group, someone is doing something fishy, cannot change file group"); + log_err(errno, __func__, (char *)"std file exists with the wrong group, someone is doing something fishy, cannot change file group"); goto reset_ids_fail; } #else - log_err(-1, __func__, "std file exists with the wrong group, someone is doing something fishy"); + log_err(-1, __func__, (char *)"std file exists with the wrong group, someone is doing something fishy"); goto reset_ids_fail; #endif @@ -7274,7 +7274,7 @@ void bld_env_variables( if (LOGLEVEL >= 7) { - log_err(-1, "bld_env_variables", "invalid name passed"); + log_err(-1, "bld_env_variables", (char *)"invalid name passed"); } } @@ -7378,7 +7378,7 @@ int init_groups( if (nsaved < 0) { - log_err(errno, __func__, "getgroups"); + log_err(errno, __func__, (char *)"getgroups"); return(-1); } @@ -7411,7 +7411,7 @@ int init_groups( if (pwe == NULL) { - log_err(errno, __func__, "no such user"); + log_err(errno, __func__, (char *)"no such user"); return(-1); } @@ -7429,7 +7429,7 @@ int init_groups( if (sigprocmask(SIG_BLOCK, &allsigs, &savedset) == -1) { - log_err(errno, __func__, "sigprocmask(BLOCK)"); + log_err(errno, __func__, (char *)"sigprocmask(BLOCK)"); return(-1); } @@ -7438,7 +7438,7 @@ int init_groups( if (initgroups(pwname, pwgrp) < 0) { - log_err(errno, __func__, "initgroups"); + log_err(errno, __func__, (char *)"initgroups"); n = -1; } @@ -7455,10 +7455,10 @@ int init_groups( /* restore state */ if (setgroups(nsaved, savedgroups) < 0) - log_err(errno, __func__, "setgroups"); + log_err(errno, __func__, (char *)"setgroups"); if (sigprocmask(SIG_SETMASK, &savedset, NULL) == -1) - log_err(errno, __func__, "sigprocmask(SIG_SETMASK)"); + log_err(errno, __func__, (char *)"sigprocmask(SIG_SETMASK)"); return(n); } /* END init_groups() */ @@ -8430,7 +8430,7 @@ int allocate_demux_sockets( /* command sisters to abort job and continue */ - log_err(errno, __func__, "stdout/err socket"); + log_err(errno, __func__, (char *)"stdout/err socket"); exec_bail(pjob, JOB_EXEC_FAIL1); diff --git a/src/resmom/sunos4/mom_mach.c b/src/resmom/sunos4/mom_mach.c index 675a22572b..b4a4999e35 100644 --- a/src/resmom/sunos4/mom_mach.c +++ b/src/resmom/sunos4/mom_mach.c @@ -233,14 +233,14 @@ dep_initialize(void) { if ((kd = kvm_open(NULL, NULL, NULL, O_RDONLY, "rm")) == NULL) { - log_err(errno, id, "kvm_open"); + log_err(errno, id, (char *)"kvm_open"); return; } } if (kvm_nlist(kd, nl) == -1) { - log_err(errno, id, "kvm_nlist"); + log_err(errno, id, (char *)"kvm_nlist"); return; } @@ -423,7 +423,7 @@ cput_sum(job *pjob) if (kvm_read(kd, (unsigned long)pp->p_ru, (char *)&ru, sizeof(ru)) != sizeof(ru)) { - log_err(errno, id, "kvm_read(session)"); + log_err(errno, id, (char *)"kvm_read(session)"); continue; } @@ -808,14 +808,14 @@ mom_open_poll(void) if (kd == NULL) { - log_err(errno, id, "kvm_open"); + log_err(errno, id, (char *)"kvm_open"); return (PBSE_SYSTEM); } } if (kvm_nlist(kd, nl) == -1) { - log_err(errno, id, "kvm_nlist"); + log_err(errno, id, (char *)"kvm_nlist"); return (PBSE_SYSTEM); } @@ -849,14 +849,14 @@ mom_get_sample(void) if (nl[KSYM_NPROC].n_type == 0) { - log_err(-1, id, "number of process not found"); + log_err(-1, id, (char *)"number of process not found"); return (PBSE_SYSTEM); } if (kvm_read(kd, nl[KSYM_NPROC].n_value, (char *)&nproc, sizeof(nproc)) != sizeof(nproc)) { - log_err(errno, id, "kvm_read(NPROC)"); + log_err(errno, id, (char *)"kvm_read(NPROC)"); return (PBSE_SYSTEM); } @@ -870,14 +870,14 @@ mom_get_sample(void) if (nl[KSYM_PROC].n_type == 0) { - log_err(-1, id, "process table not found"); + log_err(-1, id, (char *)"process table not found"); return (PBSE_SYSTEM); } if (kvm_read(kd, nl[KSYM_PROC].n_value, (char *)&kernel_proc, sizeof(kernel_proc)) != sizeof(kernel_proc)) { - log_err(errno, id, "kvm_read(PROC)"); + log_err(errno, id, (char *)"kvm_read(PROC)"); return (PBSE_SYSTEM); } @@ -896,7 +896,7 @@ mom_get_sample(void) if (kvm_read(kd, (unsigned long)kernel_proc, (char *)proc_tbl, len) != len) { - log_err(errno, id, "kvm_read(proc_tbl)"); + log_err(errno, id, (char *)"kvm_read(proc_tbl)"); return (PBSE_SYSTEM); } @@ -929,7 +929,7 @@ mom_get_sample(void) if (kvm_read(kd, (unsigned long)pp->p_sessp, (char *)&s, sizeof(s)) != sizeof(s)) { - log_err(errno, id, "kvm_read(session)"); + log_err(errno, id, (char *)"kvm_read(session)"); continue; /* session gone? */ } @@ -1195,7 +1195,7 @@ mom_close_poll(void) { if (kvm_close(kd) != 0) { - log_err(errno, "mom_close_poll", "kvm_close"); + log_err(errno, "mom_close_poll", (char *)"kvm_close"); return (PBSE_SYSTEM); } @@ -1312,7 +1312,7 @@ pid_t jobid; if (kvm_read(kd, (unsigned long)pp->p_ru, (char *)&ru, sizeof(ru)) != sizeof(ru)) { - log_err(errno, id, "kvm_read(session)"); + log_err(errno, id, (char *)"kvm_read(session)"); continue; } @@ -1359,7 +1359,7 @@ pid_t pid; { if (errno) { - log_err(errno, id, "kvm_getu"); + log_err(errno, id, (char *)"kvm_getu"); rm_errno = RM_ERR_SYSTEM; return NULL; } @@ -1668,7 +1668,7 @@ sessions(struct rm_attribute *attrib) if ((jids = (pid_t *)calloc(nproc, sizeof(pid_t))) == NULL) { - log_err(errno, id, "no memory"); + log_err(errno, id, (char *)"no memory"); rm_errno = RM_ERR_SYSTEM; return NULL; } @@ -1842,7 +1842,7 @@ nusers(struct rm_attribute *attrib) if ((uids = (uid_t *)calloc(nproc, sizeof(uid_t))) == NULL) { - log_err(errno, id, "no memory"); + log_err(errno, id, (char *)"no memory"); rm_errno = RM_ERR_SYSTEM; return NULL; } @@ -1895,7 +1895,7 @@ getanon(char *id) if (nl[KSYM_ANON].n_type == 0) { - log_err(-1, id, "anoninfo struct not found"); + log_err(-1, id, (char *)"anoninfo struct not found"); rm_errno = RM_ERR_SYSTEM; return 1; } @@ -1903,7 +1903,7 @@ getanon(char *id) if (kvm_read(kd, nl[KSYM_ANON].n_value, (char *)&ai, sizeof(struct anoninfo)) != sizeof(struct anoninfo)) { - log_err(errno, id, "kvm_read"); + log_err(errno, id, (char *)"kvm_read"); rm_errno = RM_ERR_SYSTEM; return 1; } @@ -1976,7 +1976,7 @@ physmem(struct rm_attribute *attrib) if (nl[KSYM_PHYS].n_type == 0) { - log_err(-1, id, "physmem count not found"); + log_err(-1, id, (char *)"physmem count not found"); rm_errno = RM_ERR_SYSTEM; return 0; } @@ -1984,7 +1984,7 @@ physmem(struct rm_attribute *attrib) if (kvm_read(kd, nl[KSYM_PHYS].n_value, (char *)&pmem, sizeof(pmem)) != sizeof(pmem)) { - log_err(errno, id, "kvm_read"); + log_err(errno, id, (char *)"kvm_read"); rm_errno = RM_ERR_SYSTEM; return NULL; } @@ -2016,7 +2016,7 @@ size_fs(char *param) if (statfs(param, &fsbuf) == -1) { - log_err(errno, id, "statfs"); + log_err(errno, id, (char *)"statfs"); rm_errno = RM_ERR_BADPARAM; return NULL; } @@ -2045,7 +2045,7 @@ size_file(char *param) if (stat(param, &sbuf) == -1) { - log_err(errno, id, "stat"); + log_err(errno, id, (char *)"stat"); rm_errno = RM_ERR_BADPARAM; return NULL; } @@ -2124,7 +2124,7 @@ idletime(struct rm_attribute *attrib) if ((dp = opendir("/dev")) == NULL) { - log_err(errno, id, "opendir /dev"); + log_err(errno, id, (char *)"opendir /dev"); rm_errno = RM_ERR_SYSTEM; return NULL; } @@ -2205,7 +2205,7 @@ walltime(struct rm_attribute *attrib) if ((now = time(NULL)) <= 0) { - log_err(errno, id, "time"); + log_err(errno, id, (char *)"time"); rm_errno = RM_ERR_SYSTEM; return NULL; } @@ -2233,7 +2233,7 @@ walltime(struct rm_attribute *attrib) if ((uarea = kvm_getu(kd, pp)) == NULL) { - log_err(errno, id, "kvm_getu"); + log_err(errno, id, (char *)"kvm_getu"); rm_errno = RM_ERR_SYSTEM; return NULL; } @@ -2269,14 +2269,14 @@ double *rv if (nl[KSYM_LOAD].n_type == 0) { - log_err(-1, id, "loadaverage count not found"); + log_err(-1, id, (char *)"loadaverage count not found"); return (rm_errno = RM_ERR_SYSTEM); } if (kvm_read(kd, nl[KSYM_LOAD].n_value, (char *)&load, sizeof(load)) != sizeof(load)) { - log_err(errno, id, "kvm_read"); + log_err(errno, id, (char *)"kvm_read"); return (rm_errno = RM_ERR_SYSTEM); } @@ -2406,7 +2406,7 @@ quota(struct rm_attribute *attrib) if ((m = setmntent(MOUNTED, "r")) == NULL) { - log_err(errno, id, "setmntent"); + log_err(errno, id, (char *)"setmntent"); rm_errno = RM_ERR_SYSTEM; return NULL; } @@ -2481,7 +2481,7 @@ quota(struct rm_attribute *attrib) if (quotactl(Q_GETQUOTA, me->mnt_fsname, uid, &qi) == -1) { - log_err(errno, id, "quotactl"); + log_err(errno, id, (char *)"quotactl"); rm_errno = RM_ERR_SYSTEM; return NULL; } diff --git a/src/resmom/test/requests/scaffolding.c b/src/resmom/test/requests/scaffolding.c index 0d6a498cca..6083b735f0 100644 --- a/src/resmom/test/requests/scaffolding.c +++ b/src/resmom/test/requests/scaffolding.c @@ -182,12 +182,6 @@ int DIS_tcp_wflush(int fd) exit(1); } -void rpp_terminate(void) - { - fprintf(stderr, "The call to rpp_terminate needs to be mocked!!\n"); - exit(1); - } - int attr_atomic_set(struct svrattrl *plist, pbs_attribute *old, pbs_attribute *new_attr, attribute_def *pdef, int limit, int unkn, int privil, int *badattr) { fprintf(stderr, "The call to attr_atomic_set needs to be mocked!!\n"); diff --git a/src/resmom/tmsock_recov.c b/src/resmom/tmsock_recov.c index f0cc7a93e4..c8f6d066f9 100644 --- a/src/resmom/tmsock_recov.c +++ b/src/resmom/tmsock_recov.c @@ -83,28 +83,28 @@ int recov_tmsock( if (read(fds, (char *)&pjob->ji_stdout, sizeofint) != sizeofint) { - log_err(errno, id, "read"); + log_err(errno, id, (char *)"read"); return(1); } if (read(fds, (char *)&pjob->ji_stderr, sizeofint) != sizeofint) { - log_err(errno, id, "read"); + log_err(errno, id, (char *)"read"); return(1); } if (read(fds, (char *)&pjob->ji_taskid, sizeof(tm_task_id)) != sizeof(tm_task_id)) { - log_err(errno, id, "read"); + log_err(errno, id, (char *)"read"); return(1); } if (read(fds, (char *)&pjob->ji_nodeid, sizeof(tm_node_id)) != sizeof(tm_node_id)) { - log_err(errno, id, "read"); + log_err(errno, id, (char *)"read"); return(1); } diff --git a/src/resmom/unicos8/mom_mach.c b/src/resmom/unicos8/mom_mach.c index 753be6b00e..dc9671982f 100644 --- a/src/resmom/unicos8/mom_mach.c +++ b/src/resmom/unicos8/mom_mach.c @@ -438,27 +438,27 @@ dep_main_loop_cycle(void) if (tabinfo(PWS, &info) == -1) { - log_err(errno, id, "tabinfo(PWS)"); + log_err(errno, id, (char *)"tabinfo(PWS)"); return; } if (tabread(PWS, (char *)&pw, info.ent * info.len, info.head) == -1) { - log_err(errno, id, "tabread(PWS)"); + log_err(errno, id, (char *)"tabread(PWS)"); return; } if (tabinfo(SINFO, &info) == -1) { - log_err(errno, id, "tabinfo(SINFO)"); + log_err(errno, id, (char *)"tabinfo(SINFO)"); return; } if (tabread(SINFO, (char *)&sysinfo, info.ent * info.len, info.head) == -1) { - log_err(errno, id, "tabread(SINFO)"); + log_err(errno, id, (char *)"tabread(SINFO)"); return; } @@ -557,7 +557,7 @@ dep_initialize(void) if (target(MC_GET_TARGET, &tinfo) == -1) { - log_err(errno, id, "target"); + log_err(errno, id, (char *)"target"); die(0); } @@ -1253,7 +1253,7 @@ mom_set_limits( if (lockudb() < 0) { - log_err(udb_errno, id, "Unable to lock UDB"); + log_err(udb_errno, id, (char *)"Unable to lock UDB"); } else { @@ -1264,14 +1264,14 @@ mom_set_limits( if ((phost == (char *)0) || ((phost = strchr(phost, (int)'=')) == (char *)0)) - log_err(-1, id, "PBS_O_HOST not set"); + log_err(-1, id, (char *)"PBS_O_HOST not set"); strncpy(pudb->ue_batchhost, phost + 1, MAXUE_HOSTNAME); pudb->ue_batchhost[MAXUE_HOSTNAME] = '\0'; if (rewriteudb(pudb) < 0) - log_err(udb_errno, id, "UDB Update failed"); + log_err(udb_errno, id, (char *)"UDB Update failed"); } } @@ -2663,7 +2663,7 @@ sessions(struct rm_attribute *attrib) if ((jids = (pid_t *)calloc(maxjid, sizeof(pid_t))) == NULL) { - log_err(errno, id, "no memory"); + log_err(errno, id, (char *)"no memory"); rm_errno = RM_ERR_SYSTEM; return NULL; } @@ -2706,7 +2706,7 @@ sessions(struct rm_attribute *attrib) if (hold == NULL) { - log_err(errno, id, "realloc"); + log_err(errno, id, (char *)"realloc"); rm_errno = RM_ERR_SYSTEM; free(jids); return NULL; @@ -2782,7 +2782,7 @@ nusers(struct rm_attribute *attrib) if ((uids = calloc(nproc, sizeof(uid_t))) == NULL) { - log_err(errno, id, "no memory"); + log_err(errno, id, (char *)"no memory"); rm_errno = RM_ERR_SYSTEM; return NULL; } @@ -2915,7 +2915,7 @@ totmem(struct rm_attribute *attrib) if (statfs(procfs, &fsbuf, sizeof(struct statfs), 0) == -1) { - log_err(errno, id, "statfs"); + log_err(errno, id, (char *)"statfs"); rm_errno = RM_ERR_SYSTEM; return NULL; } @@ -2943,7 +2943,7 @@ availmem(struct rm_attribute *attrib) if (statfs(procfs, &fsbuf, sizeof(struct statfs), 0) == -1) { - log_err(errno, id, "statfs"); + log_err(errno, id, (char *)"statfs"); rm_errno = RM_ERR_SYSTEM; return NULL; } @@ -3013,7 +3013,7 @@ size_fs(char *param) if (statfs(param, &fsbuf, sizeof(struct statfs), 0) == -1) { - log_err(errno, id, "statfs"); + log_err(errno, id, (char *)"statfs"); rm_errno = RM_ERR_BADPARAM; return NULL; } @@ -3042,7 +3042,7 @@ size_file(char *param) if (stat(param, &sbuf) == -1) { - log_err(errno, id, "stat"); + log_err(errno, id, (char *)"stat"); rm_errno = RM_ERR_BADPARAM; return NULL; } @@ -3121,7 +3121,7 @@ idletime(struct rm_attribute *attrib) if ((dp = opendir("/dev")) == NULL) { - log_err(errno, id, "opendir /dev"); + log_err(errno, id, (char *)"opendir /dev"); rm_errno = RM_ERR_SYSTEM; return NULL; } @@ -3360,7 +3360,7 @@ quota(struct rm_attribute *attrib) if (quotactl(dirname, SRFS_INFO, (caddr_t)&srfsinfo) == -1) { - log_err(errno, id, "quotactl(SRFS_INFO)"); + log_err(errno, id, (char *)"quotactl(SRFS_INFO)"); rm_errno = RM_ERR_SYSTEM; return NULL; } @@ -3468,7 +3468,7 @@ quota(struct rm_attribute *attrib) if (quotactl(dirname, Q_GETQUOTA, (caddr_t)&qi) == -1) { - log_err(errno, id, "quotactl(Q_GETQUOTA)"); + log_err(errno, id, (char *)"quotactl(Q_GETQUOTA)"); rm_errno = RM_ERR_SYSTEM; return NULL; } @@ -3566,7 +3566,7 @@ quota(struct rm_attribute *attrib) if (quotactl(dirname, Q_GETHEADER, (caddr_t)&header) == -1) { - log_err(errno, id, "quotactl(Q_GETHEADER)"); + log_err(errno, id, (char *)"quotactl(Q_GETHEADER)"); rm_errno = RM_ERR_SYSTEM; return NULL; } @@ -3635,7 +3635,7 @@ srfs_reserve(struct rm_attribute *attrib) if (quotactl(name, SRFS_RESERVE, (caddr_t)&num) == -1) { - log_err(errno, id, "quotactl(SRFS_RESERVE)"); + log_err(errno, id, (char *)"quotactl(SRFS_RESERVE)"); rm_errno = RM_ERR_SYSTEM; return NULL; } @@ -3746,14 +3746,14 @@ getswap(void) if (tabinfo(SWAPTAB, &info) == -1) { - log_err(errno, id, "tabinfo(SWAPTAB)"); + log_err(errno, id, (char *)"tabinfo(SWAPTAB)"); return 1; } if (tabread(SWAPTAB, (char *)&swapper, info.ent * info.len, info.head) == -1) { - log_err(errno, id, "tabread(SWAPTAB)"); + log_err(errno, id, (char *)"tabread(SWAPTAB)"); return 1; } diff --git a/src/resmom/unicos8/mom_start.c b/src/resmom/unicos8/mom_start.c index 99d42737a9..49d2461c19 100644 --- a/src/resmom/unicos8/mom_start.c +++ b/src/resmom/unicos8/mom_start.c @@ -295,7 +295,7 @@ rmonedir(char *tmpdir) if (pid < 0) { - log_err(errno, id, "Unable to fork"); + log_err(errno, id, (char *)"Unable to fork"); return; } @@ -303,7 +303,7 @@ rmonedir(char *tmpdir) execl(rm, "pbs_cleandir", rf, tmpdir, 0); - log_err(errno, id, "This is really bad"); + log_err(errno, id, (char *)"This is really bad"); exit(1); } @@ -327,7 +327,7 @@ rmtmpdir(char *sequence) if (pid < 0) { - log_err(errno, id, "Unable to fork"); + log_err(errno, id, (char *)"Unable to fork"); return; } diff --git a/src/resmom/unicosmk2/mom_mach.c b/src/resmom/unicosmk2/mom_mach.c index 63dfa13a53..e54454a05e 100644 --- a/src/resmom/unicosmk2/mom_mach.c +++ b/src/resmom/unicosmk2/mom_mach.c @@ -228,7 +228,7 @@ dep_initialize(void) if (target(MC_GET_TARGET, &tinfo) == -1) { - log_err(errno, id, "target"); + log_err(errno, id, (char *)"target"); die(0); } @@ -661,7 +661,7 @@ mom_set_limits( if (lockudb() < 0) { - log_err(udb_errno, id, "Unable to lock UDB"); + log_err(udb_errno, id, (char *)"Unable to lock UDB"); } else { @@ -672,14 +672,14 @@ mom_set_limits( if ((phost == (char *)0) || ((phost = strchr(phost, (int)'=')) == (char *)0)) - log_err(-1, id, "PBS_O_HOST not set"); + log_err(-1, id, (char *)"PBS_O_HOST not set"); strncpy(pudb->ue_batchhost, phost + 1, MAXUE_HOSTNAME); pudb->ue_batchhost[MAXUE_HOSTNAME] = '\0'; if (rewriteudb(pudb) < 0) - log_err(udb_errno, id, "UDB Update failed"); + log_err(udb_errno, id, (char *)"UDB Update failed"); } } @@ -1658,7 +1658,7 @@ totmem(struct rm_attribute *attrib) if (statfs(procfs, &fsbuf, sizeof(struct statfs), 0) == -1) { - log_err(errno, id, "statfs"); + log_err(errno, id, (char *)"statfs"); rm_errno = RM_ERR_SYSTEM; return NULL; } @@ -1685,7 +1685,7 @@ availmem(struct rm_attribute *attrib) if (statfs(procfs, &fsbuf, sizeof(struct statfs), 0) == -1) { - log_err(errno, id, "statfs"); + log_err(errno, id, (char *)"statfs"); rm_errno = RM_ERR_SYSTEM; return NULL; } @@ -1753,7 +1753,7 @@ size_fs(char *param) if (statfs(param, &fsbuf, sizeof(struct statfs), 0) == -1) { - log_err(errno, id, "statfs"); + log_err(errno, id, (char *)"statfs"); rm_errno = RM_ERR_BADPARAM; return NULL; } @@ -1781,7 +1781,7 @@ size_file(char *param) if (stat(param, &sbuf) == -1) { - log_err(errno, id, "stat"); + log_err(errno, id, (char *)"stat"); rm_errno = RM_ERR_BADPARAM; return NULL; } @@ -1860,7 +1860,7 @@ idletime(struct rm_attribute *attrib) if ((dp = opendir("/dev")) == NULL) { - log_err(errno, id, "opendir /dev"); + log_err(errno, id, (char *)"opendir /dev"); rm_errno = RM_ERR_SYSTEM; return NULL; } @@ -2219,7 +2219,7 @@ quota(struct rm_attribute *attrib) if (quotactl(dirname, Q_GETHEADER, (caddr_t)&header) == -1) { - log_err(errno, id, "quotactl(Q_GETHEADER)"); + log_err(errno, id, (char *)"quotactl(Q_GETHEADER)"); rm_errno = RM_ERR_SYSTEM; return NULL; } diff --git a/src/resmom/unicosmk2/mom_start.c b/src/resmom/unicosmk2/mom_start.c index e8fe2630cd..2a23c12884 100644 --- a/src/resmom/unicosmk2/mom_start.c +++ b/src/resmom/unicosmk2/mom_start.c @@ -297,7 +297,7 @@ rmonedir(char *tmpdir) if (pid < 0) { - log_err(errno, id, "Unable to fork"); + log_err(errno, id, (char *)"Unable to fork"); return; } @@ -305,7 +305,7 @@ rmonedir(char *tmpdir) execl(rm, "pbs_cleandir", rf, tmpdir, 0); - log_err(errno, id, "This is really bad"); + log_err(errno, id, (char *)"This is really bad"); exit(1); } @@ -329,7 +329,7 @@ rmtmpdir(char *sequence) if (pid < 0) { - log_err(errno, id, "Unable to fork"); + log_err(errno, id, (char *)"Unable to fork"); return; } diff --git a/src/scheduler.basl/af_cnodemap.c b/src/scheduler.basl/af_cnodemap.c index 5b494b26fe..4dfb2a2d7a 100644 --- a/src/scheduler.basl/af_cnodemap.c +++ b/src/scheduler.basl/af_cnodemap.c @@ -429,7 +429,7 @@ addRes(char *archType, char *nodeAttr, char *hostQuery) if (beforecnt == aftercnt) { - log_err(-1, id, "Unable to realloc Res"); + log_err(-1, id, (char *)"Unable to realloc Res"); return(-1); } diff --git a/src/scheduler.basl/af_config.c b/src/scheduler.basl/af_config.c index 3496a080e9..5e2a8481ff 100644 --- a/src/scheduler.basl/af_config.c +++ b/src/scheduler.basl/af_config.c @@ -197,7 +197,7 @@ addClient(char *name) if (beforecnt == aftercnt) { - log_err(-1, id, "Unable to realloc okClients"); + log_err(-1, id, (char *)"Unable to realloc okClients"); return -1; } diff --git a/src/scheduler.basl/af_resmom.c b/src/scheduler.basl/af_resmom.c index 735046f74d..aae93a86ab 100644 --- a/src/scheduler.basl/af_resmom.c +++ b/src/scheduler.basl/af_resmom.c @@ -208,7 +208,7 @@ ResMom *mom; { (void)sprintf(log_buffer, "openrm (%s, %d)", ResMomInetAddrGet(mom), ResMomPortNumberGet(mom)); - log_err(errno, id, log_buffer); + log_err(errno, id, (char *)log_buffer); perror(log_buffer); } diff --git a/src/scheduler.basl/af_server.c b/src/scheduler.basl/af_server.c index d9561d72fe..4df1dd7868 100644 --- a/src/scheduler.basl/af_server.c +++ b/src/scheduler.basl/af_server.c @@ -1122,7 +1122,7 @@ Server *server; if ((connect = socket_to_conn(new_socket)) < 0) { - log_err(errno, id, "socket_to_conn"); + log_err(errno, id, (char *)"socket_to_conn"); return(1); } @@ -1168,7 +1168,7 @@ Server *server; if (get_4byte(ServerFdOneWayGet(server), &bytes) != 1) { - log_err(errno, id, "get4byte"); + log_err(errno, id, (char *)"get4byte"); return(SCH_ERROR); } @@ -1217,7 +1217,7 @@ void *param; return(pbs_statjob_err(ServerFdTwoWayGet(server), NULL, param, NULL, &local_errno)); default: - log_err(-1, id, "Unknown command sent!"); + log_err(-1, id, (char *)"Unknown command sent!"); return(NULL); } } @@ -1253,7 +1253,7 @@ Server *server; if (connect < 0) { - log_err(-1, id, "Server not connected!"); + log_err(-1, id, (char *)"Server not connected!"); } else { @@ -1284,10 +1284,10 @@ Server *server; sock = ServerSocketGet(server); if (shutdown(sock, 2)) - log_err(errno, id, "shutdown"); + log_err(errno, id, (char *)"shutdown"); if (close(sock)) - log_err(errno, id, "close"); + log_err(errno, id, (char *)"close"); } /* Nodes stuff */ diff --git a/src/scheduler.basl/af_system.c b/src/scheduler.basl/af_system.c index 0286229810..b51c668b0a 100644 --- a/src/scheduler.basl/af_system.c +++ b/src/scheduler.basl/af_system.c @@ -219,7 +219,7 @@ static void initSchedCycle(void) static char id[] = "initSchedCycle"; if (sigprocmask(SIG_BLOCK, &allsigs, &oldsigs) == -1) - log_err(errno, id, "sigprocmaskSIG_BLOCK)"); /* start CS */ + log_err(errno, id, (char *)"sigprocmaskSIG_BLOCK)"); /* start CS */ for (s = AllServersHeadGet(); s; s = s->nextptr) { @@ -230,7 +230,7 @@ static void initSchedCycle(void) } if (sigprocmask(SIG_SETMASK, &oldsigs, NULL) == -1) - log_err(errno, id, "sigprocmask(SIG_SETMASK)"); /* CS end */ + log_err(errno, id, (char *)"sigprocmask(SIG_SETMASK)"); /* CS end */ } static void addDefaults(void) @@ -264,7 +264,6 @@ toolong(int sig) if ((cpid = fork()) > 0) /* parent re-execs itself */ { - rpp_terminate(); #ifndef linux sleep(5); #endif @@ -301,18 +300,16 @@ toolong(int sig) { log_close(1); abort(); - rpp_terminate(); exit(2); /* not reached (hopefully) */ } - log_err(errno, id, "stat"); + log_err(errno, id, (char *)"stat"); } log_record(PBSEVENT_SYSTEM, PBS_EVENTCLASS_SERVER, id, "exiting without core dump"); log_close(1); - rpp_terminate(); exit(0); } @@ -594,7 +591,7 @@ static void signalHandleSet(void) /* The following seemed to allow signals to be caught again after */ /* a SIGALRM was received */ if (sigprocmask(SIG_SETMASK, &allsigs, NULL) == -1) - log_err(errno, id, "sigprocmask(SIG_SETMASK)"); + log_err(errno, id, (char *)"sigprocmask(SIG_SETMASK)"); act.sa_flags = 0; @@ -746,7 +743,7 @@ SystemInit(int argc, char *argv[]) if ((pid = setsid()) == -1) { - log_err(errno, id, "setsid"); + log_err(errno, id, (char *)"setsid"); die(0); } @@ -794,22 +791,18 @@ SystemStateRead(void (*sched_main)(void)) CNode *cn; int server_sock; int go; - extern int rpp_fd; if (sigprocmask(SIG_BLOCK, &allsigs, &oldsigs) == -1) - log_err(errno, id, "sigprocmask(SIG_BLOCK)"); + log_err(errno, id, (char *)"sigprocmask(SIG_BLOCK)"); server_sock = ServerSocketGet(AllServersLocalHostGet()); if (sigprocmask(SIG_SETMASK, &oldsigs, NULL) == -1) - log_err(errno, id, "sigprocmask(SIG_SETMASK)"); + log_err(errno, id, (char *)"sigprocmask(SIG_SETMASK)"); for (go = 1; go;) { - if (rpp_fd != -1) - FD_SET(rpp_fd, &fdset); - FD_SET(server_sock, &fdset); #ifdef DEBUG @@ -821,7 +814,7 @@ SystemStateRead(void (*sched_main)(void)) if (errno != EINTR) { - log_err(errno, id, "select"); + log_err(errno, id, (char *)"select"); die(0); } @@ -832,20 +825,6 @@ SystemStateRead(void (*sched_main)(void)) printf("%s: After select\n", id); #endif - if (rpp_fd != -1 && FD_ISSET(rpp_fd, &fdset)) - { - - /* start CS */ - if (sigprocmask(SIG_BLOCK, &allsigs, &oldsigs) == -1) - log_err(errno, id, "sigprocmask(SIG_BLOCK)"); - - if (rpp_io() == -1) - log_err(errno, id, "rpp_io"); - - /* CS end */ - if (sigprocmask(SIG_SETMASK, &oldsigs, NULL) == -1) - log_err(errno, id, "sigprocmask(SIG_SETMASK)"); - } if (!FD_ISSET(server_sock, &fdset)) { @@ -857,7 +836,7 @@ SystemStateRead(void (*sched_main)(void)) } if (sigprocmask(SIG_BLOCK, &allsigs, &oldsigs) == -1) - log_err(errno, id, "sigprocmaskSIG_BLOCK)"); /* start CS */ + log_err(errno, id, (char *)"sigprocmaskSIG_BLOCK)"); /* start CS */ if (ServerOpen(AllServersLocalHostGet()) == 0) { @@ -927,13 +906,13 @@ SystemStateRead(void (*sched_main)(void)) break; default: - log_err(-1, id, "unknown command"); + log_err(-1, id, (char *)"unknown command"); } } if (sigprocmask(SIG_SETMASK, &oldsigs, NULL) == -1) - log_err(errno, id, "sigprocmask(SIG_SETMASK)"); /* CS end */ + log_err(errno, id, (char *)"sigprocmask(SIG_SETMASK)"); /* CS end */ } /* for */ } diff --git a/src/scheduler.cc/pbs_sched.c b/src/scheduler.cc/pbs_sched.c index 029bf76b47..75f75e1d88 100644 --- a/src/scheduler.cc/pbs_sched.c +++ b/src/scheduler.cc/pbs_sched.c @@ -221,7 +221,7 @@ static void catch_abort( sigaction(SIGTRAP, &act, NULL); sigaction(SIGSYS, &act, NULL); - log_err(sig, "pbs_sched", "Caught fatal core signal"); + log_err(sig, "pbs_sched", (char *)"Caught fatal core signal"); rlimit.rlim_cur = RLIM_INFINITY; rlimit.rlim_max = RLIM_INFINITY; @@ -276,14 +276,13 @@ void toolong( DBPRT(("scheduling iteration too long\n")) if (connector >= 0 && server_disconnect(connector)) - log_err(errno, id, "server_disconnect"); + log_err(errno, id, (char *)"server_disconnect"); if (close(server_sock)) - log_err(errno, id, "close"); + log_err(errno, id, (char *)"close"); if ((cpid = fork()) > 0) /* parent re-execs itself */ { - rpp_terminate(); #ifndef linux sleep(5); #endif @@ -305,7 +304,7 @@ void toolong( id, log_buffer); execv(glob_argv[0], glob_argv); - log_err(errno, id, "execv"); + log_err(errno, id, (char *)"execv"); exit(3); } @@ -319,18 +318,16 @@ void toolong( { log_close(1); abort(); - rpp_terminate(); exit(2); /* not reached (hopefully) */ } - log_err(errno, id, "stat"); + log_err(errno, id, (char *)"stat"); } log_record(PBSEVENT_SYSTEM, PBS_EVENTCLASS_SERVER, id, "exiting without core dump"); log_close(1); - rpp_terminate(); exit(0); } @@ -511,7 +508,7 @@ static int read_config( if ((conf = fopen(file, "r")) == NULL) { - log_err(errno, id, "cannot open config file"); + log_err(errno, id, (char *)"cannot open config file"); return(-1); } @@ -666,7 +663,7 @@ server_command(void) if (new_socket == -1) { - log_err(errno, id, "accept"); + log_err(errno, id, (char *)"accept"); return(SCH_ERROR); } @@ -710,14 +707,14 @@ server_command(void) if ((connector = socket_to_conn(new_socket)) < 0) { - log_err(errno, id, "socket_to_conn"); + log_err(errno, id, (char *)"socket_to_conn"); return(SCH_ERROR); } if (get_4byte(new_socket, &cmd) != 1) { - log_err(errno, id, "get4bytes"); + log_err(errno, id, (char *)"get4bytes"); return(SCH_ERROR); } @@ -781,7 +778,6 @@ int main( caddr_t next_brk; extern char *optarg; extern int optind, opterr; - extern int rpp_fd; fd_set fdset; int schedinit(int argc, char **argv); @@ -991,26 +987,26 @@ int main( if (gethostname(host, sizeof(host)) == -1) { - log_err(errno, id, "gethostname"); + log_err(errno, id, (char *)"gethostname"); die(0); } if ((hp = gethostbyname(host)) == NULL) { - log_err(errno, id, "gethostbyname"); + log_err(errno, id, (char *)"gethostbyname"); die(0); } if ((server_sock = socket(AF_INET, SOCK_STREAM, 0)) < 0) { - log_err(errno, id, "socket"); + log_err(errno, id, (char *)"socket"); die(0); } if (setsockopt(server_sock, SOL_SOCKET, SO_REUSEADDR, (char *)&t, sizeof(t)) == -1) { - log_err(errno, id, "setsockopt"); + log_err(errno, id, (char *)"setsockopt"); die(0); } @@ -1021,13 +1017,13 @@ int main( if (bind(server_sock, (struct sockaddr *)&saddr, sizeof(saddr)) < 0) { - log_err(errno, id, "bind"); + log_err(errno, id, (char *)"bind"); die(0); } if (listen(server_sock, 5) < 0) { - log_err(errno, id, "listen"); + log_err(errno, id, (char *)"listen"); die(0); } @@ -1046,7 +1042,7 @@ int main( if (lockfds < 0) { - log_err(errno, id, "open lock file"); + log_err(errno, id, (char *)"open lock file"); exit(1); } @@ -1200,8 +1196,6 @@ int main( { int cmd; - if (rpp_fd != -1) - FD_SET(rpp_fd, &fdset); FD_SET(server_sock, &fdset); @@ -1209,18 +1203,13 @@ int main( { if (errno != EINTR) { - log_err(errno, id, "select"); + log_err(errno, id, (char *)"select"); die(0); } continue; } - if (rpp_fd != -1 && FD_ISSET(rpp_fd, &fdset)) - { - if (rpp_io() == -1) - log_err(errno, id, "rpp_io"); - } if (!FD_ISSET(server_sock, &fdset)) continue; @@ -1228,7 +1217,7 @@ int main( cmd = server_command(); if (sigprocmask(SIG_BLOCK, &allsigs, &oldsigs) == -1) - log_err(errno, id, "sigprocmaskSIG_BLOCK)"); + log_err(errno, id, (char *)"sigprocmaskSIG_BLOCK)"); alarm(alarm_time); @@ -1239,7 +1228,7 @@ int main( if (connector >= 0 && server_disconnect(connector)) { - log_err(errno, id, "server_disconnect"); + log_err(errno, id, (char *)"server_disconnect"); die(0); } @@ -1254,7 +1243,7 @@ int main( } if (sigprocmask(SIG_SETMASK, &oldsigs, NULL) == -1) - log_err(errno, id, "sigprocmask(SIG_SETMASK)"); + log_err(errno, id, (char *)"sigprocmask(SIG_SETMASK)"); } sprintf(log_buffer, "%s normal finish pid %ld", diff --git a/src/scheduler.tcl/pbs_sched.c b/src/scheduler.tcl/pbs_sched.c index d1da58ef52..1dc03f3b17 100644 --- a/src/scheduler.tcl/pbs_sched.c +++ b/src/scheduler.tcl/pbs_sched.c @@ -236,7 +236,6 @@ toolong(int sig) if ((cpid = fork()) > 0) /* parent re-execs itself */ { - rpp_terminate(); #ifndef linux sleep(5); #endif @@ -272,7 +271,6 @@ toolong(int sig) { log_close(1); abort(); - rpp_terminate(); exit(2); /* not reached (hopefully) */ } @@ -283,7 +281,6 @@ toolong(int sig) id, "exiting without core dump"); log_close(1); - rpp_terminate(); exit(0); } @@ -752,7 +749,6 @@ char *argv[]; caddr_t curr_brk = 0, next_brk; extern char *optarg; extern int optind, opterr; - extern int rpp_fd; fd_set fdset; #ifndef DEBUG @@ -1157,8 +1153,6 @@ char *argv[]; { unsigned int cmd; - if (rpp_fd != -1) - FD_SET(rpp_fd, &fdset); FD_SET(server_sock, &fdset); @@ -1170,12 +1164,6 @@ char *argv[]; continue; } - if (rpp_fd != -1 && FD_ISSET(rpp_fd, &fdset)) - { - if (rpp_io() == -1) - log_err(errno, id, "rpp_io"); - } - if (!FD_ISSET(server_sock, &fdset)) continue; diff --git a/src/server/accounting.c b/src/server/accounting.c index 241966384f..1259a89dea 100644 --- a/src/server/accounting.c +++ b/src/server/accounting.c @@ -191,14 +191,14 @@ int acct_job( { /* queue name */ sprintf(local_buf, "queue=%s ", pque->qu_qs.qu_name); - unlock_queue(pque, __func__, NULL, LOGLEVEL); + unlock_queue(pque, __func__, (char *)NULL, LOGLEVEL); if ((rc = append_dynamic_string(ds, local_buf)) != PBSE_NONE) return(rc); } else if (pjob == NULL) { - log_err(PBSE_JOBNOTFOUND, __func__, "Job lost while acquiring queue 1"); + log_err(PBSE_JOBNOTFOUND, __func__, (char *)"Job lost while acquiring queue 1"); return(PBSE_JOBNOTFOUND); } @@ -262,7 +262,7 @@ int acct_job( ATR_ENCODE_CLIENT, resc_access_perm); - while ((pal = GET_NEXT(attrlist)) != NULL) + while ((pal = (svrattrl *)GET_NEXT(attrlist)) != NULL) { /* exec_host can use a lot of buffer space. Use a dynamic string */ append_dynamic_string(ds, pal->al_name); @@ -447,7 +447,7 @@ void account_record( } if (text == NULL) - text = ""; + text = (char *)""; pthread_mutex_lock(acctfile_mutex); fprintf(acctfile, "%02d/%02d/%04d %02d:%02d:%02d;%c;%s;%s\n", @@ -611,7 +611,7 @@ void acct_cleanup( if (log_remove_old(path_acct,(days_to_keep * SECS_PER_DAY)) != 0) { - log_err(-1, __func__, "failure occurred when checking for old accounting logs"); + log_err(-1, __func__, (char *)"failure occurred when checking for old accounting logs"); } return; diff --git a/src/server/array_func.c b/src/server/array_func.c index f67b64adfa..7b66bd66b9 100644 --- a/src/server/array_func.c +++ b/src/server/array_func.c @@ -161,7 +161,7 @@ job_array *get_array( pa = (job_array *)get_from_hash_map(allarrays.hm, id); if (pa != NULL) - lock_ai_mutex(pa, __func__, NULL, LOGLEVEL); + lock_ai_mutex(pa, __func__, (char *)NULL, LOGLEVEL); pthread_mutex_unlock(allarrays.allarrays_mutex); @@ -437,7 +437,7 @@ int array_recov( } } - pa->job_ids = calloc(pa->ai_qs.array_size, sizeof(char *)); + pa->job_ids = (char **)calloc(pa->ai_qs.array_size, sizeof(char *)); /* check to see if there is any additional info saved in the array file */ /* check if there are any array request tokens that haven't been fully @@ -498,10 +498,10 @@ int array_recov( array_save(pa); } - pa->ai_mutex = calloc(1, sizeof(pthread_mutex_t)); + pa->ai_mutex = (pthread_mutex_t *)calloc(1, sizeof(pthread_mutex_t)); pthread_mutex_init(pa->ai_mutex,NULL); - lock_ai_mutex(pa, __func__, NULL, LOGLEVEL); + lock_ai_mutex(pa, __func__, (char *)NULL, LOGLEVEL); /* link the struct into the servers list of job arrays */ insert_array(pa); @@ -534,7 +534,7 @@ int array_delete( remove_array(pa); /* unlock the mutex and free it */ - unlock_ai_mutex(pa, __func__, "1", LOGLEVEL); + unlock_ai_mutex(pa, __func__, (char *)"1", LOGLEVEL); free(pa->ai_mutex); /* delete the on disk copy of the struct */ @@ -689,14 +689,14 @@ int setup_array_struct( pa->ai_qs.num_cloned = 0; CLEAR_HEAD(pa->request_tokens); - pa->ai_mutex = calloc(1, sizeof(pthread_mutex_t)); + pa->ai_mutex = (pthread_mutex_t *)calloc(1, sizeof(pthread_mutex_t)); pthread_mutex_init(pa->ai_mutex, NULL); - lock_ai_mutex(pa, __func__, NULL, LOGLEVEL); + lock_ai_mutex(pa, __func__, (char *)NULL, LOGLEVEL); if (job_save(pjob, SAVEJOB_FULL, 0) != 0) { /* the array is deleted in svr_job_purge */ - unlock_ai_mutex(pa, __func__, "1", LOGLEVEL); + unlock_ai_mutex(pa, __func__, (char *)"1", LOGLEVEL); /* Does job array need to be removed? */ if (LOGLEVEL >= 6) @@ -705,7 +705,7 @@ int setup_array_struct( PBSEVENT_JOB, PBS_EVENTCLASS_JOB, pjob->ji_qs.ji_jobid, - "cannot save job"); + (char *)"cannot save job"); } svr_job_purge(pjob); @@ -766,7 +766,7 @@ int setup_array_struct( } /* initialize the array */ - pa->job_ids = calloc(array_size, sizeof(char *)); + pa->job_ids = (char **)calloc(array_size, sizeof(char *)); if (pa->job_ids == NULL) { sprintf(log_buf, "Failed to alloc job_ids: job %s", pjob->ji_qs.ji_jobid); @@ -791,7 +791,7 @@ int setup_array_struct( insert_array(pa); - unlock_ai_mutex(pa, __func__, "1", LOGLEVEL); + unlock_ai_mutex(pa, __func__, (char *)"1", LOGLEVEL); return(PBSE_NONE); } /* END setup_array_struct() */ @@ -1023,7 +1023,7 @@ int parse_array_request( rn->end = end; CLEAR_LINK(rn->request_tokens_link); - rn2 = GET_NEXT(*tl); + rn2 = (array_request_node *)GET_NEXT(*tl); searching = TRUE; while (searching) @@ -1042,19 +1042,19 @@ int parse_array_request( } else { - rn2 = GET_NEXT(rn2->request_tokens_link); + rn2 = (array_request_node *)GET_NEXT(rn2->request_tokens_link); } } - rn2 = GET_PRIOR(rn->request_tokens_link); + rn2 = (array_request_node *)GET_PRIOR(rn->request_tokens_link); if (rn2 != NULL && rn2->end >= rn->start) { num_bad_tokens++; } - rn2 = GET_NEXT(rn->request_tokens_link); + rn2 = (array_request_node *)GET_NEXT(rn->request_tokens_link); if (rn2 != NULL && rn2->start <= rn->end) { @@ -1138,7 +1138,7 @@ int delete_array_range( if (pjob->ji_qs.ji_state >= JOB_STATE_EXITING) { /* invalid state for request, skip */ - unlock_ji_mutex(pjob, __func__, "1", LOGLEVEL); + unlock_ji_mutex(pjob, __func__, (char *)"1", LOGLEVEL); continue; } @@ -1151,7 +1151,7 @@ int delete_array_range( { /* if the job was deleted, this mutex would be taked care of elsewhere. When it fails, * release it here */ - unlock_ji_mutex(pjob, __func__, "1", LOGLEVEL); + unlock_ji_mutex(pjob, __func__, (char *)"1", LOGLEVEL); num_skipped++; } @@ -1242,7 +1242,7 @@ int delete_whole_array( if (pjob->ji_qs.ji_state >= JOB_STATE_EXITING) { /* invalid state for request, skip */ - unlock_ji_mutex(pjob, __func__, "1", LOGLEVEL); + unlock_ji_mutex(pjob, __func__, (char *)"1", LOGLEVEL); continue; } @@ -1255,7 +1255,7 @@ int delete_whole_array( { /* if the job was deleted, this mutex would be taked care of elsewhere. * When it fails, release it here */ - unlock_ji_mutex(pjob, __func__, "2", LOGLEVEL); + unlock_ji_mutex(pjob, __func__, (char *)"2", LOGLEVEL); num_skipped++; } else if (running == FALSE) @@ -1408,10 +1408,10 @@ int release_array_range( { if ((rc = release_job(preq,pjob))) { - unlock_ji_mutex(pjob, __func__, "1", LOGLEVEL); + unlock_ji_mutex(pjob, __func__, (char *)"1", LOGLEVEL); return(rc); } - unlock_ji_mutex(pjob, __func__, "2", LOGLEVEL); + unlock_ji_mutex(pjob, __func__, (char *)"2", LOGLEVEL); } } @@ -1507,18 +1507,18 @@ int modify_array_range( pjob->ji_qs.ji_jobid); log_err(rc, __func__, log_buf); - unlock_ji_mutex(pjob, __func__, "1", LOGLEVEL); + unlock_ji_mutex(pjob, __func__, (char *)"1", LOGLEVEL); return(rc); /* unable to get to MOM */ } else { - unlock_ji_mutex(pjob, __func__, "2", LOGLEVEL); + unlock_ji_mutex(pjob, __func__, (char *)"2", LOGLEVEL); post_modify_arrayreq(array_req); } } else - unlock_ji_mutex(pjob, __func__, "2", LOGLEVEL); + unlock_ji_mutex(pjob, __func__, (char *)"2", LOGLEVEL); } else pa->job_ids[i] = NULL; @@ -1651,12 +1651,12 @@ void update_array_values( svr_evaljobstate(pj, &newstate, &newsub, 1); svr_setjobstate(pj, newstate, newsub, FALSE); job_save(pj, SAVEJOB_FULL, 0); - unlock_ji_mutex(pj, __func__, "1", LOGLEVEL); + unlock_ji_mutex(pj, __func__, (char *)"1", LOGLEVEL); break; } - unlock_ji_mutex(pj, __func__, "2", LOGLEVEL); + unlock_ji_mutex(pj, __func__, (char *)"2", LOGLEVEL); } } } @@ -1709,7 +1709,7 @@ void update_array_statuses() } strcpy(jobid, pa->ai_qs.parent_id); - unlock_ai_mutex(pa, __func__, "1", LOGLEVEL); + unlock_ai_mutex(pa, __func__, (char *)"1", LOGLEVEL); if ((pjob = svr_find_job(jobid, TRUE)) != NULL) { @@ -1728,7 +1728,7 @@ void update_array_statuses() svr_setjobstate(pjob, JOB_STATE_QUEUED, pjob->ji_qs.ji_substate, FALSE); } - unlock_ji_mutex(pjob, __func__, "2", LOGLEVEL); + unlock_ji_mutex(pjob, __func__, (char *)"2", LOGLEVEL); } } /* END for each array */ @@ -1754,7 +1754,7 @@ int num_array_jobs( int start; int end; - char *delim = ","; + char *delim = (char *)","; char *ptr; char *dash; char *tmp_ptr; @@ -1804,7 +1804,7 @@ void initialize_all_arrays_array() { allarrays.hm = get_hash_map(INITIAL_HASH_MAP_SIZE); - allarrays.allarrays_mutex = calloc(1, sizeof(pthread_mutex_t)); + allarrays.allarrays_mutex = (pthread_mutex_t *)calloc(1, sizeof(pthread_mutex_t)); pthread_mutex_init(allarrays.allarrays_mutex,NULL); } /* END initialize_all_arrays_array() */ @@ -1826,7 +1826,7 @@ int insert_array( if ((rc = add_to_hash_map(allarrays.hm, pa, pa->ai_qs.parent_id)) == ENOMEM) { - log_err(rc, __func__, "No memory to resize the array...SYSTEM FAILURE\n"); + log_err(rc, __func__, (char *)"No memory to resize the array...SYSTEM FAILURE\n"); } pthread_mutex_unlock(allarrays.allarrays_mutex); @@ -1850,13 +1850,13 @@ int remove_array( { strcpy(arrayid, pa->ai_qs.parent_id); - unlock_ai_mutex(pa, __func__, "1", LOGLEVEL); + unlock_ai_mutex(pa, __func__, (char *)"1", LOGLEVEL); pthread_mutex_lock(allarrays.allarrays_mutex); pa = (job_array *)get_from_hash_map(allarrays.hm, arrayid); if (pa != NULL) - lock_ai_mutex(pa, __func__, "2", LOGLEVEL); + lock_ai_mutex(pa, __func__, (char *)"2", LOGLEVEL); } if (pa == NULL) @@ -1885,7 +1885,7 @@ job_array *next_array( pa = (job_array *)next_from_hash_map(allarrays.hm, iter); if (pa != NULL) - lock_ai_mutex(pa, __func__, NULL, LOGLEVEL); + lock_ai_mutex(pa, __func__, (char *)NULL, LOGLEVEL); pthread_mutex_unlock(allarrays.allarrays_mutex); @@ -1908,7 +1908,7 @@ job_array *next_array_check( if ((pa != NULL) && (pa != owned)) - lock_ai_mutex(pa, __func__, NULL, LOGLEVEL); + lock_ai_mutex(pa, __func__, (char *)NULL, LOGLEVEL); pthread_mutex_unlock(allarrays.allarrays_mutex); diff --git a/src/server/attr_recov.c b/src/server/attr_recov.c index a736337300..6fb4c02e55 100644 --- a/src/server/attr_recov.c +++ b/src/server/attr_recov.c @@ -105,8 +105,6 @@ #include "utils.h" #include "server.h" - - /* data items global to functions in this file */ #define ENDATTRIBUTES -711 @@ -160,7 +158,7 @@ int save_struct( if (write_buffer(buf_ptr, buf_size, fds) != PBSE_NONE) { /* FAILURE */ - log_err(-1, __func__, "Cannot write the buffer to the file!"); + log_err(-1, __func__, (char *)"Cannot write the buffer to the file!"); return(-1); } else @@ -387,7 +385,7 @@ int recov_attr( if (i != sizeof(tempal)) { - log_err(errno, __func__, "read1"); + log_err(errno, __func__, (char *)"read1"); return(-1); } @@ -397,7 +395,7 @@ int recov_attr( if (tempal.al_tsize <= (int)sizeof(tempal)) { - log_err(-1, __func__, "attr size too small"); + log_err(-1, __func__, (char *)"attr size too small"); return(-1); } @@ -410,7 +408,7 @@ int recov_attr( if (pal == NULL) { - log_err(errno, __func__, "calloc failed"); + log_err(errno, __func__, (char *)"calloc failed"); return(-1); } @@ -427,7 +425,7 @@ int recov_attr( if (i != amt) { - log_err(errno, __func__, "read2"); + log_err(errno, __func__, (char *)"read2"); free(pal); @@ -470,7 +468,7 @@ int recov_attr( } else { - log_err(-1, __func__, "unknown attribute discarded"); + log_err(-1, __func__, (char *)"unknown attribute discarded"); free(pal); @@ -485,7 +483,7 @@ int recov_attr( pal->al_value, resc_access_perm); - if ((do_actions) && (padef + index)->at_action != (int (*)())0) + if ((do_actions) && (padef + index)->at_action != NULL) (padef + index)->at_action(pattr + index, parent, ATR_ACTION_RECOV); (pattr + index)->at_flags = pal->al_flags & ~ATR_VFLAG_MODIFY; diff --git a/src/server/exiting_jobs.c b/src/server/exiting_jobs.c index a41314674b..0f5ef395aa 100644 --- a/src/server/exiting_jobs.c +++ b/src/server/exiting_jobs.c @@ -209,11 +209,11 @@ int check_exiting_jobs() if (pjob->ji_qs.ji_state == JOB_STATE_COMPLETE) { remove_entry_from_exiting_list(jeri); - unlock_ji_mutex(pjob, __func__, NULL, LOGLEVEL); + unlock_ji_mutex(pjob, __func__, (char *)NULL, LOGLEVEL); } else { - unlock_ji_mutex(pjob, __func__, NULL, LOGLEVEL); + unlock_ji_mutex(pjob, __func__, (char *)NULL, LOGLEVEL); retry_job_exit(jeri); } } diff --git a/src/server/geteusernam.c b/src/server/geteusernam.c index 375c0fea69..75ada42cdf 100644 --- a/src/server/geteusernam.c +++ b/src/server/geteusernam.c @@ -176,13 +176,13 @@ static char *geteusernam( if (rule3) { - ptr = site_map_user(username, get_variable(pjob, "PBS_O_HOST")); + ptr = site_map_user(username, get_variable(pjob, (char *)"PBS_O_HOST")); if (ptr != username) snprintf(username, sizeof(username), "%s", ptr); } - ret_user = calloc(1, strlen(username) + 1); + ret_user = (char *)calloc(1, strlen(username) + 1); strcpy(ret_user,username); return(ret_user); @@ -203,7 +203,7 @@ static char *geteusernam( * Returns pointer to the group name or null */ -static char *getegroup( +char *getegroup( job *pjob, /* I */ pbs_attribute *pattr) /* I group_list pbs_attribute */ @@ -258,7 +258,7 @@ static char *getegroup( get_jobowner(hit, groupname); - ret_group = calloc(1, strlen(groupname) + 1); + ret_group = (char *)calloc(1, strlen(groupname) + 1); strcpy(ret_group,groupname); return(ret_group); @@ -410,7 +410,7 @@ int set_jobexid( pwent = getpwnam_ext(puser); - perm = svr_get_privilege(puser,get_variable(pjob,"PBS_O_HOST")); + perm = svr_get_privilege(puser,get_variable(pjob,(char *)"PBS_O_HOST")); if (pwent == NULL) { @@ -640,7 +640,7 @@ int set_jobexid( } else { - log_err(errno, __func__, "getpwnam failed"); + log_err(errno, __func__, (char *)"getpwnam failed"); if (EMsg != NULL) snprintf(EMsg, 1024, "user does not exist in server password file"); diff --git a/src/server/issue_request.c b/src/server/issue_request.c index 43a1b2a322..b2b805b0ac 100644 --- a/src/server/issue_request.c +++ b/src/server/issue_request.c @@ -183,7 +183,7 @@ int relay_to_mom( if ((node != NULL) && (node->nd_state & INUSE_DOWN)) { - unlock_node(node, __func__, "no rely mom", LOGLEVEL); + unlock_node(node, __func__, (char *)"no rely mom", LOGLEVEL); return(PBSE_NORELYMOM); } @@ -197,7 +197,7 @@ int relay_to_mom( free(tmp); } - unlock_node(node, __func__, "after svr_connect", LOGLEVEL); + unlock_node(node, __func__, (char *)"after svr_connect", LOGLEVEL); handle = svr_connect( pjob->ji_qs.ji_un.ji_exect.ji_momaddr, pjob->ji_qs.ji_un.ji_exect.ji_momport, @@ -215,7 +215,7 @@ int relay_to_mom( } strcpy(jobid, pjob->ji_qs.ji_jobid); - unlock_ji_mutex(pjob, __func__, NULL, LOGLEVEL); + unlock_ji_mutex(pjob, __func__, (char *)NULL, LOGLEVEL); request->rq_orgconn = request->rq_conn; /* save client socket */ @@ -235,13 +235,13 @@ int relay_to_mom( * a request that failed for a temporary reason */ -static void reissue_to_svr( +void reissue_to_svr( struct work_task *pwt) { time_t time_now = time(NULL); - char *br_id = pwt->wt_parm1; + char *br_id = (char *)pwt->wt_parm1; batch_request *preq = get_remove_batch_request(br_id); /* if not timed-out, retry send to remote server */ @@ -256,7 +256,7 @@ static void reissue_to_svr( pwt->wt_event = -1; /* seen as connection by post func */ if (pwt->wt_parmfunc != NULL) - ((void (*)())pwt->wt_parmfunc)(pwt); + (* pwt->wt_parmfunc)(pwt); } } @@ -379,7 +379,7 @@ void release_req( { batch_request *preq; - char *br_id = pwt->wt_parm1; + char *br_id = (char *)pwt->wt_parm1; if ((preq = get_remove_batch_request(br_id)) != NULL) free_br(preq); @@ -432,7 +432,7 @@ int send_request_to_remote_server( if ((chan = DIS_tcp_setup(sock)) == NULL) { log_err(PBSE_MEM_MALLOC, __func__, - "Could not allocate memory for socket buffer"); + (char *)"Could not allocate memory for socket buffer"); close_conn(sock, FALSE); return(PBSE_MEM_MALLOC); } @@ -564,9 +564,9 @@ int send_request_to_remote_server( rc = PBSD_sig_put( conn, - request->rq_ind.rq_signal.rq_jid, - request->rq_ind.rq_signal.rq_signame, - request->rq_extra); + (char *)request->rq_ind.rq_signal.rq_jid, + (char *)request->rq_ind.rq_signal.rq_signame, + (char *)request->rq_extra); break; diff --git a/src/server/job_attr_def.c b/src/server/job_attr_def.c index 7bf08b0c23..3861ecf983 100644 --- a/src/server/job_attr_def.c +++ b/src/server/job_attr_def.c @@ -156,7 +156,7 @@ attribute_def job_attr_def[] = { /* JOB_ATR_jobname */ - { ATTR_N, /* "Job_Name" */ + { (char *)ATTR_N, /* "Job_Name" */ decode_str, encode_str, set_str, @@ -168,7 +168,7 @@ attribute_def job_attr_def[] = PARENT_TYPE_JOB }, /* JOB_ATR_job_owner */ - { ATTR_owner, /* "Job_Owner" */ + { (char *)ATTR_owner, /* "Job_Owner" */ decode_str, encode_str, set_str, @@ -180,7 +180,7 @@ attribute_def job_attr_def[] = PARENT_TYPE_JOB }, /* JOB_ATR_resc_used */ - { ATTR_used, /* "Resources_Used" */ + { (char *)ATTR_used, /* "Resources_Used" */ decode_resc, encode_resc, set_resc, @@ -192,7 +192,7 @@ attribute_def job_attr_def[] = PARENT_TYPE_JOB }, /* JOB_ATR_state */ - { ATTR_state, /* "job_state" */ + { (char *)ATTR_state, /* "job_state" */ decode_c, encode_c, set_c, @@ -204,7 +204,7 @@ attribute_def job_attr_def[] = PARENT_TYPE_JOB }, /* JOB_ATR_in_queue */ - { ATTR_queue, /* "Queue" */ + { (char *)ATTR_queue, /* "Queue" */ decode_str, encode_str, set_str, @@ -216,7 +216,7 @@ attribute_def job_attr_def[] = PARENT_TYPE_JOB }, /* JOB_ATR_at_server */ - { ATTR_server, /* "Server" */ + { (char *)ATTR_server, /* "Server" */ decode_str, encode_str, set_str, @@ -228,7 +228,7 @@ attribute_def job_attr_def[] = PARENT_TYPE_JOB }, /* JOB_ATR_account */ - { ATTR_A, /* "Account_Name" */ + { (char *)ATTR_A, /* "Account_Name" */ decode_str, encode_str, set_str, @@ -240,7 +240,7 @@ attribute_def job_attr_def[] = PARENT_TYPE_JOB }, /* JOB_ATR_checkpoint */ - { ATTR_c, /* "Checkpoint" */ + { (char *)ATTR_c, /* "Checkpoint" */ decode_str, encode_str, set_str, @@ -264,7 +264,7 @@ attribute_def job_attr_def[] = PARENT_TYPE_JOB }, /* JOB_ATR_ctime */ /* create time, set when the job is queued */ - { ATTR_ctime, /* "ctime" */ + { (char *)ATTR_ctime, /* "ctime" */ decode_l, encode_l, set_l, @@ -276,7 +276,7 @@ attribute_def job_attr_def[] = PARENT_TYPE_JOB }, /* JOB_ATR_depend */ - { ATTR_depend, /* "depend" */ + { (char *)ATTR_depend, /* "depend" */ #ifndef PBS_MOM decode_depend, encode_depend, @@ -297,7 +297,7 @@ attribute_def job_attr_def[] = PARENT_TYPE_JOB }, /* JOB_ATR_errpath */ - { ATTR_e, /* "Error_Path" */ + { (char *)ATTR_e, /* "Error_Path" */ decode_str, encode_str, set_str, @@ -309,7 +309,7 @@ attribute_def job_attr_def[] = PARENT_TYPE_JOB }, /* JOB_ATR_exec_host */ - { ATTR_exechost, /* "exec_host" */ + { (char *)ATTR_exechost, /* "exec_host" */ decode_str, encode_exec_host, set_str, @@ -322,7 +322,7 @@ attribute_def job_attr_def[] = }, /* JOB_ATR_exec_port */ - { ATTR_execport, /* "exec_port" */ + { (char *)ATTR_execport, /* "exec_port" */ decode_str, encode_str, set_str, @@ -335,7 +335,7 @@ attribute_def job_attr_def[] = }, /* JOB_ATR_exec_gpus */ - { ATTR_exec_gpus, /* exec_gpus */ + { (char *)ATTR_exec_gpus, /* exec_gpus */ decode_str, encode_str, set_str, @@ -348,7 +348,7 @@ attribute_def job_attr_def[] = }, /* JOB_ATR_exectime */ - { ATTR_a, /* "Execution_Time" (aka release_date) */ + { (char *)ATTR_a, /* "Execution_Time" (aka release_date) */ decode_l, encode_l, set_l, @@ -364,7 +364,7 @@ attribute_def job_attr_def[] = PARENT_TYPE_JOB }, /* JOB_ATR_grouplst */ - { ATTR_g, /* "group_list" */ + { (char *)ATTR_g, /* "group_list" */ decode_arst, encode_arst, set_arst, @@ -376,7 +376,7 @@ attribute_def job_attr_def[] = PARENT_TYPE_JOB }, /* JOB_ATR_hold */ - { ATTR_h, /* "Hold_Types" */ + { (char *)ATTR_h, /* "Hold_Types" */ decode_hold, encode_hold, set_b, @@ -388,7 +388,7 @@ attribute_def job_attr_def[] = PARENT_TYPE_JOB }, /* JOB_ATR_interactive */ - { ATTR_inter, /* "interactive" */ + { (char *)ATTR_inter, /* "interactive" */ decode_l, encode_inter, set_l, @@ -400,7 +400,7 @@ attribute_def job_attr_def[] = PARENT_TYPE_JOB }, /* JOB_ATR_join */ - { ATTR_j, /* "Join_Path" */ + { (char *)ATTR_j, /* "Join_Path" */ decode_str, encode_str, set_str, @@ -412,7 +412,7 @@ attribute_def job_attr_def[] = PARENT_TYPE_JOB }, /* JOB_ATR_keep */ - { ATTR_k, /* "Keep_Files" */ + { (char *)ATTR_k, /* "Keep_Files" */ decode_str, encode_str, set_str, @@ -424,7 +424,7 @@ attribute_def job_attr_def[] = PARENT_TYPE_JOB }, /* JOB_ATR_mailpnts */ - { ATTR_m, /* "Mail_Points" */ + { (char *)ATTR_m, /* "Mail_Points" */ decode_str, encode_str, set_str, @@ -436,7 +436,7 @@ attribute_def job_attr_def[] = PARENT_TYPE_JOB }, /* JOB_ATR_mailuser */ - { ATTR_M, /* "Mail_Users" */ + { (char *)ATTR_M, /* "Mail_Users" */ decode_arst, encode_arst, set_arst, @@ -448,7 +448,7 @@ attribute_def job_attr_def[] = PARENT_TYPE_JOB }, /* JOB_ATR_mtime */ - { ATTR_mtime, /* "mtime" */ + { (char *)ATTR_mtime, /* "mtime" */ decode_l, encode_l, set_l, @@ -460,7 +460,7 @@ attribute_def job_attr_def[] = PARENT_TYPE_JOB }, /* JOB_ATR_outpath */ - { ATTR_o, /* "Output_Path" */ + { (char *)ATTR_o, /* "Output_Path" */ decode_str, encode_str, set_str, @@ -472,7 +472,7 @@ attribute_def job_attr_def[] = PARENT_TYPE_JOB }, /* JOB_ATR_priority */ - { ATTR_p, /* "Priority" */ + { (char *)ATTR_p, /* "Priority" */ decode_l, encode_l, set_l, @@ -484,7 +484,7 @@ attribute_def job_attr_def[] = PARENT_TYPE_JOB }, /* JOB_ATR_qtime */ - { ATTR_qtime, /* "qtime" (time entered queue) */ + { (char *)ATTR_qtime, /* "qtime" (time entered queue) */ decode_l, encode_l, set_l, @@ -496,7 +496,7 @@ attribute_def job_attr_def[] = PARENT_TYPE_JOB }, /* JOB_ATR_rerunable */ - { ATTR_r, /* "Rerunable" */ + { (char *)ATTR_r, /* "Rerunable" */ decode_b, encode_b, set_b, @@ -508,7 +508,7 @@ attribute_def job_attr_def[] = PARENT_TYPE_JOB }, /* JOB_ATR_resource */ - { ATTR_l, /* "Resource_List" */ + { (char *)ATTR_l, /* "Resource_List" */ decode_resc, encode_resc, set_resc, @@ -520,7 +520,7 @@ attribute_def job_attr_def[] = PARENT_TYPE_JOB }, /* JOB_ATR_session_id */ - { ATTR_session, /* "session_id" */ + { (char *)ATTR_session, /* "session_id" */ decode_l, encode_l, set_l, @@ -532,7 +532,7 @@ attribute_def job_attr_def[] = PARENT_TYPE_JOB }, /* JOB_ATR_shell */ - { ATTR_S, /* "Shell_Path_List" */ + { (char *)ATTR_S, /* "Shell_Path_List" */ decode_arst, encode_arst, set_arst, @@ -544,7 +544,7 @@ attribute_def job_attr_def[] = PARENT_TYPE_JOB }, /* JOB_ATR_stagein */ - { ATTR_stagein, /* "stagein" */ + { (char *)ATTR_stagein, /* "stagein" */ decode_arst, encode_arst, set_arst, @@ -556,7 +556,7 @@ attribute_def job_attr_def[] = PARENT_TYPE_JOB }, /* JOB_ATR_stageout */ - { ATTR_stageout, /* "stageout" */ + { (char *)ATTR_stageout, /* "stageout" */ decode_arst, encode_arst, set_arst, @@ -568,7 +568,7 @@ attribute_def job_attr_def[] = PARENT_TYPE_JOB }, /* JOB_ATR_substate */ - { ATTR_substate, /* "substate" */ + { (char *)ATTR_substate, /* "substate" */ decode_l, encode_l, set_l, @@ -580,7 +580,7 @@ attribute_def job_attr_def[] = PARENT_TYPE_JOB }, /* JOB_ATR_userlst */ - { ATTR_u, /* "User_List" */ + { (char *)ATTR_u, /* "User_List" */ decode_arst, encode_arst, #ifndef PBS_MOM @@ -596,7 +596,7 @@ attribute_def job_attr_def[] = PARENT_TYPE_JOB }, /* JOB_ATR_variables (allow to be dynamically modifiable) */ - { ATTR_v, /* "Variable_List" */ + { (char *)ATTR_v, /* "Variable_List" */ decode_arst, encode_arst, set_arst, @@ -608,7 +608,7 @@ attribute_def job_attr_def[] = PARENT_TYPE_JOB }, /* JOB_ATR_euser */ - { ATTR_euser, /* "euser" */ + { (char *)ATTR_euser, /* "euser" */ decode_str, encode_str, set_str, @@ -620,7 +620,7 @@ attribute_def job_attr_def[] = PARENT_TYPE_JOB }, /* JOB_ATR_egroup */ - { ATTR_egroup, /* "egroup" */ + { (char *)ATTR_egroup, /* "egroup" */ decode_str, encode_str, set_str, @@ -632,7 +632,7 @@ attribute_def job_attr_def[] = PARENT_TYPE_JOB }, /* JOB_ATR_hashname */ - { ATTR_hashname, /* "hashname" */ + { (char *)ATTR_hashname, /* "hashname" */ decode_str, encode_str, set_str, @@ -644,7 +644,7 @@ attribute_def job_attr_def[] = PARENT_TYPE_JOB }, /* JOB_ATR_hopcount */ - { ATTR_hopcount, /* "hop_count" */ + { (char *)ATTR_hopcount, /* "hop_count" */ decode_l, encode_l, set_l, @@ -656,7 +656,7 @@ attribute_def job_attr_def[] = PARENT_TYPE_JOB }, /* JOB_ATR_queuerank */ - { ATTR_qrank, /* "queue_rank" */ + { (char *)ATTR_qrank, /* "queue_rank" */ decode_l, encode_l, set_l, @@ -668,7 +668,7 @@ attribute_def job_attr_def[] = PARENT_TYPE_JOB }, /* JOB_ATR_queuetype */ - { ATTR_qtype, /*"queue_type" - exists for Scheduler select */ + { (char *)ATTR_qtype, /*"queue_type" - exists for Scheduler select */ decode_c, encode_c, set_c, @@ -680,7 +680,7 @@ attribute_def job_attr_def[] = PARENT_TYPE_JOB }, /* JOB_ATR_sched_hint */ - { ATTR_sched_hint, /* "sched_hint" - inform scheduler re sync */ + { (char *)ATTR_sched_hint, /* "sched_hint" - inform scheduler re sync */ decode_str, encode_str, set_str, @@ -692,7 +692,7 @@ attribute_def job_attr_def[] = PARENT_TYPE_JOB }, /* JOB_ATR_security */ - { ATTR_security, /* "security" */ + { (char *)ATTR_security, /* "security" */ decode_str, encode_str, set_str, @@ -704,7 +704,7 @@ attribute_def job_attr_def[] = PARENT_TYPE_JOB }, /* JOB_ATR_Comment */ - { ATTR_comment, /* "comment" */ + { (char *)ATTR_comment, /* "comment" */ decode_str, encode_str, set_str, @@ -716,7 +716,7 @@ attribute_def job_attr_def[] = PARENT_TYPE_JOB }, /* JOB_ATR_Cookie */ - { ATTR_cookie, /* "cookie" */ + { (char *)ATTR_cookie, /* "cookie" */ decode_str, encode_str, set_str, @@ -728,7 +728,7 @@ attribute_def job_attr_def[] = PARENT_TYPE_JOB }, /* JOB_ATR_altid */ - { ATTR_altid, /* "alt_id" */ + { (char *)ATTR_altid, /* "alt_id" */ decode_str, encode_str, set_str, @@ -740,7 +740,7 @@ attribute_def job_attr_def[] = PARENT_TYPE_JOB }, /* JOB_ATR_etime */ - { ATTR_etime, /* "etime" */ + { (char *)ATTR_etime, /* "etime" */ decode_l, encode_l, set_l, @@ -752,7 +752,7 @@ attribute_def job_attr_def[] = PARENT_TYPE_JOB }, /* JOB_ATR_exitstat */ - { ATTR_exitstat, /* "exit_status" */ + { (char *)ATTR_exitstat, /* "exit_status" */ decode_l, encode_l, set_l, @@ -764,7 +764,7 @@ attribute_def job_attr_def[] = PARENT_TYPE_JOB }, /* JOB_ATR_forwardx11 */ - { ATTR_forwardx11, /* "forward_x11" */ + { (char *)ATTR_forwardx11, /* "forward_x11" */ decode_str, encode_str, set_str, @@ -777,7 +777,7 @@ attribute_def job_attr_def[] = }, /* JOB_ATR_submit_args */ - { ATTR_submit_args, + { (char *)ATTR_submit_args, decode_str, encode_str, set_str, @@ -790,7 +790,7 @@ attribute_def job_attr_def[] = }, /* JOB_ATR_job_array_id */ - { ATTR_array_id, + { (char *)ATTR_array_id, decode_l, encode_l, set_l, @@ -803,7 +803,7 @@ attribute_def job_attr_def[] = }, /* JOB_ATR_job_array_request */ - { ATTR_t, + { (char *)ATTR_t, decode_str, encode_str, set_str, @@ -816,7 +816,7 @@ attribute_def job_attr_def[] = }, /* JOB_ATR_umask */ - { ATTR_umask, + { (char *)ATTR_umask, decode_l, encode_l, set_l, @@ -829,7 +829,7 @@ attribute_def job_attr_def[] = }, /* JOB_ATR_start_time */ - { ATTR_start_time, + { (char *)ATTR_start_time, decode_l, encode_l, set_l, @@ -842,7 +842,7 @@ attribute_def job_attr_def[] = }, /* JOB_ATR_start_count */ - { ATTR_start_count, + { (char *)ATTR_start_count, decode_l, encode_l, set_l, @@ -855,7 +855,7 @@ attribute_def job_attr_def[] = }, /* JOB_ATR_checkpoint_dir */ - { ATTR_checkpoint_dir, /* "checkpoint_dir" */ + { (char *)ATTR_checkpoint_dir, /* "checkpoint_dir" */ decode_str, encode_str, set_str, @@ -868,7 +868,7 @@ attribute_def job_attr_def[] = }, /* JOB_ATR_checkpoint_name */ - { ATTR_checkpoint_name, /* "checkpoint_name" */ + { (char *)ATTR_checkpoint_name, /* "checkpoint_name" */ decode_str, encode_str, set_str, @@ -881,7 +881,7 @@ attribute_def job_attr_def[] = }, /* JOB_ATR_checkpoint_time */ - { ATTR_checkpoint_time, /* "checkpoint_time" */ + { (char *)ATTR_checkpoint_time, /* "checkpoint_time" */ decode_l, encode_l, set_l, @@ -894,7 +894,7 @@ attribute_def job_attr_def[] = }, /* JOB_ATR_checkpoint_restart_status */ - { ATTR_checkpoint_restart_status, /* "checkpoint_restart_status" */ + { (char *)ATTR_checkpoint_restart_status, /* "checkpoint_restart_status" */ decode_str, encode_str, set_str, @@ -907,7 +907,7 @@ attribute_def job_attr_def[] = }, /* JOB_ATR_restart_name */ - { ATTR_restart_name, /* "restart_name" */ + { (char *)ATTR_restart_name, /* "restart_name" */ decode_str, encode_str, set_str, @@ -920,7 +920,7 @@ attribute_def job_attr_def[] = }, /* JOB_ATR_f (fault_tolerant)*/ - { ATTR_f, + { (char *)ATTR_f, decode_b, encode_b, set_b, @@ -933,7 +933,7 @@ attribute_def job_attr_def[] = }, /* JOB_ATR_comp_time */ - { ATTR_comp_time, /* completion time */ + { (char *)ATTR_comp_time, /* completion time */ decode_l, encode_l, set_l, @@ -946,7 +946,7 @@ attribute_def job_attr_def[] = }, /* JOB_ATR_reported */ - { ATTR_reported, /* "Reported" */ + { (char *)ATTR_reported, /* "Reported" */ decode_b, encode_b, set_b, @@ -959,7 +959,7 @@ attribute_def job_attr_def[] = }, /* JOB_ATR_jobtype */ - { ATTR_jobtype, /* "Job_Type" */ + { (char *)ATTR_jobtype, /* "Job_Type" */ decode_str, encode_str, set_str, @@ -972,7 +972,7 @@ attribute_def job_attr_def[] = }, /* JOB_ATR_inter_cmd */ - { ATTR_intcmd, /* "Interactive_Cmd" */ + { (char *)ATTR_intcmd, /* "Interactive_Cmd" */ decode_str, encode_str, set_str, @@ -985,7 +985,7 @@ attribute_def job_attr_def[] = }, /* JOB_ATR_job_radix */ - { ATTR_job_radix, /* "job_radix" */ + { (char *)ATTR_job_radix, /* "job_radix" */ decode_l, encode_l, set_l, @@ -998,7 +998,7 @@ attribute_def job_attr_def[] = }, /* JOB_ATR_total_runtime */ - { ATTR_total_runtime, /* total time from start_time to comp_time in milliseconds */ + { (char *)ATTR_total_runtime, /* total time from start_time to comp_time in milliseconds */ decode_tv, encode_tv, set_tv, @@ -1011,7 +1011,7 @@ attribute_def job_attr_def[] = }, /* JOB_ATR_sister_list */ - { ATTR_sister_list, /* sister_list */ + { (char *)ATTR_sister_list, /* sister_list */ decode_str, encode_str, set_str, @@ -1024,7 +1024,7 @@ attribute_def job_attr_def[] = }, /* JOB_ATR_proxy_user */ - { ATTR_P, /* "proxy_user" */ + { (char *)ATTR_P, /* "proxy_user" */ decode_str, encode_str, set_str, @@ -1037,7 +1037,7 @@ attribute_def job_attr_def[] = }, /* JOB_ATR_node_exclusive */ - { ATTR_node_exclusive, /* node_exclusive */ + { (char *)ATTR_node_exclusive, /* node_exclusive */ decode_b, encode_b, set_b, @@ -1050,7 +1050,7 @@ attribute_def job_attr_def[] = }, /* JOB_ATR_submit_host */ - {ATTR_submit_host, /* "submit_host - undocumented */ + {(char *)ATTR_submit_host, /* "submit_host - undocumented */ decode_str, encode_str, set_str, @@ -1062,7 +1062,7 @@ attribute_def job_attr_def[] = PARENT_TYPE_JOB}, /* JOB_ATR_init_work_dir */ - {ATTR_init_work_dir, /* "init_work_dir - undocumented */ + {(char *)ATTR_init_work_dir, /* "init_work_dir - undocumented */ decode_str, encode_str, set_str, @@ -1074,7 +1074,7 @@ attribute_def job_attr_def[] = PARENT_TYPE_JOB}, /* JOB_ATR_pagg_id */ - { ATTR_pagg, /* "pagg_id" */ + { (char *)ATTR_pagg, /* "pagg_id" */ decode_ll, encode_ll, set_ll, @@ -1088,7 +1088,7 @@ attribute_def job_attr_def[] = #ifdef NVIDIA_GPUS /* JOB_ATR_gpu_flags */ - {ATTR_gpu_flags, /* "gpu_flags" - mode and reset flags */ + {(char *)ATTR_gpu_flags, /* "gpu_flags" - mode and reset flags */ decode_l, encode_l, set_l, @@ -1101,7 +1101,7 @@ attribute_def job_attr_def[] = #endif /* NVIDIA_GPUS */ /* JOB_ATR_job_id */ - {ATTR_J, /* "job_id" */ + {(char *)ATTR_J, /* "job_id" */ decode_str, encode_str, set_str, @@ -1113,7 +1113,7 @@ attribute_def job_attr_def[] = PARENT_TYPE_JOB}, /* JOB_ATR_arguments*/ - {ATTR_args, /* "job_arguments" */ + {(char *)ATTR_args, /* "job_arguments" */ decode_str, encode_str, set_str, @@ -1125,7 +1125,7 @@ attribute_def job_attr_def[] = PARENT_TYPE_JOB}, /* JOB_ATR_reservation_id */ - {ATTR_reservation_id, /* "reservation_id" */ + {(char *)ATTR_reservation_id, /* "reservation_id" */ decode_str, encode_str, set_str, @@ -1137,7 +1137,7 @@ attribute_def job_attr_def[] = PARENT_TYPE_JOB}, /* JOB_ATR_login_node_id */ - {ATTR_login_node_id, /* "login_node_id" */ + {(char *)ATTR_login_node_id, /* "login_node_id" */ decode_str, encode_str, set_str, @@ -1149,7 +1149,7 @@ attribute_def job_attr_def[] = PARENT_TYPE_JOB}, /* JOB_ATR_login_prop */ - {ATTR_login_prop, /* "login_property" */ + {(char *)ATTR_login_prop, /* "login_property" */ decode_str, encode_str, set_str, @@ -1161,7 +1161,7 @@ attribute_def job_attr_def[] = PARENT_TYPE_JOB}, /* JOB_ATR_external_nodes */ - {ATTR_external_nodes, /* external_nodes */ + {(char *)ATTR_external_nodes, /* external_nodes */ decode_str, encode_str, set_str, @@ -1173,7 +1173,7 @@ attribute_def job_attr_def[] = PARENT_TYPE_JOB}, /* JOB_ATR_multi_req_alps */ - {ATTR_multi_req_alps, /* "multi_req_alps" */ + {(char *)ATTR_multi_req_alps, /* "multi_req_alps" */ decode_str, encode_str, set_str, @@ -1185,7 +1185,7 @@ attribute_def job_attr_def[] = PARENT_TYPE_JOB}, /* JOB_ATR_exec_mics */ - { ATTR_exec_mics, /* "exec_mics" */ + { (char *)ATTR_exec_mics, /* "exec_mics" */ decode_str, encode_str, set_str, @@ -1197,11 +1197,11 @@ attribute_def job_attr_def[] = PARENT_TYPE_JOB, }, - /* Site defined attributes if any, see site_job_attr_*.h */ +/* Site defined attributes if any, see site_job_attr_*.h */ #include "site_job_attr_def.h" /* JOB_ATR_UNKN - THIS MUST BE THE LAST ENTRY */ - { "_other_", + { (char *)"_other_", decode_unkn, encode_unkn, set_unkn, diff --git a/src/server/job_container.c b/src/server/job_container.c index fca7ab2a6c..875bd43803 100644 --- a/src/server/job_container.c +++ b/src/server/job_container.c @@ -163,7 +163,7 @@ char *get_correct_jobname( correct = strdup(jobid); if (correct == NULL) - log_err(-1, __func__, "ERROR: Fatal - Cannot allocate memory\n"); + log_err(-1, __func__, (char *)"ERROR: Fatal - Cannot allocate memory\n"); return(correct); } @@ -176,7 +176,7 @@ char *get_correct_jobname( if (correct == NULL) { - log_err(-1, __func__, "ERROR: Fatal - Cannot allocate memory\n"); + log_err(-1, __func__, (char *)"ERROR: Fatal - Cannot allocate memory\n"); return(NULL); } @@ -192,7 +192,7 @@ char *get_correct_jobname( if (correct == NULL) { - log_err(-1, __func__, "ERROR: Fatal - Cannot allocate memory\n"); + log_err(-1, __func__, (char *)"ERROR: Fatal - Cannot allocate memory\n"); return(NULL); } @@ -215,7 +215,7 @@ char *get_correct_jobname( if (correct == NULL) { - log_err(-1, __func__, "ERROR: Fatal - Cannot allocate memory\n"); + log_err(-1, __func__, (char *)"ERROR: Fatal - Cannot allocate memory\n"); return(NULL); } @@ -228,7 +228,7 @@ char *get_correct_jobname( if (correct == NULL) { - log_err(-1, __func__, "ERROR: Fatal - Cannot allocate memory\n"); + log_err(-1, __func__, (char *)"ERROR: Fatal - Cannot allocate memory\n"); return(NULL); } } @@ -240,7 +240,7 @@ char *get_correct_jobname( if (correct == NULL) { - log_err(-1, __func__, "ERROR: Fatal - Cannot allocate memory\n"); + log_err(-1, __func__, (char *)"ERROR: Fatal - Cannot allocate memory\n"); return(NULL); } @@ -260,7 +260,7 @@ char *get_correct_jobname( if (correct == NULL) { - log_err(-1, __func__, "ERROR: Fatal - Cannot allocate memory\n"); + log_err(-1, __func__, (char *)"ERROR: Fatal - Cannot allocate memory\n"); return(NULL); } @@ -278,7 +278,7 @@ char *get_correct_jobname( if (correct == NULL) { - log_err(-1, __func__, "ERROR: Fatal - Cannot allocate memory\n"); + log_err(-1, __func__, (char *)"ERROR: Fatal - Cannot allocate memory\n"); return(NULL); } @@ -303,7 +303,7 @@ char *get_correct_jobname( if (correct == NULL) { - log_err(-1, __func__, "ERROR: Fatal - Cannot allocate memory\n"); + log_err(-1, __func__, (char *)"ERROR: Fatal - Cannot allocate memory\n"); return(NULL); } @@ -342,7 +342,7 @@ job *find_job_by_array( if (i >= 0) pj = (job *)aj->ra->slots[i].item; if (pj != NULL) - lock_ji_mutex(pj, __func__, NULL, LOGLEVEL); + lock_ji_mutex(pj, __func__, (char *)NULL, LOGLEVEL); pthread_mutex_unlock(aj->alljobs_mutex); @@ -353,14 +353,14 @@ job *find_job_by_array( if (pj->ji_cray_clone != NULL) { pj = pj->ji_cray_clone; - unlock_ji_mutex(pj->ji_parent_job, __func__, NULL, LOGLEVEL); - lock_ji_mutex(pj, __func__, NULL, LOGLEVEL); + unlock_ji_mutex(pj->ji_parent_job, __func__, (char *)NULL, LOGLEVEL); + lock_ji_mutex(pj, __func__, (char *)NULL, LOGLEVEL); } } if (pj->ji_being_recycled == TRUE) { - unlock_ji_mutex(pj, __func__, "1", LOGLEVEL); + unlock_ji_mutex(pj, __func__, (char *)"1", LOGLEVEL); pj = NULL; } } @@ -467,18 +467,18 @@ job *svr_find_job( { pj = pj->ji_external_clone; - lock_ji_mutex(pj, __func__, NULL, 0); - unlock_ji_mutex(pj->ji_parent_job, __func__, NULL, 0); + lock_ji_mutex(pj, __func__, (char *)NULL, 0); + unlock_ji_mutex(pj->ji_parent_job, __func__, (char *)NULL, 0); if (pj->ji_being_recycled == TRUE) { - unlock_ji_mutex(pj, __func__, NULL, 0); + unlock_ji_mutex(pj, __func__, (char *)NULL, 0); pj = NULL; } } else { - unlock_ji_mutex(pj, __func__, NULL, 0); + unlock_ji_mutex(pj, __func__, (char *)NULL, 0); pj = NULL; } } @@ -528,7 +528,7 @@ int insert_job( if ((rc = insert_thing(aj->ra,pjob)) == -1) { rc = ENOMEM; - log_err(rc, __func__, "No memory to resize the array...SYSTEM FAILURE\n"); + log_err(rc, __func__, (char *)"No memory to resize the array...SYSTEM FAILURE\n"); } else { @@ -574,7 +574,7 @@ int insert_job_after( if ((rc = insert_thing_after(aj->ra,pjob,i)) == -1) { rc = ENOMEM; - log_err(rc, __func__, "No memory to resize the array...SYSTEM FAILURE"); + log_err(rc, __func__, (char *)"No memory to resize the array...SYSTEM FAILURE"); } else { @@ -605,7 +605,7 @@ int insert_job_after_index( if ((rc = insert_thing_after(aj->ra, pjob, index)) == -1) { rc = ENOMEM; - log_err(rc, __func__, "No memory to resize the array...SYSTEM FAILURE"); + log_err(rc, __func__, (char *)"No memory to resize the array...SYSTEM FAILURE"); } else { @@ -637,7 +637,7 @@ int insert_job_first( if ((rc = insert_thing_after(aj->ra,pjob,ALWAYS_EMPTY_INDEX)) == -1) { rc = ENOMEM; - log_err(rc, __func__, "No memory to resize the array...SYSTEM FAILURE"); + log_err(rc, __func__, (char *)"No memory to resize the array...SYSTEM FAILURE"); } else { @@ -667,14 +667,14 @@ int get_jobs_index( if (pthread_mutex_trylock(aj->alljobs_mutex)) { - unlock_ji_mutex(pjob, __func__, "1", LOGLEVEL); + unlock_ji_mutex(pjob, __func__, (char *)"1", LOGLEVEL); pthread_mutex_lock(aj->alljobs_mutex); - lock_ji_mutex(pjob, __func__, NULL, LOGLEVEL); + lock_ji_mutex(pjob, __func__, (char *)NULL, LOGLEVEL); if (pjob->ji_being_recycled == TRUE) { pthread_mutex_unlock(aj->alljobs_mutex); - unlock_ji_mutex(pjob, __func__, "2", LOGLEVEL); + unlock_ji_mutex(pjob, __func__, (char *)"2", LOGLEVEL); return(-1); } } @@ -705,14 +705,14 @@ int has_job( if (pthread_mutex_trylock(aj->alljobs_mutex)) { - unlock_ji_mutex(pjob, __func__, "1", LOGLEVEL); + unlock_ji_mutex(pjob, __func__, (char *)"1", LOGLEVEL); pthread_mutex_lock(aj->alljobs_mutex); - lock_ji_mutex(pjob, __func__, NULL, LOGLEVEL); + lock_ji_mutex(pjob, __func__, (char *)NULL, LOGLEVEL); if (pjob->ji_being_recycled == TRUE) { pthread_mutex_unlock(aj->alljobs_mutex); - unlock_ji_mutex(pjob, __func__, "1", LOGLEVEL); + unlock_ji_mutex(pjob, __func__, (char *)"1", LOGLEVEL); return(PBSE_JOB_RECYCLED); } @@ -752,14 +752,14 @@ int remove_job( LOG_EVENT(PBSEVENT_JOB, PBS_EVENTCLASS_JOB, __func__, pjob->ji_qs.ji_jobid); if (pthread_mutex_trylock(aj->alljobs_mutex)) { - unlock_ji_mutex(pjob, __func__, "1", LOGLEVEL); + unlock_ji_mutex(pjob, __func__, (char *)"1", LOGLEVEL); pthread_mutex_lock(aj->alljobs_mutex); - lock_ji_mutex(pjob, __func__, NULL, LOGLEVEL); + lock_ji_mutex(pjob, __func__, (char *)NULL, LOGLEVEL); if (pjob->ji_being_recycled == TRUE) { pthread_mutex_unlock(aj->alljobs_mutex); - unlock_ji_mutex(pjob, __func__, "1", LOGLEVEL); + unlock_ji_mutex(pjob, __func__, (char *)"1", LOGLEVEL); return(PBSE_JOB_RECYCLED); } } @@ -797,11 +797,11 @@ job *next_job( if (pjob != NULL) { - lock_ji_mutex(pjob, __func__, NULL, LOGLEVEL); + lock_ji_mutex(pjob, __func__, (char *)NULL, LOGLEVEL); if (pjob->ji_being_recycled == TRUE) { - unlock_ji_mutex(pjob, __func__, "1", LOGLEVEL); + unlock_ji_mutex(pjob, __func__, (char *)"1", LOGLEVEL); pjob = next_job(aj,iter); } @@ -826,7 +826,7 @@ job *next_job_from_back( pjob = (job *)next_thing_from_back(aj->ra,iter); if (pjob != NULL) - lock_ji_mutex(pjob, __func__, NULL, LOGLEVEL); + lock_ji_mutex(pjob, __func__, (char *)NULL, LOGLEVEL); pthread_mutex_unlock(aj->alljobs_mutex); @@ -834,7 +834,7 @@ job *next_job_from_back( { if (pjob->ji_being_recycled == TRUE) { - unlock_ji_mutex(pjob, __func__, "1", LOGLEVEL); + unlock_ji_mutex(pjob, __func__, (char *)"1", LOGLEVEL); pjob = next_job_from_back(aj,iter); } diff --git a/src/server/job_func.c b/src/server/job_func.c index ac30c7d913..81a9f615d4 100644 --- a/src/server/job_func.c +++ b/src/server/job_func.c @@ -206,7 +206,7 @@ void send_qsub_delmsg( pbs_attribute *pattri; int qsub_sock; - phost = arst_string("PBS_O_HOST", &pjob->ji_wattr[JOB_ATR_variables]); + phost = arst_string((char *)"PBS_O_HOST", &pjob->ji_wattr[JOB_ATR_variables]); if ((phost == NULL) || ((phost = strchr(phost, '=')) == NULL)) { @@ -275,7 +275,7 @@ int remtree( { if (errno != ENOENT) - log_err(errno, __func__, "stat"); + log_err(errno, __func__, (char *)"stat"); return(-1); } @@ -285,7 +285,7 @@ int remtree( if ((dir = opendir(dirname)) == NULL) { if (errno != ENOENT) - log_err(errno, __func__, "opendir"); + log_err(errno, __func__, (char *)"opendir"); return(-1); } @@ -312,7 +312,7 @@ int remtree( if (lstat(namebuf, &sb) == -1) #endif { - log_err(errno, __func__, "stat"); + log_err(errno, __func__, (char *)"stat"); rtnv = -1; @@ -439,7 +439,7 @@ int job_abt( { /* req_delete sends own mail and acct record */ - account_record(PBS_ACCT_ABT, pjob, ""); + account_record(PBS_ACCT_ABT, pjob, (char *)""); svr_mailowner(pjob, MAIL_ABORT, MAIL_NORMAL, text); if ((pjob->ji_qs.ji_state == JOB_STATE_QUEUED) && @@ -456,7 +456,7 @@ int job_abt( { svr_setjobstate(pjob, JOB_STATE_RUNNING, JOB_SUBSTATE_ABORT, FALSE); - if ((rc = issue_signal(&pjob, "SIGKILL", free_br, NULL)) != 0) + if ((rc = issue_signal(&pjob, (char *)"SIGKILL", free_br, NULL)) != 0) { if (pjob != NULL) { @@ -475,7 +475,7 @@ int job_abt( if (pjob->ji_wattr[JOB_ATR_depend].at_flags & ATR_VFLAG_SET) { - unlock_ji_mutex(pjob, __func__, "1a",LOGLEVEL); + unlock_ji_mutex(pjob, __func__, (char *)"1a",LOGLEVEL); depend_on_term(job_id); pjob = svr_find_job(job_id, TRUE); } @@ -491,11 +491,11 @@ int job_abt( { job_atr_hold = pjob->ji_wattr[JOB_ATR_hold].at_val.at_long; job_exit_status = pjob->ji_qs.ji_un.ji_exect.ji_exitstat; - unlock_ji_mutex(pjob, __func__, "1", LOGLEVEL); + unlock_ji_mutex(pjob, __func__, (char *)"1", LOGLEVEL); update_array_values(pa,old_state,aeTerminate, job_id, job_atr_hold, job_exit_status); - unlock_ai_mutex(pa, __func__, "1", LOGLEVEL); + unlock_ai_mutex(pa, __func__, (char *)"1", LOGLEVEL); pjob = svr_find_job(job_id, TRUE); } } @@ -516,7 +516,7 @@ int job_abt( pjob->ji_qs.ji_jobid, old_substate); log_err(-1, __func__, log_buf); - unlock_ji_mutex(pjob, __func__, "2", LOGLEVEL); + unlock_ji_mutex(pjob, __func__, (char *)"2", LOGLEVEL); } else { @@ -532,7 +532,7 @@ int job_abt( if (pjob->ji_wattr[JOB_ATR_depend].at_flags & ATR_VFLAG_SET) { strcpy(job_id, pjob->ji_qs.ji_jobid); - unlock_ji_mutex(pjob, __func__, "1b", LOGLEVEL); + unlock_ji_mutex(pjob, __func__, (char *)"1b", LOGLEVEL); depend_on_term(job_id); pjob = svr_find_job(job_id, TRUE); } @@ -548,11 +548,11 @@ int job_abt( { job_atr_hold = pjob->ji_wattr[JOB_ATR_hold].at_val.at_long; job_exit_status = pjob->ji_qs.ji_un.ji_exect.ji_exitstat; - unlock_ji_mutex(pjob, __func__, "3", LOGLEVEL); + unlock_ji_mutex(pjob, __func__, (char *)"3", LOGLEVEL); update_array_values(pa,old_state,aeTerminate, job_id, job_atr_hold, job_exit_status); - unlock_ai_mutex(pa, __func__, "1", LOGLEVEL); + unlock_ai_mutex(pa, __func__,(char *) "1", LOGLEVEL); pjob = svr_find_job(job_id, TRUE); } } @@ -655,14 +655,14 @@ job *job_alloc(void) if (pj == NULL) { - log_err(errno, __func__, "no memory"); + log_err(errno, __func__, (char *)"no memory"); return(NULL); } pj->ji_mutex = (pthread_mutex_t *)calloc(1, sizeof(pthread_mutex_t)); pthread_mutex_init(pj->ji_mutex,NULL); - lock_ji_mutex(pj, __func__, NULL, LOGLEVEL); + lock_ji_mutex(pj, __func__, (char *)NULL, LOGLEVEL); pj->ji_qs.qs_version = PBS_QS_VERSION; @@ -704,13 +704,13 @@ void job_free( if (pj->ji_cray_clone != NULL) { - lock_ji_mutex(pj->ji_cray_clone, __func__, NULL, 0); + lock_ji_mutex(pj->ji_cray_clone, __func__, (char *)NULL, 0); job_free(pj->ji_cray_clone, TRUE); } if (pj->ji_external_clone != NULL) { - lock_ji_mutex(pj->ji_external_clone, __func__, NULL, 0); + lock_ji_mutex(pj->ji_external_clone, __func__, (char *)NULL, 0); job_free(pj->ji_external_clone, TRUE); } @@ -773,7 +773,7 @@ job *copy_job( if ((pnewjob = job_alloc()) == NULL) { - log_err(errno, __func__, "no memory"); + log_err(errno, __func__, (char *)"no memory"); return(NULL); } @@ -844,14 +844,14 @@ job *job_clone( if (taskid > PBS_MAXJOBARRAY) { - log_err(-1, __func__, "taskid out of range"); + log_err(-1, __func__, (char *)"taskid out of range"); return(NULL); } if ((pnewjob = job_alloc()) == NULL) { - log_err(errno, __func__, "no memory"); + log_err(errno, __func__, (char *)"no memory"); return(NULL); } @@ -869,7 +869,7 @@ job *job_clone( /* find the job id for the cloned job */ if ((oldid = strdup(template_job->ji_qs.ji_jobid)) == NULL) { - log_err(ENOMEM, __func__, "no memory"); + log_err(ENOMEM, __func__, (char *)"no memory"); job_free(pnewjob, FALSE); return(NULL); @@ -926,7 +926,7 @@ job *job_clone( { /* FAILURE */ - log_err(errno, __func__, "cannot create job file"); + log_err(errno, __func__, (char *)"cannot create job file"); job_free(pnewjob, FALSE); return(NULL); @@ -1034,7 +1034,7 @@ job *job_clone( if (release_mutex == TRUE) { - unlock_ai_mutex(pa, __func__, "1", LOGLEVEL); + unlock_ai_mutex(pa, __func__, (char *)"1", LOGLEVEL); } return(pnewjob); @@ -1080,7 +1080,7 @@ void *job_clone_wt( if (jobid == NULL) { - log_err(ENOMEM, __func__, "Can't malloc"); + log_err(ENOMEM, __func__, (char *)"Can't malloc"); return(NULL); } @@ -1091,7 +1091,7 @@ void *job_clone_wt( free(jobid); if (template_job != NULL) - unlock_ji_mutex(template_job, __func__, "1", LOGLEVEL); + unlock_ji_mutex(template_job, __func__, (char *)"1", LOGLEVEL); return(NULL); } @@ -1101,7 +1101,7 @@ void *job_clone_wt( snprintf(namebuf, sizeof(namebuf), "%s%s.AR", path_jobs, template_job->ji_qs.ji_fileprefix); - unlock_ji_mutex(template_job, __func__, "2", LOGLEVEL); + unlock_ji_mutex(template_job, __func__, (char *)"2", LOGLEVEL); while ((rn = (array_request_node *)GET_NEXT(pa->request_tokens)) != NULL) { @@ -1118,13 +1118,13 @@ void *job_clone_wt( continue; } - lock_ji_mutex(template_job, __func__, NULL, LOGLEVEL); + lock_ji_mutex(template_job, __func__, (char *)NULL, LOGLEVEL); pjobclone = job_clone(template_job, pa, i); - unlock_ji_mutex(template_job, __func__, "3", LOGLEVEL); + unlock_ji_mutex(template_job, __func__, (char *)"3", LOGLEVEL); if (pjobclone == NULL) { - log_err(-1, __func__, "unable to clone job in job_clone_wt"); + log_err(-1, __func__, (char *)"unable to clone job in job_clone_wt"); continue; } else if (pjobclone == (job *)1) @@ -1149,7 +1149,7 @@ void *job_clone_wt( if ((rc = svr_enquejob(pjobclone, FALSE, prev_index))) { /* XXX need more robust error handling */ - unlock_ai_mutex(pa, __func__, "1", LOGLEVEL); + unlock_ai_mutex(pa, __func__, (char *)"1", LOGLEVEL); if (rc != PBSE_JOB_RECYCLED) svr_job_purge(pjobclone); @@ -1161,7 +1161,7 @@ void *job_clone_wt( if (job_save(pjobclone, SAVEJOB_FULL, 0) != 0) { /* XXX need more robust error handling */ - unlock_ai_mutex(pa, __func__, "2", LOGLEVEL); + unlock_ai_mutex(pa, __func__, (char *)"2", LOGLEVEL); svr_job_purge(pjobclone); pa = get_array(arrayid); @@ -1176,7 +1176,7 @@ void *job_clone_wt( rn->start++; if (prev_index != -1) - unlock_ji_mutex(pjobclone, __func__, "4", LOGLEVEL); + unlock_ji_mutex(pjobclone, __func__, (char *)"4", LOGLEVEL); } /* END for (i) */ if (rn->start > rn->end) @@ -1231,11 +1231,11 @@ void *job_clone_wt( svr_evaljobstate(pjob, &newstate, &newsub, 1); svr_setjobstate(pjob, newstate, newsub, FALSE); - unlock_ji_mutex(pjob, __func__, "5", LOGLEVEL); + unlock_ji_mutex(pjob, __func__, (char *)"5", LOGLEVEL); } } - unlock_ai_mutex(pa, __func__, "3", LOGLEVEL); + unlock_ai_mutex(pa, __func__, (char *)"3", LOGLEVEL); return(NULL); } /* END job_clone_wt */ @@ -1306,7 +1306,7 @@ struct batch_request *cpy_checkpoint( saveumask = umask(0000); if ((mkdir(serverfile, 01777) == -1) && (errno != EEXIST)) { - log_err(errno,"cpy_checkpoint", "Failed to create jobs checkpoint directory"); + log_err(errno,"cpy_checkpoint", (char *)"Failed to create jobs checkpoint directory"); } umask(saveumask); @@ -1374,13 +1374,13 @@ struct batch_request *cpy_checkpoint( PBSEVENT_ERROR | PBSEVENT_JOB, PBS_EVENTCLASS_JOB, pjob->ji_qs.ji_jobid, - "ERROR: cannot allocate 'to' memory in cpy_checkpoint"); + (char *)"ERROR: cannot allocate 'to' memory in cpy_checkpoint"); return(preq); } strcpy(to, server_name); - strcat(to, ":"); + strcat(to, (char *)":"); strcat(to, serverfile); from = (char *)calloc(1, strlen(momfile) + 1); @@ -1393,7 +1393,7 @@ struct batch_request *cpy_checkpoint( PBSEVENT_ERROR | PBSEVENT_JOB, PBS_EVENTCLASS_JOB, pjob->ji_qs.ji_jobid, - "ERROR: cannot allocate 'from' memory for from in cpy_checkpoint"); + (char *)"ERROR: cannot allocate 'from' memory for from in cpy_checkpoint"); free(to); @@ -1462,7 +1462,7 @@ void remove_checkpoint( PBSEVENT_JOB, PBS_EVENTCLASS_FILE, pjob->ji_qs.ji_jobid, - "unable to remove checkpoint file for job"); + (char *)"unable to remove checkpoint file for job"); } free_br(preq); @@ -1522,14 +1522,14 @@ int record_jobinfo( if ((rc = job_log_open(job_log_file, path_jobinfo_log)) < 0) { pthread_mutex_unlock(job_log_mutex); - log_err(rc, __func__, "Could not open job log "); + log_err(rc, __func__, (char *)"Could not open job log "); return(rc); } pthread_mutex_unlock(job_log_mutex); if ((buffer = get_dynamic_string(MAXLINE << 3, NULL)) == NULL) { - log_err(ENOMEM, __func__, "Can't allocate memory"); + log_err(ENOMEM, __func__, (char *)"Can't allocate memory"); return(-1); } @@ -1636,7 +1636,7 @@ int record_jobinfo( if ((rc = append_dynamic_string(buffer, "\n")) != PBSE_NONE) { - log_err(rc, __func__, ""); + log_err(rc, __func__, (char *)""); free_dynamic_string(buffer); return(rc); } @@ -1696,7 +1696,7 @@ int svr_job_purge( /* Start a task to monitor job log roll over if it is not already started */ if (check_job_log_started == 0) { - set_task(WORK_Timed, time_now + 10, check_job_log, NULL, FALSE); + set_task(WORK_Timed, time_now + 10, check_job_log, (char *)NULL, FALSE); check_job_log_started = 1; } @@ -1742,7 +1742,7 @@ int svr_job_purge( { array_save(pa); - unlock_ai_mutex(pa, __func__, "1", LOGLEVEL); + unlock_ai_mutex(pa, __func__, (char *)"1", LOGLEVEL); } } } @@ -1758,7 +1758,7 @@ int svr_job_purge( { int need_deque = !pjob->ji_cold_restart; - unlock_ji_mutex(pjob, __func__, "1", LOGLEVEL); + unlock_ji_mutex(pjob, __func__, (char *)"1", LOGLEVEL); /* jobs that are being deleted after a cold restart * haven't been queued */ @@ -1772,7 +1772,7 @@ int svr_job_purge( if (pjob->ji_being_recycled == FALSE) job_free(pjob, TRUE); else - unlock_ji_mutex(pjob, __func__, "2", LOGLEVEL); + unlock_ji_mutex(pjob, __func__, (char *)"2", LOGLEVEL); } } else @@ -1915,7 +1915,7 @@ job_array *get_jobs_array( if (pjob->ji_arraystructid[0] != '\0') { strcpy(arrayid, pjob->ji_arraystructid); - unlock_ji_mutex(pjob, __func__, "1", LOGLEVEL); + unlock_ji_mutex(pjob, __func__, (char *)"1", LOGLEVEL); if (LOGLEVEL >= 7) { @@ -1927,7 +1927,7 @@ job_array *get_jobs_array( if ((pjob = svr_find_job(jobid, TRUE)) == NULL) { - unlock_ai_mutex(pa, __func__, "1", LOGLEVEL); + unlock_ai_mutex(pa, __func__, (char *)"1", LOGLEVEL); pa = NULL; *pjob_ptr = NULL; } @@ -2072,7 +2072,7 @@ int fix_cray_exec_hosts( { char *external = pjob->ji_wattr[JOB_ATR_external_nodes].at_val.at_str; char *exec = pjob->ji_wattr[JOB_ATR_exec_host].at_val.at_str; - char *new_exec = calloc(1, strlen(exec) + 1); + char *new_exec = (char *)calloc(1, strlen(exec) + 1); char *exec_ptr = exec; char *plus; char *slash; @@ -2149,7 +2149,7 @@ int split_job( change_external_job_name(external); external->ji_parent_job = pjob; pjob->ji_external_clone = external; - unlock_ji_mutex(external, __func__, NULL, 0); + unlock_ji_mutex(external, __func__, (char *)NULL, 0); } if (pjob->ji_cray_clone == NULL) @@ -2158,7 +2158,7 @@ int split_job( fix_cray_exec_hosts(cray); cray->ji_parent_job = pjob; pjob->ji_cray_clone = cray; - unlock_ji_mutex(cray, __func__, NULL, 0); + unlock_ji_mutex(cray, __func__, (char *)NULL, 0); } return(PBSE_NONE); diff --git a/src/server/job_recov.c b/src/server/job_recov.c index 15fdac7ae3..232d7f2714 100644 --- a/src/server/job_recov.c +++ b/src/server/job_recov.c @@ -197,9 +197,9 @@ int job_save( tmp_ptr = JOB_FILE_SUFFIX; #else if (pjob->ji_is_array_template == TRUE) - tmp_ptr = JOB_FILE_TMP_SUFFIX; + tmp_ptr = (char *)JOB_FILE_TMP_SUFFIX; else - tmp_ptr = JOB_FILE_SUFFIX; + tmp_ptr = (char *)JOB_FILE_SUFFIX; #endif if (mom_port) @@ -259,7 +259,7 @@ int job_save( if (lseek(fds, (off_t)0, SEEK_SET) < 0) { - log_err(errno, "job_save", "lseek"); + log_err(errno, "job_save", (char *)"lseek"); close(fds); @@ -270,7 +270,7 @@ int job_save( } else { - log_err(errno, "job_save", "quickwrite"); + log_err(errno, "job_save", (char *)"quickwrite"); close(fds); @@ -306,7 +306,7 @@ int job_save( if (fds < 0) { - log_err(errno, "job_save", "open for full save"); + log_err(errno, "job_save", (char *)"open for full save"); return(-1); } @@ -354,7 +354,7 @@ int job_save( { if (lseek(fds, (off_t)0, SEEK_SET) < 0) { - log_err(errno, "job_save", "full lseek"); + log_err(errno, "job_save", (char *)"full lseek"); } } else @@ -383,7 +383,7 @@ int job_save( PBSEVENT_ERROR | PBSEVENT_SECURITY, PBS_EVENTCLASS_JOB, pjob->ji_qs.ji_jobid, - "Link in job_save failed"); + (char *)"Link in job_save failed"); } else { @@ -450,7 +450,7 @@ job *job_recov( log_err(errno, __func__, log_buf); #ifndef PBS_MOM - unlock_ji_mutex(pj, __func__, "1", LOGLEVEL); + unlock_ji_mutex(pj, __func__, (char *)"1", LOGLEVEL); free(pj->ji_mutex); #endif @@ -471,7 +471,7 @@ job *job_recov( log_err(errno, __func__, log_buf); #ifndef PBS_MOM - unlock_ji_mutex(pj, __func__, "2", LOGLEVEL); + unlock_ji_mutex(pj, __func__, (char *)"2", LOGLEVEL); free(pj->ji_mutex); #endif @@ -500,7 +500,7 @@ job *job_recov( log_err(-1, __func__, log_buf); #ifndef PBS_MOM - unlock_ji_mutex(pj, __func__, "3", LOGLEVEL); + unlock_ji_mutex(pj, __func__, (char *)"3", LOGLEVEL); free(pj->ji_mutex); #endif @@ -529,7 +529,7 @@ job *job_recov( log_err(-1, __func__, log_buf); #ifndef PBS_MOM - unlock_ji_mutex(pj, __func__, "4", LOGLEVEL); + unlock_ji_mutex(pj, __func__, (char *)"4", LOGLEVEL); free(pj->ji_mutex); #endif @@ -556,7 +556,7 @@ job *job_recov( log_err(-1, __func__, log_buf); #ifndef PBS_MOM - unlock_ji_mutex(pj, __func__, "5", LOGLEVEL); + unlock_ji_mutex(pj, __func__, (char *)"5", LOGLEVEL); job_free(pj, FALSE); #else mom_job_free(pj); @@ -612,7 +612,7 @@ job *job_recov( pa = get_array(parent_id); if (pa == NULL) { - job_abt(&pj, "Array job missing array struct, aborting job"); + job_abt(&pj, (char *)"Array job missing array struct, aborting job"); close(fds); return NULL; } @@ -643,7 +643,7 @@ job *job_recov( if (pa != NULL) { - unlock_ai_mutex(pa, __func__, "1", LOGLEVEL); + unlock_ai_mutex(pa, __func__, (char *)"1", LOGLEVEL); } } diff --git a/src/server/job_recycler.c b/src/server/job_recycler.c index cc3dee8367..42325e7145 100644 --- a/src/server/job_recycler.c +++ b/src/server/job_recycler.c @@ -116,7 +116,7 @@ job *next_job_from_recycler( pthread_mutex_unlock(aj->alljobs_mutex); if (pjob != NULL) - lock_ji_mutex(pjob, __func__, NULL, LOGLEVEL); + lock_ji_mutex(pjob, __func__, (char *)NULL, LOGLEVEL); return(pjob); } /* END next_job_from_recycler() */ @@ -146,7 +146,7 @@ void *remove_some_recycle_jobs( log_event(PBSEVENT_JOB, PBS_EVENTCLASS_JOB, __func__, pjob->ji_qs.ji_jobid); remove_job(&recycler.rc_jobs, pjob); - unlock_ji_mutex(pjob, __func__, "1", LOGLEVEL); + unlock_ji_mutex(pjob, __func__, (char *)"1", LOGLEVEL); free(pjob->ji_mutex); memset(pjob, 255, sizeof(job)); free(pjob); diff --git a/src/server/job_route.c b/src/server/job_route.c index 84bdb8480f..d311dc33b6 100644 --- a/src/server/job_route.c +++ b/src/server/job_route.c @@ -556,19 +556,19 @@ void *queue_route( /* the second condition says we only want to try if routing * has been tried once - this is to let req_commit have the * first crack at routing always */ - unlock_queue(pque, __func__, NULL, 0); + unlock_queue(pque, __func__, (char *)NULL, 0); if ((pjob->ji_qs.ji_un.ji_routet.ji_rteretry <= time_now - ROUTE_RETRY_TIME) && (pjob->ji_qs.ji_un.ji_routet.ji_rteretry != 0)) { reroute_job(pjob, pque); - unlock_ji_mutex(pjob, __func__, "1", LOGLEVEL); + unlock_ji_mutex(pjob, __func__, (char *)"1", LOGLEVEL); } else - unlock_ji_mutex(pjob, __func__, "1", LOGLEVEL); + unlock_ji_mutex(pjob, __func__, (char *)"1", LOGLEVEL); } free(queue_name); - unlock_queue(pque, __func__, NULL, 0); + unlock_queue(pque, __func__, (char *)NULL, 0); pthread_mutex_unlock(reroute_job_mutex); return(NULL); } /* END queue_route() */ diff --git a/src/server/node_attr_def.c b/src/server/node_attr_def.c index e6416ab9b6..35a7bd8a64 100644 --- a/src/server/node_attr_def.c +++ b/src/server/node_attr_def.c @@ -122,7 +122,7 @@ attribute_def node_attr_def[] = { /* ND_ATR_state */ - { ATTR_NODE_state, /* "state" */ + { (char *)ATTR_NODE_state, /* "state" */ decode_state, encode_state, set_node_state, @@ -135,7 +135,7 @@ attribute_def node_attr_def[] = }, /* ND_ATR_np */ - { ATTR_NODE_np, /* "np" */ + { (char *)ATTR_NODE_np, /* "np" */ decode_l, encode_l, set_l, @@ -147,7 +147,7 @@ attribute_def node_attr_def[] = PARENT_TYPE_NODE, }, /* ND_ATR_properties */ - { ATTR_NODE_properties, /* "properties" */ + { (char *)ATTR_NODE_properties, /* "properties" */ decode_arst, encode_arst, set_arst, @@ -160,7 +160,7 @@ attribute_def node_attr_def[] = }, /* ND_ATR_ntype */ - { ATTR_NODE_ntype, /* "ntype" */ + { (char *)ATTR_NODE_ntype, /* "ntype" */ decode_ntype, encode_ntype, set_node_ntype, @@ -173,7 +173,7 @@ attribute_def node_attr_def[] = }, /* ND_ATR_jobs */ - { ATTR_NODE_jobs, /* "jobs" */ + { (char *)ATTR_NODE_jobs, /* "jobs" */ decode_null, encode_jobs, set_null, @@ -186,7 +186,7 @@ attribute_def node_attr_def[] = }, /* ND_ATR_status */ - { ATTR_NODE_status, + { (char *)ATTR_NODE_status, decode_arst, encode_arst, set_arst, @@ -199,7 +199,7 @@ attribute_def node_attr_def[] = }, /* ND_ATR_note */ - { ATTR_NODE_note, /* "note" */ + { (char *)ATTR_NODE_note, /* "note" */ decode_str, encode_str, set_note_str, @@ -211,7 +211,7 @@ attribute_def node_attr_def[] = PARENT_TYPE_NODE, }, /* ND_ATR_mom_port */ - { ATTR_NODE_mom_port, /* "mom_service_port" */ + { (char *)ATTR_NODE_mom_port, /* "mom_service_port" */ decode_l, encode_l, set_l, @@ -223,7 +223,7 @@ attribute_def node_attr_def[] = PARENT_TYPE_NODE, }, /* ND_ATR_mom_rm_port */ - { ATTR_NODE_mom_rm_port, /* "mom_manager_port" */ + { (char *)ATTR_NODE_mom_rm_port, /* "mom_manager_port" */ decode_l, encode_l, set_l, @@ -235,7 +235,7 @@ attribute_def node_attr_def[] = PARENT_TYPE_NODE, }, /* ND_ATR_num_node_boards */ - { ATTR_NODE_num_node_boards, /* "num_node_boards" */ + { (char *)ATTR_NODE_num_node_boards, /* "num_node_boards" */ decode_l, encode_l, set_l, @@ -247,7 +247,7 @@ attribute_def node_attr_def[] = PARENT_TYPE_NODE, }, /* ND_ATR_numa_str */ - { ATTR_NODE_numa_str, /* "node_board_str" */ + { (char *)ATTR_NODE_numa_str, /* "node_board_str" */ decode_str, encode_str, set_str, @@ -259,7 +259,7 @@ attribute_def node_attr_def[] = PARENT_TYPE_NODE, }, /* ND_ATR_gpus */ - { ATTR_NODE_gpus, /* "gpus" */ + { (char *)ATTR_NODE_gpus, /* "gpus" */ decode_l, encode_l, set_l, @@ -271,7 +271,7 @@ attribute_def node_attr_def[] = PARENT_TYPE_NODE, }, /* ND_ATR_gpus_str */ - { ATTR_NODE_gpus_str, /* "numa_gpu_node_str" */ + { (char *)ATTR_NODE_gpus_str, /* "numa_gpu_node_str" */ decode_str, encode_str, set_str, @@ -283,7 +283,7 @@ attribute_def node_attr_def[] = PARENT_TYPE_NODE, }, /* ND_ATR_gpustatus */ - {ATTR_NODE_gpustatus, /* "gpu_status" */ + {(char *)ATTR_NODE_gpustatus, /* "gpu_status" */ decode_arst, encode_arst, set_arst, @@ -295,7 +295,7 @@ attribute_def node_attr_def[] = PARENT_TYPE_NODE, }, /* ND_ATR_mics */ - { ATTR_NODE_mics, /* "mics" */ + { (char *)ATTR_NODE_mics, /* "mics" */ decode_l, encode_l, set_l, @@ -307,7 +307,7 @@ attribute_def node_attr_def[] = PARENT_TYPE_NODE, }, /* ND_ATR_micstatus */ - {ATTR_NODE_micstatus, /* "mic_status" */ + {(char *)ATTR_NODE_micstatus, /* "mic_status" */ decode_arst, encode_arst, set_arst, diff --git a/src/server/node_func.c b/src/server/node_func.c index 03dd8d4aae..41917b77a3 100644 --- a/src/server/node_func.c +++ b/src/server/node_func.c @@ -511,7 +511,7 @@ int login_encode_jobs( if (pjob != NULL) { login_id = pjob->ji_wattr[JOB_ATR_login_node_id].at_val.at_str; - unlock_ji_mutex(pjob, __func__, "1", LOGLEVEL); + unlock_ji_mutex(pjob, __func__, (char *)"1", LOGLEVEL); } if ((login_id == NULL) || @@ -529,7 +529,7 @@ int login_encode_jobs( if ((pal = attrlist_create(ATTR_NODE_jobs, NULL, strlen(job_str->str) + 1)) == NULL) { - log_err(ENOMEM, __func__, ""); + log_err(ENOMEM, __func__, (char *)""); return(ENOMEM); } @@ -786,7 +786,7 @@ int initialize_pbsnode( pnode->nd_mutex = (pthread_mutex_t *)calloc(1, sizeof(pthread_mutex_t)); if (pnode->nd_mutex == NULL) { - log_err(ENOMEM, __func__, "Could not allocate memory for the node's mutex"); + log_err(ENOMEM, __func__, (char *)"Could not allocate memory for the node's mutex"); return(ENOMEM); } @@ -1382,7 +1382,7 @@ int create_a_gpusubnode( { rc = PBSE_MEM_MALLOC; log_err(rc,__func__, - "Couldn't allocate memory for a subnode. EPIC FAILURE"); + (char *)"Couldn't allocate memory for a subnode. EPIC FAILURE"); return(rc); } @@ -1585,7 +1585,7 @@ int setup_node_boards( if (allocd_name == NULL) { /* no memory error */ - log_err(PBSE_SYSTEM, __func__, "Cannot allocate memory for node name\n"); + log_err(PBSE_SYSTEM, __func__, (char *)"Cannot allocate memory for node name\n"); return(PBSE_SYSTEM); } @@ -1740,7 +1740,7 @@ int create_pbs_node( if (host_info == NULL) { - log_err(-1, __func__, "create_pbs_node calloc failed"); + log_err(-1, __func__, (char *)"create_pbs_node calloc failed"); return(PBSE_MEM_MALLOC); } @@ -1755,7 +1755,7 @@ int create_pbs_node( pattrl = attrlist_create(pal->al_atopl.name, 0, strlen(pal->al_atopl.value) + 1); if (pattrl == NULL) { - log_err(-1, __func__, "cannot create node attribute"); + log_err(-1, __func__, (char *)"cannot create node attribute"); free(host_info); if (pul != NULL) free(pul); @@ -1781,7 +1781,7 @@ int create_pbs_node( free(host_info); if (pul != NULL) free(pul); - log_err(-1, __func__, "create_pbs_node calloc failed"); + log_err(-1, __func__, (char *)"create_pbs_node calloc failed"); return(PBSE_MEM_MALLOC); } @@ -3182,7 +3182,7 @@ int insert_node( if ((rc = insert_thing(an->ra,pnode)) == -1) { rc = ENOMEM; - log_err(rc, __func__, "No memory to resize the array...SYSTEM FAILURE"); + log_err(rc, __func__, (char *)"No memory to resize the array...SYSTEM FAILURE"); } else { diff --git a/src/server/node_func.h b/src/server/node_func.h index 41f10ef68f..d048018b33 100644 --- a/src/server/node_func.h +++ b/src/server/node_func.h @@ -64,19 +64,19 @@ int setup_nodes(void); /* static void delete_a_gpusubnode(struct pbsnode *pnode); */ -int node_np_action(pbs_attribute *new, void *pobj, int actmode); +int node_np_action(pbs_attribute *new_attr, void *pobj, int actmode); -int node_mom_port_action(pbs_attribute *new, void *pobj, int actmode); +int node_mom_port_action(pbs_attribute *new_attr, void *pobj, int actmode); -int node_mom_rm_port_action(pbs_attribute *new, void *pobj, int actmode); +int node_mom_rm_port_action(pbs_attribute *new_attr, void *pobj, int actmode); -int node_gpus_action(pbs_attribute *new, void *pnode, int actmode); +int node_gpus_action(pbs_attribute *new_attr, void *pnode, int actmode); -int node_numa_action(pbs_attribute *new, void *pnode, int actmode); +int node_numa_action(pbs_attribute *new_attr, void *pnode, int actmode); -int numa_str_action(pbs_attribute *new, void *pnode, int actmode); +int numa_str_action(pbs_attribute *new_attr, void *pnode, int actmode); -int gpu_str_action(pbs_attribute *new, void *pnode, int actmode); +int gpu_str_action(pbs_attribute *new_attr, void *pnode, int actmode); int create_partial_pbs_node(char *nodename, unsigned long addr, int perms); diff --git a/src/server/node_manager.c b/src/server/node_manager.c index 7cf30f9a2c..2507c4a23d 100644 --- a/src/server/node_manager.c +++ b/src/server/node_manager.c @@ -235,7 +235,7 @@ struct pbsnode *tfind_addr( if (pn == NULL) return(NULL); - lock_node(pn, __func__, "pn", LOGLEVEL); + lock_node(pn, __func__, (char *)"pn", LOGLEVEL); if (pn->num_node_boards == 0) return(pn); @@ -263,7 +263,7 @@ struct pbsnode *tfind_addr( if (dash == NULL) { /* node has numa nodes but no dashes in exec host?? */ - log_err(-1, __func__, "Numa node but there's no dash in exec_host?"); + log_err(-1, __func__, (char *)"Numa node but there's no dash in exec_host?"); return(pn); } @@ -272,8 +272,8 @@ struct pbsnode *tfind_addr( numa = AVL_find(index, pn->nd_mom_port, pn->node_boards); - unlock_node(pn, __func__, "pn->numa", LOGLEVEL); - lock_node(numa, __func__, "numa", LOGLEVEL); + unlock_node(pn, __func__, (char *)"pn->numa", LOGLEVEL); + lock_node(numa, __func__, (char *)"numa", LOGLEVEL); if (plus != NULL) *plus = '+'; @@ -494,7 +494,7 @@ void update_node_state( if (LOGLEVEL >= 7) { sprintf(log_buf, "subnode allocation correct on node %s (%d free, %d configured)", - (np->nd_name != NULL) ? np->nd_name : "NULL", + (np->nd_name != NULL) ? np->nd_name : (char *)"NULL", np->nd_nsnfree, np->nd_nsn); } @@ -622,9 +622,9 @@ int is_job_on_node( { numa = AVL_find(i,pnode->nd_mom_port,pnode->node_boards); - lock_node(numa, __func__, "before check_node_for_job numa", LOGLEVEL); + lock_node(numa, __func__, (char *)"before check_node_for_job numa", LOGLEVEL); present = check_node_for_job(pnode,jobid); - unlock_node(numa, __func__, "after check_node_for_job numa", LOGLEVEL); + unlock_node(numa, __func__, (char *)"after check_node_for_job numa", LOGLEVEL); /* leave loop if we found the job */ if (present != FALSE) @@ -717,7 +717,7 @@ int kill_job_on_mom( { if ((preq = alloc_br(PBS_BATCH_SignalJob)) == NULL) { - log_err(-1, __func__, "unable to allocate SignalJob request-trouble!"); + log_err(-1, __func__, (char *)"unable to allocate SignalJob request-trouble!"); svr_disconnect(conn); } else @@ -725,10 +725,10 @@ int kill_job_on_mom( strcpy(preq->rq_ind.rq_signal.rq_jid, jobid); strcpy(preq->rq_ind.rq_signal.rq_signame, "SIGKILL"); - unlock_node(pnode, __func__, NULL, 0); + unlock_node(pnode, __func__, (char *)NULL, 0); rc = issue_Drequest(conn, preq); free_br(preq); - lock_node(pnode, __func__, NULL, 0); + lock_node(pnode, __func__, (char *)NULL, 0); } } @@ -752,9 +752,9 @@ int job_should_be_on_node( if ((is_job_on_node(pnode, jobid)) == FALSE) { /* must lock the job before the node */ - unlock_node(pnode, __func__, NULL, 0); + unlock_node(pnode, __func__, (char *)NULL, 0); pjob = svr_find_job(jobid, TRUE); - lock_node(pnode, __func__, NULL, 0); + lock_node(pnode, __func__, (char *)NULL, 0); if (pjob != NULL) { @@ -764,18 +764,18 @@ int job_should_be_on_node( * of data staging, suspend, or rerun */ if (pjob->ji_wattr[JOB_ATR_exec_host].at_val.at_str == NULL) { - unlock_ji_mutex(pjob, __func__, "1", LOGLEVEL); + unlock_ji_mutex(pjob, __func__, (char *)"1", LOGLEVEL); should_be_on_node = FALSE; } else if (node_in_exechostlist(pnode->nd_name, pjob->ji_wattr[JOB_ATR_exec_host].at_val.at_str) == FALSE) { - unlock_ji_mutex(pjob, __func__, "2", LOGLEVEL); + unlock_ji_mutex(pjob, __func__, (char *)"2", LOGLEVEL); should_be_on_node = FALSE; } else - unlock_ji_mutex(pjob, __func__, "3", LOGLEVEL); + unlock_ji_mutex(pjob, __func__, (char *)"3", LOGLEVEL); } else should_be_on_node = FALSE; @@ -835,9 +835,9 @@ int remove_jobs_that_have_disappeared( job *pjob; /* locking priority is job before node */ - unlock_node(pnode, __func__, NULL, 0); + unlock_node(pnode, __func__, (char *)NULL, 0); pjob = svr_find_job(jobid, TRUE); - lock_node(pnode, __func__, NULL, 0); + lock_node(pnode, __func__, (char *)NULL, 0); if (pjob == NULL) { @@ -855,11 +855,11 @@ int remove_jobs_that_have_disappeared( { free(jobid); - unlock_ji_mutex(pjob, __func__, "1", LOGLEVEL); + unlock_ji_mutex(pjob, __func__, (char *)"1", LOGLEVEL); continue; } - unlock_ji_mutex(pjob, __func__, "2", LOGLEVEL); + unlock_ji_mutex(pjob, __func__, (char *)"2", LOGLEVEL); /* mom didn't report this job - it has exited unexpectedly */ snprintf(log_buf, sizeof(log_buf), "Server thinks job %s is on node %s, but the mom doesn't. Terminating job", @@ -936,7 +936,7 @@ void *sync_node_jobs( /* FORMAT [ ]... */ joblist = jobstring_in; - jobidstr = threadsafe_tokenizer(&joblist, " "); + jobidstr = threadsafe_tokenizer(&joblist, (char *)" "); /*ms_jobs = initialize_resizable_array(MAX(np->nd_ms_jobs->num, 2));*/ @@ -968,7 +968,7 @@ void *sync_node_jobs( /*free_resizable_array(ms_jobs);*/ - unlock_node(np, __func__, NULL, 0); + unlock_node(np, __func__, (char *)NULL, 0); return(NULL); } /* END sync_node_jobs() */ @@ -999,11 +999,11 @@ void setup_notification( /* call it offline until after all nodes get the new ipaddr */ pnode->nd_state |= INUSE_OFFLINE; - nnew = calloc(1, sizeof(new_node)); + nnew = (new_node *)calloc(1, sizeof(new_node)); if (nnew == NULL) { - unlock_node(pnode, __func__, "nnew == NULL", LOGLEVEL); + unlock_node(pnode, __func__, (char *)"nnew == NULL", LOGLEVEL); return; } @@ -1013,13 +1013,13 @@ void setup_notification( append_link(&svr_newnodes, &nnew->nn_link, nnew); - unlock_node(pnode, __func__, "nnew != NULL", LOGLEVEL); + unlock_node(pnode, __func__, (char *)"nnew != NULL", LOGLEVEL); } } if (addrnote_mutex == NULL) { - addrnote_mutex = calloc(1, sizeof(pthread_mutex_t)); + addrnote_mutex = (pthread_mutex_t *)calloc(1, sizeof(pthread_mutex_t)); pthread_mutex_init(addrnote_mutex,NULL); } @@ -1066,7 +1066,7 @@ void clear_nvidia_gpus( if (decode_arst(&temp, NULL, NULL, NULL, 0)) { - log_err(-1, __func__, "clear_nvidia_gpus: cannot initialize attribute\n"); + log_err(-1, __func__, (char *)"clear_nvidia_gpus: cannot initialize attribute\n"); return; } @@ -1120,11 +1120,11 @@ void stream_eof( } /* Before we mark this node down see if we can connect */ - lock_node(np, __func__, "parent", LOGLEVEL); + lock_node(np, __func__, (char *)"parent", LOGLEVEL); conn = svr_connect(addr, port, &my_err, np, NULL, cntype); if(conn >= 0) { - unlock_node(np, __func__, "parent", LOGLEVEL); + unlock_node(np, __func__, (char *)"parent", LOGLEVEL); svr_disconnect(conn); return; } @@ -1148,15 +1148,15 @@ void stream_eof( { pnode = AVL_find(i,np->nd_mom_port,np->node_boards); - lock_node(pnode, __func__, "subs", LOGLEVEL); + lock_node(pnode, __func__, (char *)"subs", LOGLEVEL); update_node_state(pnode,INUSE_DOWN); - unlock_node(pnode, __func__, "subs", LOGLEVEL); + unlock_node(pnode, __func__, (char *)"subs", LOGLEVEL); } } else update_node_state(np, INUSE_DOWN); - unlock_node(np, __func__, "parent", LOGLEVEL); + unlock_node(np, __func__, (char *)"parent", LOGLEVEL); return; } /* END stream_eof() */ @@ -1216,7 +1216,7 @@ void *check_nodes_work( if (ptask->wt_parm1 == NULL) { - set_task(WORK_Timed,time_now + chk_len,check_nodes,NULL,FALSE); + set_task(WORK_Timed,time_now + chk_len,check_nodes, (char *)NULL,FALSE); } /* since this is done via threading, we now free the task here */ @@ -1244,7 +1244,7 @@ void check_nodes( if (rc) { - log_err(rc, __func__, "Unable to enqueue check nodes task into the threadpool"); + log_err(rc, __func__, (char *)"Unable to enqueue check nodes task into the threadpool"); } } /* END check_nodes() */ @@ -1283,7 +1283,7 @@ void *write_node_state_work( if (ftruncate(fileno(nstatef), (off_t)0) != 0) { - log_err(errno, __func__, "could not truncate file"); + log_err(errno, __func__, (char *)"could not truncate file"); pthread_mutex_unlock(node_state_mutex); @@ -1296,7 +1296,7 @@ void *write_node_state_work( if ((nstatef = fopen(path_nodestate, "w+")) == NULL) { - log_err(errno, __func__, "could not open file"); + log_err(errno, __func__, (char *)"could not open file"); pthread_mutex_unlock(node_state_mutex); @@ -1316,12 +1316,12 @@ void *write_node_state_work( fprintf(nstatef, fmt, np->nd_name, np->nd_state & savemask); } - unlock_node(np, __func__, NULL, LOGLEVEL); + unlock_node(np, __func__, (char *)NULL, LOGLEVEL); } /* END for each node */ if (fflush(nstatef) != 0) { - log_err(errno, __func__, "failed saving node state to disk"); + log_err(errno, __func__, (char *)"failed saving node state to disk"); } fclose(nstatef); @@ -1343,7 +1343,7 @@ void write_node_state(void) if (rc) { - log_err(rc, __func__, "Unable to enqueue write_node_state_work task into the threadpool"); + log_err(rc, __func__, (char *)"Unable to enqueue write_node_state_work task into the threadpool"); } } /* END write_node_state() */ @@ -1372,7 +1372,7 @@ int write_node_note(void) if ((svr_totnodes == 0)) { log_event( - PBSEVENT_ADMIN, PBS_EVENTCLASS_SERVER, __func__, "Server has empty nodes list"); + PBSEVENT_ADMIN, PBS_EVENTCLASS_SERVER, __func__, (char *)"Server has empty nodes list"); fclose(nin); @@ -1389,7 +1389,7 @@ int write_node_note(void) fprintf(nin, "%s %s\n", np->nd_name, np->nd_note); } - unlock_node(np, __func__, NULL, LOGLEVEL); + unlock_node(np, __func__, (char *)NULL, LOGLEVEL); } fflush(nin); @@ -1405,7 +1405,7 @@ int write_node_note(void) if (rename(path_nodenote_new, path_nodenote) != 0) { log_event(PBSEVENT_ADMIN, PBS_EVENTCLASS_SERVER, __func__, - "replacing old node note file failed"); + (char *)"replacing old node note file failed"); return(-1); } @@ -1414,7 +1414,7 @@ int write_node_note(void) err1: log_event(PBSEVENT_ADMIN, PBS_EVENTCLASS_SERVER, __func__, - "Node note file update failed"); + (char *)"Node note file update failed"); return(-1); } /* END write_node_note() */ @@ -1501,7 +1501,7 @@ void node_unreserve( if (rc) { - log_err(rc, __func__, "Unable to enqueue node_unreserve task into the threadpool"); + log_err(rc, __func__, (char *)"Unable to enqueue node_unreserve task into the threadpool"); } } /* END node_unreserve() */ @@ -2071,7 +2071,7 @@ static char *mod_spec( len = strlen(global); - line = calloc(1, nsubspec * (len + 1) + strlen(spec) + 1); + line = (char *)calloc(1, nsubspec * (len + 1) + strlen(spec) + 1); if (line == NULL) { @@ -2372,9 +2372,9 @@ int save_node_for_adding( else { /* second */ - if ((to_add = calloc(1, sizeof(node_job_add_info))) == NULL) + if ((to_add = (node_job_add_info *)calloc(1, sizeof(node_job_add_info))) == NULL) { - log_err(ENOMEM, __func__, "Cannot allocate memory!"); + log_err(ENOMEM, __func__, (char *)"Cannot allocate memory!"); return(ENOMEM); } @@ -2497,7 +2497,7 @@ int is_compute_node( if ((pnode = find_nodebyname(node_id)) != NULL) { rc = TRUE; - unlock_node(pnode, __func__, NULL, 0); + unlock_node(pnode, __func__, (char *)NULL, 0); } if (colon != NULL) @@ -2528,7 +2528,7 @@ void release_node_allocation( pnode->nd_np_to_be_used -= current->ppn_needed; pnode->nd_ngpus_to_be_used -= current->gpu_needed; pnode->nd_nmics_to_be_used -= current->mic_needed; - unlock_node(pnode, __func__, NULL, LOGLEVEL); + unlock_node(pnode, __func__, (char *)NULL, LOGLEVEL); } current = current->next; } @@ -2553,7 +2553,7 @@ int check_for_node_type( if (reporter == NULL) { /* this shouldn't be possible */ - log_err(-1, __func__, "Checking for node types with a non-cray enabled pbs_server??"); + log_err(-1, __func__, (char *)"Checking for node types with a non-cray enabled pbs_server??"); return(-1); } @@ -2568,13 +2568,13 @@ int check_for_node_type( (!strcmp(p->name, alps_starter_feature))) continue; - lock_node(reporter, __func__, NULL, 0); + lock_node(reporter, __func__, (char *)NULL, 0); pnode = find_node_in_allnodes(&(reporter->alps_subnodes), p->name); - unlock_node(reporter, __func__, NULL, 0); + unlock_node(reporter, __func__, (char *)NULL, 0); if (pnode != NULL) { - unlock_node(pnode, __func__, NULL, 0); + unlock_node(pnode, __func__, (char *)NULL, 0); if (nt == ND_TYPE_CRAY) { @@ -2594,7 +2594,7 @@ int check_for_node_type( if (pnode->nd_is_alps_login == TRUE) login = TRUE; - unlock_node(pnode, __func__, NULL, 0); + unlock_node(pnode, __func__, (char *)NULL, 0); if (nt == ND_TYPE_EXTERNAL) { @@ -2671,7 +2671,7 @@ int add_login_node_if_needed( if (login->nd_is_alps_login == FALSE) need_to_add_login = TRUE; - unlock_node(login, __func__, NULL, 0); + unlock_node(login, __func__, (char *)NULL, 0); } if (need_to_add_login == TRUE) @@ -2698,7 +2698,7 @@ int add_login_node_if_needed( rc = PBSE_NONE; - unlock_node(login, __func__, NULL, 0); + unlock_node(login, __func__, (char *)NULL, 0); } if (prop != NULL) @@ -2853,8 +2853,8 @@ int node_spec( } /* allocate space in all_reqs */ - all_reqs.reqs = calloc(all_reqs.num_reqs, sizeof(single_spec_data)); - all_reqs.req_start = calloc(all_reqs.num_reqs, sizeof(char *)); + all_reqs.reqs = (single_spec_data *)calloc(all_reqs.num_reqs, sizeof(single_spec_data)); + all_reqs.req_start = (char **)calloc(all_reqs.num_reqs, sizeof(char *)); if ((all_reqs.reqs == NULL) || (all_reqs.req_start == NULL)) @@ -2864,7 +2864,7 @@ int node_spec( else if (all_reqs.req_start != NULL) free(all_reqs.req_start); - log_err(ENOMEM, __func__, "Cannot allocate memory!"); + log_err(ENOMEM, __func__, (char *)"Cannot allocate memory!"); free(spec); return(-1); } @@ -2982,7 +2982,7 @@ int node_spec( (ard_array != NULL) && (job_type == JOB_TYPE_cray)) { - *ard_array = calloc(num_alps_reqs + 1, sizeof(alps_req_data)); + *ard_array = (alps_req_data *)calloc(num_alps_reqs + 1, sizeof(alps_req_data)); for (i = 0; i <= num_alps_reqs; i++) (*ard_array)[i].node_list = get_dynamic_string(-1, NULL); @@ -3490,10 +3490,10 @@ int add_gpu_to_hostlist( struct howl *prev; struct howl *hp; char *gpu_name; - static char *gpu = "gpu"; + static char *gpu = (char *)"gpu"; /* create gpu_name */ - gpu_name = calloc(1, strlen(pnode->nd_name) + strlen(gpu) + 2); + gpu_name = (char *)calloc(1, strlen(pnode->nd_name) + strlen(gpu) + 2); sprintf(gpu_name, "%s-%s", pnode->nd_name, gpu); @@ -3658,10 +3658,10 @@ int add_mic_to_list( struct howl *prev; struct howl *hp; char *name; - static char *mic = "mic"; + static char *mic = (char *)"mic"; /* create gpu_name */ - name = calloc(1, strlen(pnode->nd_name) + strlen(mic) + 2); + name = (char *)calloc(1, strlen(pnode->nd_name) + strlen(mic) + 2); sprintf(name, "%s-%s", pnode->nd_name, mic); @@ -3780,9 +3780,9 @@ int translate_howl_to_string( count++; } - if ((str = calloc(1, len + 1)) == NULL) + if ((str = (char *)calloc(1, len + 1)) == NULL) { - log_err(ENOMEM, __func__, "Cannot allocate memory!"); + log_err(ENOMEM, __func__, (char *)"Cannot allocate memory!"); if (EMsg != NULL) sprintf(EMsg,"no nodes can be allocated to job"); @@ -3795,9 +3795,9 @@ int translate_howl_to_string( if (port == TRUE) { /* port list will have a string of sister port addresses */ - if ((portlist = calloc(1, (count * PBS_MAXPORTNUM) + count)) == NULL) + if ((portlist = (char *)calloc(1, (count * PBS_MAXPORTNUM) + count)) == NULL) { - log_err(ENOMEM, __func__, "Cannot allocate memory!"); + log_err(ENOMEM, __func__, (char *)"Cannot allocate memory!"); if (EMsg != NULL) sprintf(EMsg,"no nodes can be allocated to job"); @@ -3893,7 +3893,7 @@ int record_external_node( else { len = strlen(pjob->ji_wattr[JOB_ATR_external_nodes].at_val.at_str) + strlen(pnode->nd_name) + 2; - external_nodes = calloc(1, len); + external_nodes = (char *)calloc(1, len); snprintf(external_nodes, len, "%s+%s", pjob->ji_wattr[JOB_ATR_external_nodes].at_val.at_str, pnode->nd_name); @@ -3969,7 +3969,7 @@ int build_hostlist_nodes_req( } } - unlock_node(pnode, __func__, NULL, LOGLEVEL); + unlock_node(pnode, __func__, (char *)NULL, LOGLEVEL); } current = current->next; @@ -4075,7 +4075,7 @@ int add_to_ms_list( { insert_thing(pnode->nd_ms_jobs, strdup(pjob->ji_qs.ji_jobid)); - unlock_node(pnode, __func__, NULL, 0); + unlock_node(pnode, __func__, (char *)NULL, 0); } return(PBSE_NONE); @@ -4201,7 +4201,7 @@ int set_nodes( get_bitmap(pjob,sizeof(ProcBMStr),ProcBMStr); #endif /* GEOMETRY_REQUESTS */ - naji = calloc(1, sizeof(node_job_add_info)); + naji = (node_job_add_info *)calloc(1, sizeof(node_job_add_info)); if (pjob->ji_wattr[JOB_ATR_login_prop].at_flags & ATR_VFLAG_SET) login_prop = pjob->ji_wattr[JOB_ATR_login_prop].at_val.at_str; @@ -4228,7 +4228,7 @@ int set_nodes( else if (i < 0) { /* request failed, corrupt request */ - log_err(PBSE_UNKNODE, __func__, "request failed, corrupt request"); + log_err(PBSE_UNKNODE, __func__, (char *)"request failed, corrupt request"); free_naji(naji); free_alps_req_data_array(ard_array, num_reqs); return(PBSE_UNKNODE); @@ -4574,7 +4574,7 @@ int node_avail( if (spec == NULL) { - log_event(PBSEVENT_ADMIN, PBS_EVENTCLASS_SERVER, __func__, "no spec"); + log_event(PBSEVENT_ADMIN, PBS_EVENTCLASS_SERVER, __func__, (char *)"no spec"); return(RM_ERR_NOPARAM); } @@ -4693,12 +4693,12 @@ int node_reserve( if ((nspec == NULL) || (*nspec == '\0')) { - log_event(PBSEVENT_ADMIN, PBS_EVENTCLASS_SERVER, __func__, "no spec"); + log_event(PBSEVENT_ADMIN, PBS_EVENTCLASS_SERVER, __func__, (char *)"no spec"); return(-1); } - naji = calloc(1, sizeof(node_job_add_info)); + naji = (node_job_add_info *)calloc(1, sizeof(node_job_add_info)); if ((ret_val = node_spec(nspec, 0, 0, NULL, NULL, naji, NULL, NULL, NULL, NULL)) >= 0) { @@ -4991,7 +4991,7 @@ void free_nodes( remove_job_from_node(pnode, pjob); remove_job_from_nodes_gpus(pnode, pjob); remove_job_from_nodes_mics(pnode, pjob); - unlock_node(pnode, __func__, NULL, 0); + unlock_node(pnode, __func__, (char *)NULL, 0); } } @@ -5002,7 +5002,7 @@ void free_nodes( if ((pnode = find_nodebyname(pjob->ji_wattr[JOB_ATR_login_node_id].at_val.at_str)) != NULL) { remove_job_from_node(pnode, pjob); - unlock_node(pnode, __func__, NULL, 0); + unlock_node(pnode, __func__, (char *)NULL, 0); } } @@ -5033,9 +5033,9 @@ struct pbsnode *get_compute_node( } } - lock_node(ar, __func__, NULL, 0); + lock_node(ar, __func__, (char *)NULL, 0); compute_node = create_alps_subnode(ar, node_name); - unlock_node(ar, __func__, NULL, 0); + unlock_node(ar, __func__, (char *)NULL, 0); return(compute_node); } /* END get_compute_node() */ @@ -5125,7 +5125,7 @@ void set_one_old( } /* END for (snp) */ } - unlock_node(pnode, __func__, NULL, LOGLEVEL); + unlock_node(pnode, __func__, (char *)NULL, LOGLEVEL); } return; @@ -5194,9 +5194,9 @@ job *get_job_from_jobinfo( { job *pjob; - unlock_node(pnode, __func__, NULL, LOGLEVEL); + unlock_node(pnode, __func__, (char *)NULL, LOGLEVEL); pjob = svr_find_job(jp->jobid, TRUE); - lock_node(pnode, __func__, NULL, LOGLEVEL); + lock_node(pnode, __func__, (char *)NULL, LOGLEVEL); return(pjob); } /* END get_job_from_jobinfo() */ diff --git a/src/server/pbsd_init.c b/src/server/pbsd_init.c index 9adc153420..1a2cc5333a 100644 --- a/src/server/pbsd_init.c +++ b/src/server/pbsd_init.c @@ -397,7 +397,7 @@ void update_default_np() npfreediff = pnode->nd_nsn - pnode->nd_nsnfree; pnode->nd_nsn = default_np; pnode->nd_nsnfree = default_np - npfreediff; - unlock_node(pnode, __func__, NULL, LOGLEVEL); + unlock_node(pnode, __func__, (char *)NULL, LOGLEVEL); } } @@ -467,7 +467,7 @@ dynamic_string *make_default_hierarchy() if (((default_hierarchy = get_dynamic_string(-1, NULL)) == NULL) || ((level_ds = get_dynamic_string(-1, NULL)) == NULL)) { - log_err(ENOMEM, __func__, "Cannot allocate memory"); + log_err(ENOMEM, __func__, (char *)"Cannot allocate memory"); return(NULL); } @@ -489,7 +489,7 @@ dynamic_string *make_default_hierarchy() pnode->nd_hierarchy_level = 0; - unlock_node(pnode, __func__, NULL, LOGLEVEL); + unlock_node(pnode, __func__, (char *)NULL, LOGLEVEL); } copy_to_end_of_dynamic_string(default_hierarchy, level_ds->str); @@ -590,7 +590,7 @@ void check_if_in_nodes_file( if (pnode->nd_hierarchy_level > level_index) pnode->nd_hierarchy_level = level_index; - unlock_node(pnode, __func__, NULL, LOGLEVEL); + unlock_node(pnode, __func__, (char *)NULL, LOGLEVEL); if (colon != NULL) *colon = ':'; @@ -614,7 +614,7 @@ int handle_level( if ((level_buf = get_dynamic_string(-1, NULL)) == NULL) { - log_err(ENOMEM, __func__, "Cannot allocate memory"); + log_err(ENOMEM, __func__, (char *)"Cannot allocate memory"); return(ENOMEM); } @@ -737,7 +737,7 @@ dynamic_string *parse_mom_hierarchy( if ((send_format = get_dynamic_string(-1, NULL)) == NULL) { - log_err(ENOMEM, __func__, "Cannot allocate memory"); + log_err(ENOMEM, __func__, (char *)"Cannot allocate memory"); return(NULL); } @@ -996,7 +996,7 @@ int setup_signal_handling() if (sigaction(SIGHUP, &act, &oact) != 0) { - log_err(errno, __func__, "sigaction for HUP"); + log_err(errno, __func__, (char *)"sigaction for HUP"); return(2); } @@ -1005,14 +1005,14 @@ int setup_signal_handling() if (sigaction(SIGINT, &act, &oact) != 0) { - log_err(errno, __func__, "sigaction for INT"); + log_err(errno, __func__, (char *)"sigaction for INT"); return(2); } if (sigaction(SIGTERM, &act, &oact) != 0) { - log_err(errno, __func__, "sigactin for TERM"); + log_err(errno, __func__, (char *)"sigactin for TERM"); return(2); } @@ -1021,7 +1021,7 @@ int setup_signal_handling() if (sigaction(SIGQUIT, &act, &oact) != 0) { - log_err(errno, __func__, "sigactin for QUIT"); + log_err(errno, __func__, (char *)"sigactin for QUIT"); return(2); } @@ -1032,7 +1032,7 @@ int setup_signal_handling() if (sigaction(SIGSHUTDN, &act, &oact) != 0) { - log_err(errno, __func__, "sigactin for SHUTDN"); + log_err(errno, __func__, (char *)"sigactin for SHUTDN"); return(2); } @@ -1066,7 +1066,7 @@ int setup_signal_handling() if (sigaction(SIGCHLD, &act, &oact) != 0) { - log_err(errno, __func__, "sigaction for CHLD"); + log_err(errno, __func__, (char *)"sigaction for CHLD"); return(2); } @@ -1075,7 +1075,7 @@ int setup_signal_handling() if (sigaction(SIGPIPE, &act, &oact) != 0) { - log_err(errno, __func__, "sigaction for PIPE"); + log_err(errno, __func__, (char *)"sigaction for PIPE"); return(2); } @@ -1084,14 +1084,14 @@ int setup_signal_handling() if (sigaction(SIGUSR1, &act, &oact) != 0) { - log_err(errno, __func__, "sigaction for USR1"); + log_err(errno, __func__, (char *)"sigaction for USR1"); return(2); } if (sigaction(SIGUSR2, &act, &oact) != 0) { - log_err(errno, __func__, "sigaction for USR2"); + log_err(errno, __func__, (char *)"sigaction for USR2"); return(2); } @@ -1309,7 +1309,7 @@ int setup_server_attrs( &server.sv_attr[SRV_ATR_mailfrom], 0, 0, - PBS_DEFAULT_MAIL, + (char *)PBS_DEFAULT_MAIL, 0); server.sv_attr[SRV_ATR_tcp_timeout].at_val.at_long = PBS_TCPTIMEOUT; @@ -1372,7 +1372,7 @@ int setup_server_attrs( &server.sv_attr[SRV_ATR_version], 0, 0, - PACKAGE_VERSION, + (char *)PACKAGE_VERSION, 0); /* open accounting file and job log file if logging is set */ @@ -1492,7 +1492,7 @@ int handle_queue_recovery( que_attr_def[QE_ATR_ResourceAssn].at_free(&pque->qu_attr[QE_ATR_ResourceAssn]); } - unlock_queue(pque, __func__, NULL, LOGLEVEL); + unlock_queue(pque, __func__, (char *)NULL, LOGLEVEL); } } } @@ -1578,7 +1578,7 @@ int handle_array_recovery( pa->jobs_recovered = 0; - unlock_ai_mutex(pa, __func__, "2", LOGLEVEL); + unlock_ai_mutex(pa, __func__, (char *)"2", LOGLEVEL); } else { @@ -1683,14 +1683,14 @@ int handle_job_recovery( if (DArrayAppend(&Array,pjob) == FAILURE) { - log_err(ENOMEM,"main","out of memory reloading jobs"); + log_err(ENOMEM,"main", (char *)"out of memory reloading jobs"); exit(-1); } if (type == RECOV_COLD) pjob->ji_cold_restart = TRUE; - unlock_ji_mutex(pjob, __func__, "1", LOGLEVEL); + unlock_ji_mutex(pjob, __func__, (char *)"1", LOGLEVEL); } continue; @@ -1704,14 +1704,14 @@ int handle_job_recovery( if (DArrayAppend(&Array,pjob) == FAILURE) { - log_err(ENOMEM, "main", "out of memory reloading jobs"); + log_err(ENOMEM, "main", (char *)"out of memory reloading jobs"); exit(-1); } if (type == RECOV_COLD) pjob->ji_cold_restart = TRUE; - unlock_ji_mutex(pjob, __func__, "2", LOGLEVEL); + unlock_ji_mutex(pjob, __func__, (char *)"2", LOGLEVEL); } else { @@ -1724,7 +1724,7 @@ int handle_job_recovery( if (link(pdirent->d_name, basen) < 0) { - log_err(errno, __func__, "failed to link corrupt .JB file to .BD"); + log_err(errno, __func__, (char *)"failed to link corrupt .JB file to .BD"); } else { @@ -1743,7 +1743,7 @@ int handle_job_recovery( { job *pjob = (job *)Array.Data[Index]; - lock_ji_mutex(pjob, __func__, NULL, LOGLEVEL); + lock_ji_mutex(pjob, __func__, (char *)NULL, LOGLEVEL); job_rc = pbsd_init_job(pjob, type); @@ -1755,7 +1755,7 @@ int handle_job_recovery( pjob->ji_qs.ji_jobid, msg_script_open); - unlock_ji_mutex(pjob, __func__, "4", LOGLEVEL); + unlock_ji_mutex(pjob, __func__, (char *)"4", LOGLEVEL); continue; } @@ -1779,11 +1779,11 @@ int handle_job_recovery( } else { - unlock_ji_mutex(pjob, __func__, "5", LOGLEVEL); + unlock_ji_mutex(pjob, __func__, (char *)"5", LOGLEVEL); } } else - unlock_ji_mutex(pjob, __func__, "6", LOGLEVEL); + unlock_ji_mutex(pjob, __func__, (char *)"6", LOGLEVEL); } DArrayFree(&Array); @@ -1820,7 +1820,7 @@ int handle_job_recovery( job_save(pjob, SAVEJOB_FULL, 0); - unlock_ji_mutex(pjob, __func__, "7", LOGLEVEL); + unlock_ji_mutex(pjob, __func__, (char *)"7", LOGLEVEL); } } @@ -1846,7 +1846,7 @@ int cleanup_recovered_arrays() if ((pjob = svr_find_job(pa->ai_qs.parent_id, FALSE)) != NULL) { job_template_exists = TRUE; - unlock_ji_mutex(pjob, __func__, "1", LOGLEVEL); + unlock_ji_mutex(pjob, __func__, (char *)"1", LOGLEVEL); } /* if no jobs were recovered, delete this array */ @@ -1887,7 +1887,7 @@ int cleanup_recovered_arrays() { if ((pjob = svr_find_job(pa->job_ids[i], FALSE)) != NULL) { - unlock_ai_mutex(pa, __func__, "1", LOGLEVEL); + unlock_ai_mutex(pa, __func__, (char *)"1", LOGLEVEL); svr_job_purge(pjob); pa = get_array(arrayid); @@ -1914,7 +1914,7 @@ int cleanup_recovered_arrays() continue; } - unlock_ai_mutex(pa, __func__, "1", LOGLEVEL); + unlock_ai_mutex(pa, __func__, (char *)"1", LOGLEVEL); } /* END for each array */ return(rc); @@ -1956,7 +1956,7 @@ int handle_tracking_records() if ((fd = open(path_track, O_RDONLY | O_CREAT, 0600)) < 0) { - log_err(errno, __func__, "unable to open tracking file"); + log_err(errno, __func__, (char *)"unable to open tracking file"); return(-1); } @@ -1972,7 +1972,7 @@ int handle_tracking_records() if (fstat(fd, &statbuf) < 0) { - log_err(errno, "pbs_init", "unable to stat tracking file"); + log_err(errno, "pbs_init", (char *)"unable to stat tracking file"); close(fd); return(-1); @@ -1986,7 +1986,7 @@ int handle_tracking_records() if ((server.sv_track = calloc(server.sv_tracksize, sizeof(struct tracking))) == NULL) { /* FAILURE - cannot alloc memory */ - log_err(errno, "pbs_init", "calloc failure"); + log_err(errno, "pbs_init", (char *)"calloc failure"); close(fd); return(-1); @@ -2004,9 +2004,9 @@ int handle_tracking_records() close(fd); server.sv_trackmodifed = 0; - + /* set work task to periodically save the tracking records */ - set_task(WORK_Timed, (long)(time(NULL) + PBS_SAVE_TRACK_TM), track_save, NULL, FALSE); + set_task(WORK_Timed, (long)(time(NULL) + PBS_SAVE_TRACK_TM), track_save, (char *)NULL, FALSE); return(rc); } /* END handle_tracking_records() */ @@ -2406,11 +2406,11 @@ int pbsd_init_job( strcpy(job_id, pjob->ji_qs.ji_jobid); job_atr_hold = pjob->ji_wattr[JOB_ATR_hold].at_val.at_long; job_exit_status = pjob->ji_qs.ji_un.ji_exect.ji_exitstat; - unlock_ji_mutex(pjob, __func__, "1", LOGLEVEL); + unlock_ji_mutex(pjob, __func__, (char *)"1", LOGLEVEL); update_array_values(pa,JOB_STATE_RUNNING,aeTerminate, job_id, job_atr_hold, job_exit_status); - unlock_ai_mutex(pa, __func__, "1", LOGLEVEL); + unlock_ai_mutex(pa, __func__, (char *)"1", LOGLEVEL); pjob = svr_find_job(job_id, FALSE); } @@ -2601,7 +2601,7 @@ void catch_abort( sigaction(SIGTRAP, &act, NULL); sigaction(SIGSYS, &act, NULL); - log_err(sig, "mom_main", "Caught fatal core signal"); + log_err(sig, "mom_main", (char *)"Caught fatal core signal"); rlimit.rlim_cur = RLIM_INFINITY; rlimit.rlim_max = RLIM_INFINITY; @@ -2787,7 +2787,7 @@ void resume_net_move( net_move(pjob, 0); - unlock_ji_mutex(pjob, __func__, "1", LOGLEVEL); + unlock_ji_mutex(pjob, __func__, (char *)"1", LOGLEVEL); free(jobid); } @@ -2911,11 +2911,11 @@ int recov_svr_attr( if (path_priv == NULL) { - path_priv = build_path(path_home, PBS_SVR_PRIVATE, suffix_slash); + path_priv = build_path((char *)path_home, (char *)PBS_SVR_PRIVATE, (char *)suffix_slash); } if (path_svrdb == NULL) { - path_svrdb = build_path(path_priv, PBS_SERVERDB, NULL); + path_svrdb = build_path(path_priv, (char *)PBS_SERVERDB, NULL); } if (svr_resc_def == NULL) diff --git a/src/server/pbsd_main.c b/src/server/pbsd_main.c index ada6eac82f..2d5b0b1073 100644 --- a/src/server/pbsd_main.c +++ b/src/server/pbsd_main.c @@ -417,7 +417,7 @@ int process_pbs_server_port( if (rc != DIS_SUCCESS) { - log_err(-1, __func__, "Cannot read version - skipping this request.\n"); + log_err(-1, __func__, (char *)"Cannot read version - skipping this request.\n"); rc = PBSE_SOCKET_CLOSE; break; } @@ -806,7 +806,7 @@ void parse_command_line( } else { - log_err(-1, __func__, "unable to determine full server hostname"); + log_err(-1, __func__, (char *)"unable to determine full server hostname"); } exit(1); @@ -1116,14 +1116,14 @@ static int start_hot_jobs(void) PBSEVENT_SYSTEM, PBS_EVENTCLASS_JOB, pjob->ji_qs.ji_jobid, - "attempting to hot start job"); + (char *)"attempting to hot start job"); svr_startjob(pjob, NULL, NULL, NULL); ct++; } - unlock_ji_mutex(pjob, __func__, "1", LOGLEVEL); + unlock_ji_mutex(pjob, __func__, (char *)"1", LOGLEVEL); } return(ct); @@ -1170,7 +1170,7 @@ void *handle_queue_routing_retries( enqueue_threadpool_request(queue_route, queuename); } - unlock_queue(pque, __func__, NULL, 0); + unlock_queue(pque, __func__, (char *)NULL, 0); } } @@ -1218,17 +1218,17 @@ void start_accept_thread() if ((pthread_attr_init(&accept_attr)) != 0) { perror("pthread_attr_init failed. Could not start accept thread"); - log_err(-1, msg_daemonname,"pthread_attr_init failed. Could not start accept thread"); + log_err(-1, msg_daemonname,(char *)"pthread_attr_init failed. Could not start accept thread"); } else if ((pthread_attr_setdetachstate(&accept_attr, PTHREAD_CREATE_DETACHED) != 0)) { perror("pthread_attr_setdetatchedstate failed. Could not start accept thread"); - log_err(-1, msg_daemonname,"pthread_attr_setdetachedstate failed. Could not start accept thread"); + log_err(-1, msg_daemonname,(char *)"pthread_attr_setdetachedstate failed. Could not start accept thread"); } else if ((pthread_create(&accept_thread_id, &accept_attr, start_accept_listener, NULL)) != 0) { perror("could not start listener for pbs_server"); - log_err(-1, msg_daemonname, "Failed to start listener for pbs_server"); + log_err(-1, msg_daemonname, (char *)"Failed to start listener for pbs_server"); } } /* END start_accept_thread() */ @@ -1241,17 +1241,17 @@ void start_routing_retry_thread() if ((pthread_attr_init(&routing_attr)) != 0) { perror("pthread_attr_init failed. Could not start accept thread"); - log_err(-1, msg_daemonname,"pthread_attr_init failed. Could not start handle_queue_routing_retries"); + log_err(-1, msg_daemonname,(char *)"pthread_attr_init failed. Could not start handle_queue_routing_retries"); } else if ((pthread_attr_setdetachstate(&routing_attr, PTHREAD_CREATE_DETACHED) != 0)) { perror("pthread_attr_setdetatchedstate failed. Could not start accept thread"); - log_err(-1, msg_daemonname,"pthread_attr_setdetachedstate failed. Could not start handle_queue_routing_retries"); + log_err(-1, msg_daemonname,(char *)"pthread_attr_setdetachedstate failed. Could not start handle_queue_routing_retries"); } else if ((pthread_create(&route_retry_thread_id, &routing_attr, handle_queue_routing_retries, NULL)) != 0) { perror("could not start listener for pbs_server"); - log_err(-1, msg_daemonname, "Failed to start handle_queue_routing_retries"); + log_err(-1, msg_daemonname, (char *)"Failed to start handle_queue_routing_retries"); } } /* END start_routing_retry_thread() */ @@ -1267,17 +1267,17 @@ void start_exiting_retry_thread() if (pthread_attr_init(&attr) != 0) { perror("pthread_attr_init failed. Could not start exiting retry thread"); - log_err(-1, msg_daemonname,"pthread_attr_init failed. Could not start inspect_exiting_jobs"); + log_err(-1, msg_daemonname,(char *)"pthread_attr_init failed. Could not start inspect_exiting_jobs"); } else if (pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED) != 0) { perror("pthread_attr_setdetatchedstate failed. Could not start exiting retry thread"); - log_err(-1, msg_daemonname,"pthread_attr_setdetachedstate failed. Could not start inspect_exiting_jobs"); + log_err(-1, msg_daemonname,(char *)"pthread_attr_setdetachedstate failed. Could not start inspect_exiting_jobs"); } else if (pthread_create(&exiting_thread, &attr, inspect_exiting_jobs, NULL) != 0) { perror("could not start exiting job retry thread for pbs_server"); - log_err(-1, msg_daemonname, "Failed to start inspect_exiting_jobs"); + log_err(-1, msg_daemonname, (char *)"Failed to start inspect_exiting_jobs"); } } /* END start_exiting_retry_thread() */ @@ -1352,18 +1352,18 @@ void main_loop(void) /* for large systems, give newly reported nodes more time before being marked down while pbs_moms are initialy reporting in */ - set_task(WORK_Timed, when + svr_totnodes / 12, check_nodes, NULL, FALSE); + set_task(WORK_Timed, when + svr_totnodes / 12, check_nodes, (char *)NULL, FALSE); } else { - set_task(WORK_Timed, when, check_nodes, NULL, FALSE); + set_task(WORK_Timed, when, check_nodes, (char *)NULL, FALSE); } /* Just check the nodes with check_nodes above and don't ping anymore. */ - set_task(WORK_Timed, time_now + 5, check_log, NULL, FALSE); + set_task(WORK_Timed, time_now + 5, check_log, (char *)NULL, FALSE); - set_task(WORK_Timed,time_now + 10,check_acct_log, NULL, FALSE); + set_task(WORK_Timed,time_now + 10,check_acct_log, (char *)NULL, FALSE); /* * Now at last, we are ready to do some batch work. The @@ -1537,7 +1537,7 @@ void main_loop(void) if (pjob->ji_modified) job_save(pjob, SAVEJOB_FULL, 0); - unlock_ji_mutex(pjob, __func__, "1", LOGLEVEL); + unlock_ji_mutex(pjob, __func__, (char *)"1", LOGLEVEL); } if (svr_chngNodesfile) @@ -1878,7 +1878,7 @@ int main( if (write(lockfds, log_buf, strlen(log_buf)) != (ssize_t)strlen(log_buf)) { - log_err(errno, msg_daemonname, "failed to write pid to lockfile"); + log_err(errno, msg_daemonname, (char *)"failed to write pid to lockfile"); exit(-1); } @@ -1915,7 +1915,7 @@ int main( /* NOTE: env cleared in pbsd_init() */ if (pbsd_init(server_init_type) != PBSE_NONE) { - log_err(-1, msg_daemonname, "pbsd_init failed"); + log_err(-1, msg_daemonname, (char *)"pbsd_init failed"); exit(3); } @@ -1939,7 +1939,7 @@ int main( { perror("pbs_server: unix domain socket"); - log_err(-1, msg_daemonname, "init_network failed unix domain socket"); + log_err(-1, msg_daemonname, (char *)"init_network failed unix domain socket"); exit(3); } @@ -1951,7 +1951,7 @@ int main( if (poll_job_task_mutex == NULL) { perror("pbs_server: failed to initialize poll_job_task_mutex"); - log_err(-1, msg_daemonname, "pbs_server: failed to initialize poll_job_task_mutex"); + log_err(-1, msg_daemonname, (char *)"pbs_server: failed to initialize poll_job_task_mutex"); exit(3); } @@ -2029,7 +2029,7 @@ void check_job_log( if (log_remove_old(path_jobinfo_log, keep_days * SECS_PER_DAY) != 0) { - log_err(-1,"check_job_log","failure occurred when checking for old job logs"); + log_err(-1,"check_job_log",(char *)"failure occurred when checking for old job logs"); } } @@ -2044,7 +2044,7 @@ void check_job_log( PBSEVENT_SYSTEM | PBSEVENT_FORCE, PBS_EVENTCLASS_SERVER, msg_daemonname, - "Rolling job log file"); + (char *)"Rolling job log file"); if (roll_depth != -1) { @@ -2053,7 +2053,7 @@ void check_job_log( if ((depth >= INT_MAX) || (depth < 1)) { - log_err(-1, "check_job_log", "job log roll cancelled, logfile depth is out of range"); + log_err(-1, "check_job_log", (char *)"job log roll cancelled, logfile depth is out of range"); } else { @@ -2065,7 +2065,7 @@ void check_job_log( free(ptask->wt_mutex); free(ptask); - set_task(WORK_Timed, time_now + PBS_LOG_CHECK_RATE, check_job_log, NULL, FALSE); + set_task(WORK_Timed, time_now + PBS_LOG_CHECK_RATE, check_job_log, (char *)NULL, FALSE); } /* END check_job_log */ @@ -2097,7 +2097,7 @@ void check_log( if (log_remove_old(path_svrlog, keep_days * SECS_PER_DAY) != 0) { - log_err(-1,"check_log","failure occurred when checking for old pbs_server logs"); + log_err(-1,"check_log",(char *)"failure occurred when checking for old pbs_server logs"); } } @@ -2112,13 +2112,13 @@ void check_log( PBSEVENT_SYSTEM | PBSEVENT_FORCE, PBS_EVENTCLASS_SERVER, msg_daemonname, - "Rolling log file"); + (char *)"Rolling log file"); get_svr_attr_l(SRV_ATR_LogFileRollDepth, &roll_depth); if ((roll_depth >= INT_MAX) || (roll_depth < 1)) { - log_err(-1, "check_log", "log roll cancelled, logfile depth is out of range"); + log_err(-1, "check_log", (char *)"log roll cancelled, logfile depth is out of range"); } else { @@ -2141,7 +2141,7 @@ void check_log( free(ptask->wt_mutex); free(ptask); - set_task(WORK_Timed, time_now + PBS_LOG_CHECK_RATE, check_log, NULL, FALSE); + set_task(WORK_Timed, time_now + PBS_LOG_CHECK_RATE, check_log, (char *)NULL, FALSE); return; } /* END check_log */ @@ -2176,7 +2176,7 @@ void check_acct_log( free(ptask->wt_mutex); free(ptask); - set_task(WORK_Timed,time_now + PBS_ACCT_CHECK_RATE,check_acct_log,NULL,FALSE); + set_task(WORK_Timed,time_now + PBS_ACCT_CHECK_RATE,check_acct_log,(char *)NULL,FALSE); return; } /* END check_acct_log */ @@ -2341,7 +2341,7 @@ int is_ha_lock_file_valid( if (GoodPermissions == FALSE) { - log_err(-1, __func__, "could not obtain the needed permissions for the lock file"); + log_err(-1, __func__, (char *)"could not obtain the needed permissions for the lock file"); } return(GoodPermissions); @@ -2633,7 +2633,7 @@ int start_update_ha_lock_thread() if (fds < 0) { - log_err(-1, __func__, "Couldn't write the pid to the lockfile\n"); + log_err(-1, __func__, (char *)"Couldn't write the pid to the lockfile\n"); return(FAILURE); } @@ -2641,7 +2641,7 @@ int start_update_ha_lock_thread() snprintf(smallBuf,sizeof(smallBuf),"%ld\n",(long)sid); if (write(fds,smallBuf,strlen(smallBuf)) != (ssize_t)strlen(smallBuf)) { - log_err(-1, __func__, "Couldn't write the pid to the lockfile\n"); + log_err(-1, __func__, (char *)"Couldn't write the pid to the lockfile\n"); close(fds); return(FAILURE); @@ -2663,7 +2663,7 @@ int start_update_ha_lock_thread() { /* error creating thread */ - log_err(-1, __func__, "Could not create HA Lock Thread\n"); + log_err(-1, __func__, (char *)"Could not create HA Lock Thread\n"); return(FAILURE); } @@ -2687,7 +2687,7 @@ int mutex_lock( { if (pthread_mutex_lock(Mutex) != 0) { - log_err(-1,"mutex_lock","ALERT: cannot lock mutex!\n"); + log_err(-1,"mutex_lock",(char *)"ALERT: cannot lock mutex!\n"); return(FAILURE); } @@ -2705,7 +2705,7 @@ int mutex_unlock( { if (pthread_mutex_unlock(Mutex) != 0) { - log_err(-1,"mutex_unlock","ALERT: cannot unlock mutex!\n"); + log_err(-1,"mutex_unlock",(char *)"ALERT: cannot unlock mutex!\n"); return(FAILURE); } @@ -2761,7 +2761,7 @@ static void lock_out_ha() { /* try to get a filesystem lock on the "mutex" file */ - while (acquire_file_lock(MutexLockFile,&MutexLockFD,"HA") == FAILURE) + while (acquire_file_lock(MutexLockFile,&MutexLockFD, (char *)"HA") == FAILURE) { sprintf(log_buf,"Could not acquire HA flock--trying again in 1 second\n"); @@ -2841,7 +2841,7 @@ static void lock_out_ha() PBSEVENT_SYSTEM, PBS_EVENTCLASS_SERVER, __func__, - "high availability file lock obtained"); + (char *)"high availability file lock obtained"); } /* END lock_out_ha() */ @@ -2882,7 +2882,7 @@ static int daemonize_server( if ((pid = fork()) == -1) { - log_err(errno, __func__, "cannot fork into background"); + log_err(errno, __func__, (char *)"cannot fork into background"); return(FAILURE); } @@ -2896,7 +2896,7 @@ static int daemonize_server( PBSEVENT_SYSTEM, PBS_EVENTCLASS_SERVER, __func__, - "INFO: parent is exiting"); + (char *)"INFO: parent is exiting"); exit(0); } @@ -2905,7 +2905,7 @@ static int daemonize_server( if ((*sid = setsid()) == -1) { - log_err(errno, __func__, "Could not disconnect from controlling terminal"); + log_err(errno, __func__, (char *)"Could not disconnect from controlling terminal"); return(FAILURE); } @@ -2927,7 +2927,7 @@ static int daemonize_server( if ((pid = fork()) == -1) { - log_err(errno, __func__, "cannot fork into background"); + log_err(errno, __func__, (char *)"cannot fork into background"); return(FAILURE); } @@ -2940,7 +2940,7 @@ static int daemonize_server( PBSEVENT_SYSTEM, PBS_EVENTCLASS_SERVER, __func__, - "INFO: parent is exiting"); + (char *)"INFO: parent is exiting"); exit(0); } @@ -2953,7 +2953,7 @@ static int daemonize_server( PBSEVENT_SYSTEM, PBS_EVENTCLASS_SERVER, __func__, - "INFO: child process in background"); + (char *)"INFO: child process in background"); return(SUCCESS); } /* END daemonize_server() */ @@ -3073,7 +3073,7 @@ int get_full_path( { char *TokPtr = NULL; - char *Delims = ":;"; /* windows and unix path deliminators */ + char *Delims = (char *)":;"; /* windows and unix path deliminators */ char *PathLocation; char tmpPath[MAX_LINE]; bool_t IsExe = FALSE; @@ -3181,13 +3181,13 @@ int svr_restart() { free(ArgV[0]); - ArgV[0] = calloc(sizeof(char), (strlen(FullCmd) + 1)); + ArgV[0] = (char *)calloc(sizeof(char), (strlen(FullCmd) + 1)); if (ArgV[0] == NULL) { /* could not calloc */ - log_err(errno, __func__, "ERROR: cannot allocate memory for full command, cannot restart\n"); + log_err(errno, __func__, (char *)"ERROR: (char *) cannot allocate memory for full command, cannot restart\n"); exit(-10); } diff --git a/src/server/process_alps_status.c b/src/server/process_alps_status.c index 5675e3494b..782bdcb8f5 100644 --- a/src/server/process_alps_status.c +++ b/src/server/process_alps_status.c @@ -149,14 +149,14 @@ struct pbsnode *create_alps_subnode( if (initialize_pbsnode(subnode, strdup(node_id), NULL, NTYPE_CLUSTER) != PBSE_NONE) { free(subnode); - log_err(ENOMEM, __func__, ""); + log_err(ENOMEM, __func__, (char *)""); return(NULL); } if (create_subnode(subnode) == NULL) { free(subnode); - log_err(ENOMEM, __func__, ""); + log_err(ENOMEM, __func__, (char *)""); return(NULL); } @@ -175,7 +175,7 @@ struct pbsnode *create_alps_subnode( if (rc != PBSE_NONE) { free(subnode); - log_err(rc, __func__, "Couldn't set node attributes"); + log_err(rc, __func__, (char *)"Couldn't set node attributes"); return(NULL); } @@ -310,7 +310,7 @@ int set_ncpus( { if (create_subnode(current) == NULL) { - log_err(ENOMEM, __func__, ""); + log_err(ENOMEM, __func__, (char *)""); return(PBSE_SYSTEM); } @@ -380,7 +380,7 @@ int set_ngpus( { if (create_a_gpusubnode(pnode) != PBSE_NONE) { - log_err(ENOMEM, __func__, ""); + log_err(ENOMEM, __func__, (char *)""); return(PBSE_SYSTEM); } } @@ -497,7 +497,7 @@ int record_reservation( create_alps_reservation(pjob); found_job = TRUE; - unlock_ji_mutex(pjob, __func__, "1", LOGLEVEL); + unlock_ji_mutex(pjob, __func__, (char *)"1", LOGLEVEL); lock_node(pnode, __func__, NULL, 0); break; } @@ -621,7 +621,7 @@ int process_alps_status( if ((parent = find_nodebyname(nd_name)) == NULL) { /* reporter node disappeared - this shouldn't be possible */ - log_err(PBSE_UNKNODE, __func__, "Alps reporter node disappeared while recording a reservation"); + log_err(PBSE_UNKNODE, __func__, (char *)"Alps reporter node disappeared while recording a reservation"); free_arst(&temp); free_all_keys(rsv_ht); free_hash(rsv_ht); diff --git a/src/server/process_mom_update.c b/src/server/process_mom_update.c index 47f0a1c7cf..aab315e7ea 100644 --- a/src/server/process_mom_update.c +++ b/src/server/process_mom_update.c @@ -130,7 +130,7 @@ int save_single_mic_status( { if ((rc = decode_arst(temp, NULL, NULL, single_mic_status->str, 0)) != PBSE_NONE) { - log_err(ENOMEM, __func__, ""); + log_err(ENOMEM, __func__, (char *)""); free_arst(temp); } @@ -454,7 +454,7 @@ void update_job_data( attr_name = threadsafe_tokenizer(&jobdata_ptr, "="); } - unlock_ji_mutex(pjob, __func__, "1", LOGLEVEL); + unlock_ji_mutex(pjob, __func__, (char *)"1", LOGLEVEL); } if (on_node == FALSE) diff --git a/src/server/process_request.c b/src/server/process_request.c index de7e0cc50e..299e2d4b28 100644 --- a/src/server/process_request.c +++ b/src/server/process_request.c @@ -614,7 +614,7 @@ int process_request( } } - unlock_ji_mutex(pjob, __func__, "1", LOGLEVEL); + unlock_ji_mutex(pjob, __func__, (char *)"1", LOGLEVEL); } if (!skip) @@ -1053,7 +1053,7 @@ int close_quejob_by_jobid( } if (pjob != NULL) - unlock_ji_mutex(pjob, __func__, "1", LOGLEVEL); + unlock_ji_mutex(pjob, __func__, (char *)"1", LOGLEVEL); return(rc); } /* close_quejob_by_jobid() */ diff --git a/src/server/queue_attr_def.c b/src/server/queue_attr_def.c index 846729b568..7de5df0c53 100644 --- a/src/server/queue_attr_def.c +++ b/src/server/queue_attr_def.c @@ -97,14 +97,14 @@ extern int disallowed_types_chk (pbs_attribute * pattr, void *pobject, /* array of allowable strings in queue pbs_attribute disallowed_types */ char *array_disallowed_types[] = { - Q_DT_batch, - Q_DT_interactive, - Q_DT_rerunable, - Q_DT_nonrerunable, - Q_DT_fault_tolerant, - Q_DT_fault_intolerant, - Q_DT_job_array, - "_END_" /* must be last string */ + (char *)Q_DT_batch, + (char *)Q_DT_interactive, + (char *)Q_DT_rerunable, + (char *)Q_DT_nonrerunable, + (char *)Q_DT_fault_tolerant, + (char *)Q_DT_fault_intolerant, + (char *)Q_DT_job_array, + (char *)"_END_" /* must be last string */ }; @@ -138,7 +138,7 @@ attribute_def que_attr_def[] = { /* QA_ATR_QType */ - { ATTR_qtype, /* "queue_type" - type of queue */ + { (char *)ATTR_qtype, /* "queue_type" - type of queue */ decode_str, encode_str, set_str, @@ -150,7 +150,7 @@ attribute_def que_attr_def[] = PARENT_TYPE_QUE_ALL }, /* QA_ATR_Priority */ /* priority of queue relative to others */ - { ATTR_p, /* "priority" */ + { (char *)ATTR_p, /* "priority" */ decode_l, encode_l, set_l, @@ -163,7 +163,7 @@ attribute_def que_attr_def[] = }, /* QA_ATR_HostList */ /* HostList */ - { ATTR_hostlist, /* "hostlist" */ + { (char *)ATTR_hostlist, /* "hostlist" */ decode_arst, encode_arst, set_hostacl, @@ -176,7 +176,7 @@ attribute_def que_attr_def[] = }, /* QA_ATR_Rerunnable */ /* rerunnable */ - { ATTR_rerunnable, /* "rerunnable" */ + { (char *)ATTR_rerunnable, /* "rerunnable" */ decode_b, encode_b, set_b, @@ -189,7 +189,7 @@ attribute_def que_attr_def[] = }, /* QA_ATR_MaxJobs */ /* max number of jobs allowed in queue */ - { ATTR_maxque, /* "max_queuable" */ + { (char *)ATTR_maxque, /* "max_queuable" */ decode_l, encode_l, set_l, @@ -201,7 +201,7 @@ attribute_def que_attr_def[] = PARENT_TYPE_QUE_ALL }, /* QA_ATR_MaxUserJobs */ /* max number of jobs per user allowed in queue */ - { ATTR_maxuserque, /* max_user_queuable */ + { (char *)ATTR_maxuserque, /* max_user_queuable */ decode_l, encode_l, set_l, @@ -213,7 +213,7 @@ attribute_def que_attr_def[] = PARENT_TYPE_QUE_ALL }, /* QS_ATR_TotalJobs */ /* current number of jobs in queue */ - { ATTR_total, /* "total_jobs" */ + { (char *)ATTR_total, /* "total_jobs" */ decode_null, encode_l, set_null, @@ -225,7 +225,7 @@ attribute_def que_attr_def[] = PARENT_TYPE_QUE_ALL }, /* QA_ATR_JobsByState */ /* current number of jobs in queue by state */ - { ATTR_count, /* "state_count" */ + { (char *)ATTR_count, /* "state_count" */ decode_null, /* note-use fixed memory in queue struct */ encode_str, set_null, @@ -237,7 +237,7 @@ attribute_def que_attr_def[] = PARENT_TYPE_QUE_ALL }, /* QA_ATR_MaxReport */ /* max number of jobs reported for truncated output */ - { ATTR_maxreport, /* "max_report" */ + { (char *)ATTR_maxreport, /* "max_report" */ decode_l, encode_l, set_l, @@ -249,7 +249,7 @@ attribute_def que_attr_def[] = PARENT_TYPE_QUE_ALL }, /* QA_ATR_MaxRun */ /* max number of jobs allowed to run */ - { ATTR_maxrun, /* "max_running" */ + { (char *)ATTR_maxrun, /* "max_running" */ decode_l, encode_l, set_l, @@ -261,7 +261,7 @@ attribute_def que_attr_def[] = PARENT_TYPE_QUE_ALL }, /* QA_ATR_AclHostEnabled */ /* Host ACL to be used */ - { ATTR_aclhten, /* "acl_host_enable" */ + { (char *)ATTR_aclhten, /* "acl_host_enable" */ decode_b, encode_b, set_b, @@ -273,7 +273,7 @@ attribute_def que_attr_def[] = PARENT_TYPE_QUE_ALL }, /* QA_ATR_AclHost */ /* Host Access Control List */ - { ATTR_aclhost, /* "acl_hosts" */ + { (char *)ATTR_aclhost, /* "acl_hosts" */ decode_arst, encode_arst, set_hostacl, @@ -285,7 +285,7 @@ attribute_def que_attr_def[] = PARENT_TYPE_QUE_ALL }, /* QA_ATR_AclUserEnabled */ /* User ACL to be used */ - { ATTR_acluren, /* "acl_user_enable" */ + { (char *)ATTR_acluren, /* "acl_user_enable" */ decode_b, encode_b, set_b, @@ -297,7 +297,7 @@ attribute_def que_attr_def[] = PARENT_TYPE_QUE_ALL }, /* QA_ATR_AclUsers */ /* User Acess Control List */ - { ATTR_acluser, /* "acl_users" */ + { (char *)ATTR_acluser, /* "acl_users" */ decode_arst, encode_arst, set_uacl, @@ -309,7 +309,7 @@ attribute_def que_attr_def[] = PARENT_TYPE_QUE_ALL }, /* QA_ATR_FromRouteOnly */ /* Jobs can only enter from a routing queue */ - { ATTR_fromroute, /* "from_route_only" */ + { (char *)ATTR_fromroute, /* "from_route_only" */ decode_b, encode_b, set_b, @@ -321,7 +321,7 @@ attribute_def que_attr_def[] = PARENT_TYPE_QUE_ALL }, /* QA_ATR_ResourceMax */ - { ATTR_rescmax, /* "resources_max" */ + { (char *)ATTR_rescmax, /* "resources_max" */ decode_resc, encode_resc, set_resc, @@ -333,7 +333,7 @@ attribute_def que_attr_def[] = PARENT_TYPE_QUE_ALL }, /* QA_ATR_ResourceMin */ - { ATTR_rescmin, /* "resources_min" */ + { (char *)ATTR_rescmin, /* "resources_min" */ decode_resc, encode_resc, set_resc, @@ -345,7 +345,7 @@ attribute_def que_attr_def[] = PARENT_TYPE_QUE_ALL }, /* QA_ATR_ResourceDefault */ - { ATTR_rescdflt, /* "resources_default" */ + { (char *)ATTR_rescdflt, /* "resources_default" */ decode_resc, encode_resc, set_resc, @@ -358,7 +358,7 @@ attribute_def que_attr_def[] = }, /* QA_ATR_AclGroupEnabled */ /* Group ACL to be used */ - { ATTR_aclgren, /* "acl_group_enable" */ + { (char *)ATTR_aclgren, /* "acl_group_enable" */ decode_b, encode_b, set_b, @@ -370,7 +370,7 @@ attribute_def que_attr_def[] = PARENT_TYPE_QUE_ALL }, /* QA_ATR_AclGroup */ /* Group Access Control List */ - { ATTR_aclgroup, /* "acl_group_list" */ + { (char *)ATTR_aclgroup, /* "acl_group_list" */ decode_arst, encode_arst, set_arst, @@ -382,7 +382,7 @@ attribute_def que_attr_def[] = PARENT_TYPE_QUE_ALL }, /* QA_ATR_AclLogic */ - { ATTR_acllogic, /* "acl_logic_or" */ + { (char *)ATTR_acllogic, /* "acl_logic_or" */ decode_b, encode_b, set_b, @@ -394,7 +394,7 @@ attribute_def que_attr_def[] = PARENT_TYPE_QUE_ALL }, /* QA_ATR_AclGroupSloppy */ - { ATTR_aclgrpslpy, /* "acl_group_sloppy" */ + { (char *)ATTR_aclgrpslpy, /* "acl_group_sloppy" */ decode_b, encode_b, set_b, @@ -406,7 +406,7 @@ attribute_def que_attr_def[] = PARENT_TYPE_QUE_ALL }, /* QA_ATR_MTime */ - { ATTR_mtime, /* "mtime" */ + { (char *)ATTR_mtime, /* "mtime" */ decode_l, encode_l, set_null, @@ -418,7 +418,7 @@ attribute_def que_attr_def[] = PARENT_TYPE_QUE_ALL }, /* QA_ATR_DisallowedTypes */ - { ATTR_disallowedtypes, /* "disallowed_types" */ + { (char *)ATTR_disallowedtypes, /* "disallowed_types" */ decode_arst, encode_arst, set_arst, @@ -434,7 +434,7 @@ attribute_def que_attr_def[] = /* QE_ATR_checkpoint_dir */ - { ATTR_checkpoint_dir, /* "checkpoint_dir" */ + { (char *)ATTR_checkpoint_dir, /* "checkpoint_dir" */ decode_str, encode_str, set_str, @@ -446,7 +446,7 @@ attribute_def que_attr_def[] = PARENT_TYPE_QUE_EXC }, /* QE_ATR_checkpoint_min */ - { ATTR_checkpoint_min, /* "checkpoint_min" */ + { (char *)ATTR_checkpoint_min, /* "checkpoint_min" */ decode_l, encode_l, set_l, @@ -458,7 +458,7 @@ attribute_def que_attr_def[] = PARENT_TYPE_QUE_EXC }, /* QE_ATR_checkpoint_defaults */ - { ATTR_checkpoint_defaults, /* "checkpoint_defaults" */ + { (char *)ATTR_checkpoint_defaults, /* "checkpoint_defaults" */ decode_str, encode_str, set_str, @@ -470,7 +470,7 @@ attribute_def que_attr_def[] = PARENT_TYPE_QUE_EXC }, /* QE_ATR_RendezvousRetry */ /* Number times to retry sync of jobs */ - { "rendezvous_retry", + { (char *)"rendezvous_retry", decode_l, encode_l, set_l, @@ -482,7 +482,7 @@ attribute_def que_attr_def[] = PARENT_TYPE_QUE_EXC }, /* QE_ATR_ReservedExpedite */ - { "reserved_expedite", + { (char *)"reserved_expedite", decode_l, encode_l, set_l, @@ -494,7 +494,7 @@ attribute_def que_attr_def[] = PARENT_TYPE_QUE_EXC }, /* QE_ATR_ReservedSync */ - { "reserved_sync", + { (char *)"reserved_sync", decode_l, encode_l, set_l, @@ -506,7 +506,7 @@ attribute_def que_attr_def[] = PARENT_TYPE_QUE_EXC }, /* QE_ATR_ResourceAvail */ - { "resources_available", + { (char *)"resources_available", decode_resc, encode_resc, set_resc, @@ -518,7 +518,7 @@ attribute_def que_attr_def[] = PARENT_TYPE_QUE_EXC }, /* QE_ATR_ResourceAssn */ - { ATTR_rescassn, /* "resources_assigned" */ + { (char *)ATTR_rescassn, /* "resources_assigned" */ decode_resc, encode_resc, set_resc, @@ -530,7 +530,7 @@ attribute_def que_attr_def[] = PARENT_TYPE_QUE_EXC }, /* QE_ATR_KillDelay */ - { ATTR_killdelay, /* "kill_delay" */ + { (char *)ATTR_killdelay, /* "kill_delay" */ decode_l, encode_l, set_l, @@ -542,7 +542,7 @@ attribute_def que_attr_def[] = PARENT_TYPE_QUE_EXC }, /* QE_ATR_MaxUserRun */ - { ATTR_maxuserrun, /* "max_user_run" */ + { (char *)ATTR_maxuserrun, /* "max_user_run" */ decode_l, encode_l, set_l, @@ -554,7 +554,7 @@ attribute_def que_attr_def[] = PARENT_TYPE_QUE_EXC }, /* QE_ATR_MaxGrpRun */ - { ATTR_maxgrprun, /* "max_group_run" */ + { (char *)ATTR_maxgrprun, /* "max_group_run" */ decode_l, encode_l, set_l, @@ -566,7 +566,7 @@ attribute_def que_attr_def[] = PARENT_TYPE_QUE_EXC }, /* QE_ATR_KeepCompleted */ - { ATTR_keepcompleted, /* "keep_completed" */ + { (char *)ATTR_keepcompleted, /* "keep_completed" */ decode_l, encode_l, set_l, @@ -578,7 +578,7 @@ attribute_def que_attr_def[] = PARENT_TYPE_QUE_EXC }, /* QR_ATR_is_transit */ - { ATTR_is_transit, + { (char *)ATTR_is_transit, decode_b, encode_b, set_b, @@ -592,7 +592,7 @@ attribute_def que_attr_def[] = /* for routing queues */ /* QR_ATR_RouteDestin */ - { ATTR_routedest, /* "route_destinations" */ + { (char *)ATTR_routedest, /* "route_destinations" */ decode_arst, encode_arst, set_arst, @@ -604,7 +604,7 @@ attribute_def que_attr_def[] = PARENT_TYPE_QUE_RTE }, /* QR_ATR_AltRouter */ - { ATTR_altrouter, /* "alt_router" */ + { (char *)ATTR_altrouter, /* "alt_router" */ decode_b, encode_b, set_b, @@ -616,7 +616,7 @@ attribute_def que_attr_def[] = PARENT_TYPE_QUE_RTE }, /* QR_ATR_RouteHeld */ - { ATTR_routeheld, /* "route_held_jobs" */ + { (char *)ATTR_routeheld, /* "route_held_jobs" */ decode_b, encode_b, set_b, @@ -628,7 +628,7 @@ attribute_def que_attr_def[] = PARENT_TYPE_QUE_RTE }, /* QR_ATR_RouteWaiting */ - { ATTR_routewait, /* "route_waiting_jobs" */ + { (char *)ATTR_routewait, /* "route_waiting_jobs" */ decode_b, encode_b, set_b, @@ -640,7 +640,7 @@ attribute_def que_attr_def[] = PARENT_TYPE_QUE_RTE }, /* QR_ATR_RouteRetryTime */ - { ATTR_routeretry, /* "route_retry_time" */ + { (char *)ATTR_routeretry, /* "route_retry_time" */ decode_l, encode_l, set_l, @@ -652,7 +652,7 @@ attribute_def que_attr_def[] = PARENT_TYPE_QUE_RTE }, /* QR_ATR_RouteLifeTime */ - { ATTR_routelife, /* "route_lifetime" */ + { (char *)ATTR_routelife, /* "route_lifetime" */ decode_l, encode_l, set_l, @@ -667,7 +667,7 @@ attribute_def que_attr_def[] = #include "site_que_attr_def.h" /* QA_ATR_Enabled */ /* Queue enabled - jobs can be enqueued */ - { ATTR_enable, /* "enabled" */ + { (char *)ATTR_enable, /* "enabled" */ decode_b, encode_b, set_b, @@ -679,7 +679,7 @@ attribute_def que_attr_def[] = PARENT_TYPE_QUE_ALL }, /* QA_ATR_Started */ /* Queue enabled - jobs can be started */ - { ATTR_start, /* "started" */ + { (char *)ATTR_start, /* "started" */ decode_b, encode_b, set_b, diff --git a/src/server/queue_func.c b/src/server/queue_func.c index c3b37f1f84..cdafbd7fbd 100644 --- a/src/server/queue_func.c +++ b/src/server/queue_func.c @@ -216,7 +216,7 @@ pbs_queue *que_alloc( int sv_qs_mutex_held) { - static char *mem_err = "no memory"; + static char *mem_err = (char *)"no memory"; int i; pbs_queue *pq; @@ -232,8 +232,8 @@ pbs_queue *que_alloc( pq->qu_qs.qu_type = QTYPE_Unset; - pq->qu_mutex = calloc(1, sizeof(pthread_mutex_t)); - pq->qu_jobs = calloc(1, sizeof(struct all_jobs)); + pq->qu_mutex = (pthread_mutex_t *)calloc(1, sizeof(pthread_mutex_t)); + pq->qu_jobs = (struct all_jobs *)calloc(1, sizeof(struct all_jobs)); pq->qu_jobs_array_sum = calloc(1, sizeof(struct all_jobs)); if ((pq->qu_mutex == NULL) || @@ -247,7 +247,7 @@ pbs_queue *que_alloc( initialize_all_jobs_array(pq->qu_jobs); initialize_all_jobs_array(pq->qu_jobs_array_sum); pthread_mutex_init(pq->qu_mutex,NULL); - lock_queue(pq, __func__, NULL, LOGLEVEL); + lock_queue(pq, __func__, (char *)NULL, LOGLEVEL); snprintf(pq->qu_qs.qu_name, sizeof(pq->qu_qs.qu_name), "%s", name); @@ -260,7 +260,7 @@ pbs_queue *que_alloc( unlock_sv_qs_mutex(server.sv_qs_mutex, __func__); /* set up the user info struct */ - pq->qu_uih = calloc(1, sizeof(user_info_holder)); + pq->qu_uih = (user_info_holder *)calloc(1, sizeof(user_info_holder)); initialize_user_info_holder(pq->qu_uih); /* set the working attributes to "unspecified" */ @@ -320,7 +320,7 @@ void que_free( remove_queue(&svr_queues, pq); pq->q_being_recycled = TRUE; insert_into_queue_recycler(pq); - unlock_queue(pq, "que_free", NULL, LOGLEVEL); + unlock_queue(pq, "que_free", (char *)NULL, LOGLEVEL); return; } /* END que_free() */ @@ -393,11 +393,11 @@ pbs_queue *find_queuebyname( if (i >= 0) { - pque = svr_queues.ra->slots[i].item; + pque = (pbs_queue *)svr_queues.ra->slots[i].item; } if (pque != NULL) - lock_queue(pque, __func__, NULL, LOGLEVEL); + lock_queue(pque, __func__, (char *)NULL, LOGLEVEL); pthread_mutex_unlock(svr_queues.allques_mutex); @@ -405,7 +405,7 @@ pbs_queue *find_queuebyname( { if (pque->q_being_recycled != FALSE) { - unlock_queue(pque, __func__, "recycled queue", LOGLEVEL); + unlock_queue(pque, __func__, (char *)"recycled queue", LOGLEVEL); pque = NULL; } } @@ -449,7 +449,7 @@ void initialize_allques_array( aq->ra = initialize_resizable_array(INITIAL_QUEUE_SIZE); aq->ht = create_hash(INITIAL_HASH_SIZE); - aq->allques_mutex = calloc(1, sizeof(pthread_mutex_t)); + aq->allques_mutex = (pthread_mutex_t *)calloc(1, sizeof(pthread_mutex_t)); pthread_mutex_init(aq->allques_mutex,NULL); } /* END initialize_all_ques_array() */ @@ -482,7 +482,7 @@ int insert_queue( if ((rc = insert_thing(aq->ra,pque)) == -1) { rc = ENOMEM; - log_err(rc, __func__, "No memory to resize the array"); + log_err(rc, __func__, (char *)"No memory to resize the array"); } else { @@ -511,9 +511,9 @@ int remove_queue( if (pthread_mutex_trylock(aq->allques_mutex)) { - unlock_queue(pque, __func__, NULL, LOGLEVEL); + unlock_queue(pque, __func__, (char *)NULL, LOGLEVEL); pthread_mutex_lock(aq->allques_mutex); - lock_queue(pque, __func__, NULL, LOGLEVEL); + lock_queue(pque, __func__, (char *)NULL, LOGLEVEL); } if ((index = get_value_hash(aq->ht,pque->qu_qs.qu_name)) < 0) @@ -548,14 +548,14 @@ pbs_queue *next_queue( pque = (pbs_queue *)next_thing(aq->ra,iter); if (pque != NULL) - lock_queue(pque, "next_queue", NULL, LOGLEVEL); + lock_queue(pque, "next_queue", (char *)NULL, LOGLEVEL); pthread_mutex_unlock(aq->allques_mutex); if (pque != NULL) { if (pque->q_being_recycled != FALSE) { - unlock_queue(pque, __func__, "recycled queue", LOGLEVEL); + unlock_queue(pque, __func__, (char *)"recycled queue", LOGLEVEL); pque = next_queue(aq, iter); } } @@ -610,9 +610,9 @@ int get_parent_dest_queues( else return(-1); - unlock_ji_mutex(pjob, __func__, "1", LOGLEVEL); + unlock_ji_mutex(pjob, __func__, (char *)"1", LOGLEVEL); - unlock_queue(*parent, __func__, NULL, 0); + unlock_queue(*parent, __func__, (char *)NULL, 0); *parent = NULL; *dest = NULL; @@ -641,8 +641,8 @@ int get_parent_dest_queues( else { /* SUCCESS! */ - lock_queue(pque_parent, __func__, NULL, 0); - lock_queue(pque_dest, __func__, NULL, 0); + lock_queue(pque_parent, __func__, (char *)NULL, 0); + lock_queue(pque_dest, __func__, (char *)NULL, 0); *parent = pque_parent; *dest = pque_dest; @@ -677,12 +677,12 @@ pbs_queue *lock_queue_with_job_held( { /* if fail */ strcpy(jobid, pjob->ji_qs.ji_jobid); - unlock_ji_mutex(pjob, __func__, "1", LOGLEVEL); - lock_queue(pque, __func__, NULL, LOGLEVEL); + unlock_ji_mutex(pjob, __func__, (char *)"1", LOGLEVEL); + lock_queue(pque, __func__, (char *)NULL, LOGLEVEL); if ((pjob = svr_find_job(jobid, TRUE)) == NULL) { - unlock_queue(pque, __func__, NULL, 0); + unlock_queue(pque, __func__, (char *)NULL, 0); pque = NULL; *pjob_ptr = NULL; } diff --git a/src/server/queue_recov.c b/src/server/queue_recov.c index 151734f6af..5035251dcd 100644 --- a/src/server/queue_recov.c +++ b/src/server/queue_recov.c @@ -155,7 +155,7 @@ int que_save( if (fds < 0) { - log_err(errno, myid, "open error"); + log_err(errno, myid, (char *)"open error"); return(-1); } @@ -171,7 +171,7 @@ int que_save( if ((rc = write_buffer(buf,strlen(buf),fds))) { - log_err(rc,myid,"unable to write to the file"); + log_err(rc,myid, (char *)"unable to write to the file"); close(fds); return(-1); } @@ -180,7 +180,7 @@ int que_save( if (save_attr_xml(que_attr_def, pque->qu_attr, QA_ATR_LAST,fds) != 0) { - log_err(-1, myid, "save_attr failed"); + log_err(-1, myid, (char *)"save_attr failed"); close(fds); return(-1); } @@ -189,7 +189,7 @@ int que_save( snprintf(buf,sizeof(buf),""); if ((rc = write_buffer(buf,strlen(buf),fds))) { - log_err(rc,myid,"unable to write to the queue's file"); + log_err(rc,myid, (char *)"unable to write to the queue's file"); close(fds); return(-1); } @@ -199,7 +199,7 @@ int que_save( if (link(namebuf2, namebuf1) < 0) { - log_err(errno, myid, "unable to link queue name"); + log_err(errno, myid, (char *)"unable to link queue name"); } else { @@ -236,7 +236,7 @@ pbs_queue *que_recov_xml( if (pq == NULL) { - log_err(-1, __func__, "que_alloc failed"); + log_err(-1, __func__, (char *)"que_alloc failed"); return(NULL); } @@ -247,7 +247,7 @@ pbs_queue *que_recov_xml( if (fds < 0) { - log_err(errno, __func__, "open error"); + log_err(errno, __func__, (char *)"open error"); que_free(pq, TRUE); @@ -288,7 +288,7 @@ pbs_queue *que_recov_xml( if (end == NULL) { - log_err(-1, __func__, "No queue tag found in the queue file???"); + log_err(-1, __func__, (char *)"No queue tag found in the queue file???"); que_free(pq, TRUE); close(fds); return(NULL); @@ -409,7 +409,7 @@ pbs_queue *que_recov( if (pq == NULL) { - log_err(-1, __func__, "que_alloc failed"); + log_err(-1, __func__, (char *)"que_alloc failed"); return(NULL); } @@ -420,7 +420,7 @@ pbs_queue *que_recov( if (fds < 0) { - log_err(errno, __func__, "open error"); + log_err(errno, __func__, (char *)"open error"); que_free(pq, TRUE); @@ -432,7 +432,7 @@ pbs_queue *que_recov( if (read(fds, (char *)&pq->qu_qs, sizeof(struct queuefix)) != sizeof(struct queuefix)) { - log_err(errno, __func__, "read error"); + log_err(errno, __func__, (char *)"read error"); que_free(pq, TRUE); close(fds); return ((pbs_queue *)0); @@ -443,7 +443,7 @@ pbs_queue *que_recov( if (recov_attr(fds, pq, que_attr_def, pq->qu_attr, QA_ATR_LAST, 0, TRUE) != 0) { - log_err(-1, __func__, "recov_attr[common] failed"); + log_err(-1, __func__, (char *)"recov_attr[common] failed"); que_free(pq, TRUE); close(fds); return ((pbs_queue *)0); diff --git a/src/server/queue_recycler.c b/src/server/queue_recycler.c index 650dd09458..2fe6fa956f 100644 --- a/src/server/queue_recycler.c +++ b/src/server/queue_recycler.c @@ -42,7 +42,7 @@ pbs_queue *next_queue_from_recycler( pthread_mutex_lock(aq->allques_mutex); pq = next_thing(aq->ra, iter); if (pq != NULL) - lock_queue(pq, __func__, NULL, LOGLEVEL); + lock_queue(pq, __func__, (char *)NULL, LOGLEVEL); pthread_mutex_unlock(aq->allques_mutex); return(pq); @@ -67,7 +67,7 @@ void *remove_some_recycle_queues( return NULL; remove_queue(&q_recycler.queues,pq); - unlock_queue(pq, __func__, NULL, LOGLEVEL); + unlock_queue(pq, __func__, (char *)NULL, LOGLEVEL); free(pq->qu_mutex); free_alljobs_array(pq->qu_jobs); free_alljobs_array(pq->qu_jobs_array_sum); diff --git a/src/server/receive_mom_communication.c b/src/server/receive_mom_communication.c index db8fead44d..d1f95997fa 100644 --- a/src/server/receive_mom_communication.c +++ b/src/server/receive_mom_communication.c @@ -237,14 +237,14 @@ int gpu_has_job( found_str = strstr (gpu_str, tmp_str); if (found_str != NULL) { - unlock_ji_mutex(pjob, __func__, "1", LOGLEVEL); + unlock_ji_mutex(pjob, __func__, (char *)"1", LOGLEVEL); return(TRUE); } } } /* done with job, unlock the mutex */ - unlock_ji_mutex(pjob, __func__, "2", LOGLEVEL); + unlock_ji_mutex(pjob, __func__, (char *)"2", LOGLEVEL); } } } /* END for each job on the subnode */ @@ -330,7 +330,7 @@ int svr_is_request( if (getpeername(chan->sock, &s_addr, &len) != 0) { close_conn(chan->sock, FALSE); - log_err(errno,__func__,"Cannot get socket name using getpeername\n"); + log_err(errno,__func__, (char *)"Cannot get socket name using getpeername\n"); return(PBSE_SOCKET_CLOSE); } diff --git a/src/server/req_delete.c b/src/server/req_delete.c index 0bb32b7f04..94e98669f3 100644 --- a/src/server/req_delete.c +++ b/src/server/req_delete.c @@ -242,11 +242,11 @@ void force_purge_work( { if (pjob->ji_qhdr->qu_qs.qu_type == QTYPE_Execution) { - unlock_queue(pque, __func__, NULL, LOGLEVEL); + unlock_queue(pque, __func__, (char *)NULL, LOGLEVEL); set_resc_assigned(pjob, DECR); } else - unlock_queue(pque, __func__, NULL, LOGLEVEL); + unlock_queue(pque, __func__, (char *)NULL, LOGLEVEL); } if (pjob != NULL) @@ -315,7 +315,7 @@ int execute_job_delete( /* see note in req_delete - not sure this is possible still, * but the deleted code is irrelevant now. I will leave this * part --dbeer */ - unlock_ji_mutex(pjob, __func__, "1", LOGLEVEL); + unlock_ji_mutex(pjob, __func__, (char *)"1", LOGLEVEL); return(-1); } @@ -372,7 +372,7 @@ int execute_job_delete( pwtnew = set_task(WORK_Timed,time_now + 1,post_delete_route,preq,FALSE); - unlock_ji_mutex(pjob, __func__, "2", LOGLEVEL); + unlock_ji_mutex(pjob, __func__, (char *)"2", LOGLEVEL); if (pwtnew == NULL) { @@ -446,7 +446,7 @@ int execute_job_delete( if (pjob->ji_has_delete_nanny == TRUE) { - unlock_ji_mutex(pjob, __func__, "3", LOGLEVEL); + unlock_ji_mutex(pjob, __func__, (char *)"3", LOGLEVEL); req_reject(PBSE_IVALREQ, 0, preq, NULL, "job cancel in progress"); @@ -474,7 +474,7 @@ int execute_job_delete( sprintf(log_buf, msg_delrunjobsig, sigt); log_event(PBSEVENT_JOB,PBS_EVENTCLASS_JOB,pjob->ji_qs.ji_jobid,log_buf); - unlock_ji_mutex(pjob, __func__, "4", LOGLEVEL); + unlock_ji_mutex(pjob, __func__, (char *)"4", LOGLEVEL); } return(-1); @@ -535,16 +535,16 @@ int execute_job_delete( svr_setjobstate(tmp, newstate, newsub, FALSE); job_save(tmp, SAVEJOB_FULL, 0); - unlock_ji_mutex(tmp, __func__, "5", LOGLEVEL); + unlock_ji_mutex(tmp, __func__, (char *)"5", LOGLEVEL); break; } - unlock_ji_mutex(tmp, __func__, "6", LOGLEVEL); + unlock_ji_mutex(tmp, __func__, (char *)"6", LOGLEVEL); } } - unlock_ai_mutex(pa, __func__, "1", LOGLEVEL); + unlock_ai_mutex(pa, __func__, (char *)"1", LOGLEVEL); } } /* END MoabArrayCompatible check */ @@ -590,7 +590,7 @@ int execute_job_delete( { pque->qu_numcompleted++; - unlock_queue(pque, __func__, NULL, LOGLEVEL); + unlock_queue(pque, __func__, (char *)NULL, LOGLEVEL); if (LOGLEVEL >= 7) { @@ -617,7 +617,7 @@ int execute_job_delete( } /* END else if ((pjob->ji_qs.ji_svrflags & JOB_SVFLG_CHECKPOINT_FILE) != 0) */ if (has_mutex == TRUE) - unlock_ji_mutex(pjob, __func__, "7", LOGLEVEL); + unlock_ji_mutex(pjob, __func__, (char *)"7", LOGLEVEL); return(PBSE_NONE); } /* END execute_job_delete() */ @@ -685,7 +685,7 @@ void *delete_all_work( if (pjob->ji_qs.ji_state >= JOB_STATE_EXITING) { - unlock_ji_mutex(pjob, __func__, "1", LOGLEVEL); + unlock_ji_mutex(pjob, __func__, (char *)"1", LOGLEVEL); continue; } @@ -826,7 +826,7 @@ int handle_single_delete( } else { - unlock_ji_mutex(pjob, __func__, NULL, 0); + unlock_ji_mutex(pjob, __func__, (char *)NULL, 0); /* send the asynchronous reply if needed */ if (preq_tmp != NULL) @@ -1105,7 +1105,7 @@ void post_delete_mom1( { req_reject(rc, 0, preq_clt, NULL, NULL); - unlock_ji_mutex(pjob, __func__, "1", LOGLEVEL); + unlock_ji_mutex(pjob, __func__, (char *)"1", LOGLEVEL); } return; @@ -1134,7 +1134,7 @@ void post_delete_mom1( &server.sv_attr[SRV_ATR_KillDelay], 2); pthread_mutex_unlock(server.sv_attr_mutex); - unlock_queue(pque, __func__, NULL, LOGLEVEL); + unlock_queue(pque, __func__, (char *)NULL, LOGLEVEL); } else if (pjob == NULL) return; @@ -1148,7 +1148,7 @@ void post_delete_mom1( */ apply_job_delete_nanny(pjob, time_now + delay + 60); - unlock_ji_mutex(pjob, __func__, "2", LOGLEVEL); + unlock_ji_mutex(pjob, __func__, (char *)"2", LOGLEVEL); } /* END post_delete_mom1() */ @@ -1171,7 +1171,7 @@ static void post_delete_mom2( if (jobid == NULL) { - log_err(ENOMEM, __func__, "Cannot allocate memory"); + log_err(ENOMEM, __func__, (char *)"Cannot allocate memory"); return; } @@ -1192,7 +1192,7 @@ static void post_delete_mom2( } if (pjob != NULL) - unlock_ji_mutex(pjob, __func__, "1", LOGLEVEL); + unlock_ji_mutex(pjob, __func__, (char *)"1", LOGLEVEL); } } /* END post_delete_mom2() */ @@ -1233,7 +1233,7 @@ int forced_jobpurge( /* FAILURE */ req_reject(PBSE_PERM, 0, preq, NULL, NULL); - unlock_ji_mutex(pjob, __func__, "1", LOGLEVEL); + unlock_ji_mutex(pjob, __func__, (char *)"1", LOGLEVEL); return(-1); } @@ -1280,7 +1280,7 @@ int apply_job_delete_nanny( } else { - log_err(-1, __func__, "negative delay requested for nanny"); + log_err(-1, __func__, (char *)"negative delay requested for nanny"); return(-1); } @@ -1359,13 +1359,13 @@ static void job_delete_nanny( { apply_job_delete_nanny(pjob, time_now + 60); - unlock_ji_mutex(pjob, __func__, "1", LOGLEVEL); + unlock_ji_mutex(pjob, __func__, (char *)"1", LOGLEVEL); } } } else { - log_err(ENOMEM, __func__, "Cannot allocate memory"); + log_err(ENOMEM, __func__, (char *)"Cannot allocate memory"); } } @@ -1437,7 +1437,7 @@ void post_job_delete_nanny( return; } - unlock_ji_mutex(pjob, __func__, "1", LOGLEVEL); + unlock_ji_mutex(pjob, __func__, (char *)"1", LOGLEVEL); /* free task */ free_br(preq_sig); @@ -1515,7 +1515,7 @@ void purge_completed_jobs( job_save(pjob, SAVEJOB_FULL, 0); } - unlock_ji_mutex(pjob, __func__, "1", LOGLEVEL); + unlock_ji_mutex(pjob, __func__, (char *)"1", LOGLEVEL); } diff --git a/src/server/req_deletearray.c b/src/server/req_deletearray.c index 25a7a670af..5638146f2e 100644 --- a/src/server/req_deletearray.c +++ b/src/server/req_deletearray.c @@ -108,7 +108,7 @@ int attempt_delete( change_restart_comment_if_needed(pjob); } - unlock_ji_mutex(pjob, __func__, "1", LOGLEVEL); + unlock_ji_mutex(pjob, __func__, (char *)"1", LOGLEVEL); } return(!skipped); @@ -159,7 +159,7 @@ int attempt_delete( { pque->qu_numcompleted++; - unlock_queue(pque, __func__, NULL, LOGLEVEL); + unlock_queue(pque, __func__, (char *)NULL, LOGLEVEL); } if (pjob != NULL) @@ -184,7 +184,7 @@ int attempt_delete( } if (release_mutex == TRUE) - unlock_ji_mutex(pjob, __func__, "2", LOGLEVEL); + unlock_ji_mutex(pjob, __func__, (char *)"2", LOGLEVEL); return(!skipped); } /* END attempt_delete() */ @@ -233,7 +233,7 @@ int req_deletearray( log_event(PBSEVENT_SECURITY,PBS_EVENTCLASS_JOB,preq->rq_ind.rq_delete.rq_objname,log_buf); - unlock_ai_mutex(pa, __func__, "1", LOGLEVEL); + unlock_ai_mutex(pa, __func__, (char *)"1", LOGLEVEL); req_reject(PBSE_PERM, 0, preq, NULL, "operation not permitted"); return(PBSE_NONE); @@ -261,7 +261,7 @@ int req_deletearray( if (num_skipped < 0) { /* ERROR */ - unlock_ai_mutex(pa, __func__, "2", LOGLEVEL); + unlock_ai_mutex(pa, __func__, (char *)"2", LOGLEVEL); req_reject(PBSE_IVALREQ,0,preq,NULL,"Error in specified array range"); return(PBSE_NONE); @@ -285,12 +285,12 @@ int req_deletearray( if (num_skipped != NO_JOBS_IN_ARRAY) { - unlock_ai_mutex(pa, __func__, "1", LOGLEVEL); + unlock_ai_mutex(pa, __func__, (char *)"1", LOGLEVEL); /* check if the array is gone */ if ((pa = get_array(preq->rq_ind.rq_delete.rq_objname)) != NULL) { - unlock_ai_mutex(pa, __func__, "1", LOGLEVEL); + unlock_ai_mutex(pa, __func__, (char *)"1", LOGLEVEL); /* some jobs were not deleted. They must have been running or had JOB_SUBSTATE_TRANSIT */ @@ -389,7 +389,7 @@ void array_delete_wt( } set_task(WORK_Immed, 0, on_job_exit_task, strdup(pjob->ji_qs.ji_jobid), FALSE); - unlock_ji_mutex(pjob, __func__, "1", LOGLEVEL); + unlock_ji_mutex(pjob, __func__, (char *)"1", LOGLEVEL); } } else if ((pjob->ji_qs.ji_svrflags & JOB_SVFLG_StagedIn) != 0) @@ -400,7 +400,7 @@ void array_delete_wt( if (pjob != NULL) { /* job_abt() calls svr_job_purge which will try to lock the array again */ - unlock_ai_mutex(pa, __func__, "3", LOGLEVEL); + unlock_ai_mutex(pa, __func__, (char *)"3", LOGLEVEL); job_abt(&pjob, NULL); pa = get_array(preq->rq_ind.rq_delete.rq_objname); } @@ -408,14 +408,14 @@ void array_delete_wt( else { /* job_abt() calls svr_job_purge which will try to lock the array again */ - unlock_ai_mutex(pa, __func__, "1", LOGLEVEL); + unlock_ai_mutex(pa, __func__, (char *)"1", LOGLEVEL); job_abt(&pjob, NULL); pa = get_array(preq->rq_ind.rq_delete.rq_objname); } } /* END if (ji_substate == JOB_SUBSTATE_PRERUN) */ } /* END for each job in array */ - unlock_ai_mutex(pa, __func__, "1", LOGLEVEL); + unlock_ai_mutex(pa, __func__, (char *)"1", LOGLEVEL); if (num_jobs == num_prerun) { diff --git a/src/server/req_holdarray.c b/src/server/req_holdarray.c index 7184fadf04..928261ae6e 100644 --- a/src/server/req_holdarray.c +++ b/src/server/req_holdarray.c @@ -113,7 +113,7 @@ int req_holdarray( log_event(PBSEVENT_SECURITY, PBS_EVENTCLASS_JOB, preq->rq_ind.rq_delete.rq_objname, log_buf); - unlock_ai_mutex(pa, __func__, "1", LOGLEVEL); + unlock_ai_mutex(pa, __func__, (char *)"1", LOGLEVEL); req_reject(PBSE_PERM, 0, preq, NULL, "operation not permitted"); return(PBSE_NONE); @@ -123,7 +123,7 @@ int req_holdarray( if ((rc = get_hold(&preq->rq_ind.rq_hold.rq_orig.rq_attr, &pset, &temphold)) != 0) { - unlock_ai_mutex(pa, __func__, "2", LOGLEVEL); + unlock_ai_mutex(pa, __func__, (char *)"2", LOGLEVEL); req_reject(rc, 0, preq, NULL, NULL); return(PBSE_NONE); @@ -133,7 +133,7 @@ int req_holdarray( if ((rc = chk_hold_priv(temphold.at_val.at_long, preq->rq_perm)) != 0) { - unlock_ai_mutex(pa, __func__, "3", LOGLEVEL); + unlock_ai_mutex(pa, __func__, (char *)"3", LOGLEVEL); req_reject(rc, 0, preq, NULL, NULL); return(PBSE_NONE); @@ -146,7 +146,7 @@ int req_holdarray( { if ((rc = hold_array_range(pa,range_str,&temphold)) != 0) { - unlock_ai_mutex(pa, __func__, "4", LOGLEVEL); + unlock_ai_mutex(pa, __func__, (char *)"4", LOGLEVEL); req_reject(rc,0,preq,NULL, "Error in specified array range"); @@ -169,12 +169,12 @@ int req_holdarray( else { hold_job(&temphold,pjob); - unlock_ji_mutex(pjob, __func__, "5", LOGLEVEL); + unlock_ji_mutex(pjob, __func__, (char *)"5", LOGLEVEL); } } } - unlock_ai_mutex(pa, __func__, "6", LOGLEVEL); + unlock_ai_mutex(pa, __func__, (char *)"6", LOGLEVEL); reply_ack(preq); diff --git a/src/server/req_holdjob.c b/src/server/req_holdjob.c index 46b74cc886..3afe5c2115 100644 --- a/src/server/req_holdjob.c +++ b/src/server/req_holdjob.c @@ -193,7 +193,7 @@ int req_holdjob( { req_reject(rc, 0, preq, NULL, NULL); - unlock_ji_mutex(pjob, __func__, "1", LOGLEVEL); + unlock_ji_mutex(pjob, __func__, (char *)"1", LOGLEVEL); return(PBSE_NONE); } @@ -204,7 +204,7 @@ int req_holdjob( { req_reject(rc, 0, preq, NULL, NULL); - unlock_ji_mutex(pjob, __func__, "2", LOGLEVEL); + unlock_ji_mutex(pjob, __func__, (char *)"2", LOGLEVEL); return(PBSE_NONE); } @@ -251,7 +251,7 @@ int req_holdjob( sprintf(log_buf, msg_jobholdset, pset, preq->rq_user, preq->rq_host); log_event(PBSEVENT_JOB, PBS_EVENTCLASS_JOB, pjob->ji_qs.ji_jobid, log_buf); - unlock_ji_mutex(pjob, __func__, "3", LOGLEVEL); + unlock_ji_mutex(pjob, __func__, (char *)"3", LOGLEVEL); pjob = NULL; req_reject(rc, 0, preq, NULL, "relay to mom failed"); } @@ -295,7 +295,7 @@ int req_holdjob( } if (pjob != NULL) - unlock_ji_mutex(pjob, __func__, "3", LOGLEVEL); + unlock_ji_mutex(pjob, __func__, (char *)"3", LOGLEVEL); return(PBSE_NONE); } /* END req_holdjob() */ @@ -354,7 +354,7 @@ void *req_checkpointjob( job_save(pjob, SAVEJOB_QUICK, 0); log_event(PBSEVENT_JOB, PBS_EVENTCLASS_JOB, pjob->ji_qs.ji_jobid, log_buf); - unlock_ji_mutex(pjob, __func__, "1", LOGLEVEL); + unlock_ji_mutex(pjob, __func__, (char *)"1", LOGLEVEL); pjob = NULL; } @@ -371,7 +371,7 @@ void *req_checkpointjob( } if (pjob != NULL) - unlock_ji_mutex(pjob, __func__, "1", LOGLEVEL); + unlock_ji_mutex(pjob, __func__, (char *)"1", LOGLEVEL); return(NULL); } /* END req_checkpointjob() */ @@ -479,7 +479,7 @@ int req_releasejob( reply_ack(preq); } - unlock_ji_mutex(pjob, __func__, "1", LOGLEVEL); + unlock_ji_mutex(pjob, __func__, (char *)"1", LOGLEVEL); return(PBSE_NONE); } /* END req_releasejob() */ @@ -510,11 +510,11 @@ int release_whole_array( { if ((rc = release_job(preq, pjob)) != 0) { - unlock_ji_mutex(pjob, __func__, "1", LOGLEVEL); + unlock_ji_mutex(pjob, __func__, (char *)"1", LOGLEVEL); return(rc); } - unlock_ji_mutex(pjob, __func__, "2", LOGLEVEL); + unlock_ji_mutex(pjob, __func__, (char *)"2", LOGLEVEL); } } @@ -548,7 +548,7 @@ int req_releasearray( if (((index = first_job_index(pa)) == -1) || (pa->job_ids[index] == NULL)) { - unlock_ai_mutex(pa, __func__, "1", LOGLEVEL); + unlock_ai_mutex(pa, __func__, (char *)"1", LOGLEVEL); return(PBSE_NONE); } @@ -566,13 +566,13 @@ int req_releasearray( { req_reject(PBSE_PERM,0,preq,NULL,NULL); - unlock_ai_mutex(pa, __func__, "2", LOGLEVEL); - unlock_ji_mutex(pjob, __func__, "1", LOGLEVEL); + unlock_ai_mutex(pa, __func__, (char *)"2", LOGLEVEL); + unlock_ji_mutex(pjob, __func__, (char *)"1", LOGLEVEL); return(PBSE_NONE); } - unlock_ji_mutex(pjob, __func__, "2", LOGLEVEL); + unlock_ji_mutex(pjob, __func__, (char *)"2", LOGLEVEL); range = preq->rq_extend; if ((range != NULL) && @@ -581,7 +581,7 @@ int req_releasearray( /* parse the array range */ if ((rc = release_array_range(pa,preq,range)) != 0) { - unlock_ai_mutex(pa, __func__, "3", LOGLEVEL); + unlock_ai_mutex(pa, __func__, (char *)"3", LOGLEVEL); req_reject(rc,0,preq,NULL,NULL); @@ -590,14 +590,14 @@ int req_releasearray( } else if ((rc = release_whole_array(pa,preq)) != 0) { - unlock_ai_mutex(pa, __func__, "4", LOGLEVEL); + unlock_ai_mutex(pa, __func__, (char *)"4", LOGLEVEL); req_reject(rc,0,preq,NULL,NULL); return(PBSE_NONE); } - unlock_ai_mutex(pa, __func__, "5", LOGLEVEL); + unlock_ai_mutex(pa, __func__, (char *)"5", LOGLEVEL); reply_ack(preq); @@ -761,7 +761,7 @@ void process_hold_reply( reply_ack(preq); } - unlock_ji_mutex(pjob, __func__, "1", LOGLEVEL); + unlock_ji_mutex(pjob, __func__, (char *)"1", LOGLEVEL); } /* END process_hold_reply() */ @@ -801,7 +801,7 @@ void process_checkpoint_reply( account_record(PBS_ACCT_CHKPNT, pjob, "Checkpointed"); /* note in accounting file */ reply_ack(preq); - unlock_ji_mutex(pjob, __func__, "1", LOGLEVEL); + unlock_ji_mutex(pjob, __func__, (char *)"1", LOGLEVEL); } } /* END process_checkpoint_reply() */ diff --git a/src/server/req_jobobit.c b/src/server/req_jobobit.c index c914e026dc..b86c35acd1 100644 --- a/src/server/req_jobobit.c +++ b/src/server/req_jobobit.c @@ -667,7 +667,7 @@ int mom_comm( strcpy(jobid, pjob->ji_qs.ji_jobid); - unlock_ji_mutex(pjob, __func__, NULL, 0); + unlock_ji_mutex(pjob, __func__, (char *)NULL, 0); handle = svr_connect( pjob->ji_qs.ji_un.ji_exect.ji_momaddr, @@ -829,7 +829,7 @@ int handle_exiting_or_abort_substate( /* see if job has any dependencies */ if (pjob->ji_wattr[JOB_ATR_depend].at_flags & ATR_VFLAG_SET) { - unlock_ji_mutex(pjob, __func__, "1", LOGLEVEL); + unlock_ji_mutex(pjob, __func__, (char *)"1", LOGLEVEL); depend_on_term(job_id); /* pjob locked on entry, unlocked on exit */ pjob = NULL; } @@ -838,7 +838,7 @@ int handle_exiting_or_abort_substate( ((pjob = svr_find_job(job_id, TRUE)) != NULL)) { svr_setjobstate(pjob,JOB_STATE_EXITING,JOB_SUBSTATE_RETURNSTD, FALSE); - unlock_ji_mutex(pjob, __func__, "1", LOGLEVEL); + unlock_ji_mutex(pjob, __func__, (char *)"1", LOGLEVEL); } return(PBSE_NONE); @@ -875,7 +875,7 @@ int handle_returnstd( job_momaddr = pjob->ji_qs.ji_un.ji_exect.ji_momaddr; if (pjob->ji_wattr[JOB_ATR_exec_host].at_val.at_str == NULL) { - unlock_ji_mutex(pjob, __func__, "1", LOGLEVEL); + unlock_ji_mutex(pjob, __func__, (char *)"1", LOGLEVEL); rc = PBSE_JOB_FILE_CORRUPT; @@ -885,7 +885,7 @@ int handle_returnstd( job_momname = strdup(pjob->ji_wattr[JOB_ATR_exec_host].at_val.at_str); if (job_momname == NULL) { - unlock_ji_mutex(pjob, __func__, "2", LOGLEVEL); + unlock_ji_mutex(pjob, __func__, (char *)"2", LOGLEVEL); rc = PBSE_MEM_MALLOC; @@ -912,12 +912,12 @@ int handle_returnstd( 0); pthread_mutex_unlock(server.sv_attr_mutex); - unlock_queue(pque, __func__, NULL, LOGLEVEL); + unlock_queue(pque, __func__, (char *)NULL, LOGLEVEL); } else if (pjob == NULL) { rc = PBSE_JOBNOTFOUND; - log_err(rc, __func__, "Job lost while acquiring queue 2"); + log_err(rc, __func__, (char *)"Job lost while acquiring queue 2"); goto handle_returnstd_cleanup; } @@ -980,15 +980,15 @@ int handle_returnstd( if ((handle = mom_comm(pjob, on_job_exit_task)) < 0) { - unlock_ji_mutex(pjob, __func__, "3", LOGLEVEL); + unlock_ji_mutex(pjob, __func__, (char *)"3", LOGLEVEL); rc = PBSE_CONNECT; - log_err(rc, __func__, "Job can not make connection to mom"); + log_err(rc, __func__, (char *)"Job can not make connection to mom"); goto handle_returnstd_cleanup; } else { - unlock_ji_mutex(pjob, __func__, "4", LOGLEVEL); + unlock_ji_mutex(pjob, __func__, (char *)"4", LOGLEVEL); if ((rc = issue_Drequest(handle, preq)) != PBSE_NONE) { @@ -1006,7 +1006,7 @@ int handle_returnstd( } else { - unlock_ji_mutex(pjob, __func__, "5", LOGLEVEL); + unlock_ji_mutex(pjob, __func__, (char *)"5", LOGLEVEL); /* we don't need to return files to the server spool, * move on to see if we need to delete files */ @@ -1019,7 +1019,7 @@ int handle_returnstd( } } else - unlock_ji_mutex(pjob, __func__, "6", LOGLEVEL); + unlock_ji_mutex(pjob, __func__, (char *)"6", LOGLEVEL); /* this check is added to allow the case where no files need to be returned to function smoothly */ @@ -1056,7 +1056,7 @@ int handle_returnstd( { svr_setjobstate(pjob, JOB_STATE_EXITING, JOB_SUBSTATE_STAGEOUT, FALSE); - unlock_ji_mutex(pjob, __func__, "7", LOGLEVEL); + unlock_ji_mutex(pjob, __func__, (char *)"7", LOGLEVEL); } handle_returnstd_cleanup: @@ -1088,7 +1088,7 @@ int handle_stageout( char job_fileprefix[PBS_JOBBASE+1]; if (LOGLEVEL >= 10 ) - LOG_EVENT(PBSEVENT_JOB, PBS_EVENTCLASS_JOB, __func__, pjob->ji_qs.ji_jobid); + LOG_EVENT(PBSEVENT_JOB, PBS_EVENTCLASS_JOB, __func__, (char *)pjob->ji_qs.ji_jobid); snprintf(job_id, sizeof(job_id), "%s", pjob->ji_qs.ji_jobid); snprintf(job_fileprefix, sizeof(job_fileprefix), "%s", pjob->ji_qs.ji_fileprefix); @@ -1096,7 +1096,7 @@ int handle_stageout( if (job_momname == NULL) { - unlock_ji_mutex(pjob, __func__, "1", LOGLEVEL); + unlock_ji_mutex(pjob, __func__, (char *)"1", LOGLEVEL); rc = PBSE_MEM_MALLOC; goto handle_stageout_cleanup; @@ -1132,14 +1132,14 @@ int handle_stageout( if ((handle = mom_comm(pjob, on_job_exit_task)) < 0) /* Error */ { - unlock_ji_mutex(pjob, __func__, "2", LOGLEVEL); + unlock_ji_mutex(pjob, __func__, (char *)"2", LOGLEVEL); rc = PBSE_CONNECT; goto handle_stageout_cleanup; } else { - unlock_ji_mutex(pjob, __func__, "3", LOGLEVEL); + unlock_ji_mutex(pjob, __func__, (char *)"3", LOGLEVEL); if ((rc = issue_Drequest(handle, preq)) != PBSE_NONE) { @@ -1159,7 +1159,7 @@ int handle_stageout( } else { - unlock_ji_mutex(pjob, __func__, "4", LOGLEVEL); + unlock_ji_mutex(pjob, __func__, (char *)"4", LOGLEVEL); /* no files to copy, go to next step */ @@ -1168,7 +1168,7 @@ int handle_stageout( } } /* END if (ptask->wt_type != WORK_Deferred_Reply) */ else - unlock_ji_mutex(pjob, __func__, "5", LOGLEVEL); + unlock_ji_mutex(pjob, __func__, (char *)"5", LOGLEVEL); /* place this check so that we just fall through when a file needs to be copied */ if (preq != NULL) @@ -1306,7 +1306,7 @@ int handle_stageout( { svr_setjobstate(pjob, JOB_STATE_EXITING, JOB_SUBSTATE_STAGEDEL, FALSE); - unlock_ji_mutex(pjob, __func__, "7", LOGLEVEL); + unlock_ji_mutex(pjob, __func__, (char *)"7", LOGLEVEL); } handle_stageout_cleanup: @@ -1342,7 +1342,7 @@ int handle_stagedel( char *job_momname = NULL; if (LOGLEVEL >= 10) - LOG_EVENT(PBSEVENT_JOB, PBS_EVENTCLASS_JOB, __func__, pjob->ji_qs.ji_jobid); + LOG_EVENT(PBSEVENT_JOB, PBS_EVENTCLASS_JOB, __func__, (char *)pjob->ji_qs.ji_jobid); strcpy(job_id, pjob->ji_qs.ji_jobid); job_momname = strdup(pjob->ji_wattr[JOB_ATR_exec_host].at_val.at_str); @@ -1369,14 +1369,14 @@ int handle_stagedel( if ((handle = mom_comm(pjob, on_job_exit_task)) < 0) { - unlock_ji_mutex(pjob, __func__, "1", LOGLEVEL); + unlock_ji_mutex(pjob, __func__, (char *)"1", LOGLEVEL); rc = PBSE_CONNECT; goto handle_stagedel_cleanup; } else { - unlock_ji_mutex(pjob, __func__, "2", LOGLEVEL); + unlock_ji_mutex(pjob, __func__, (char *)"2", LOGLEVEL); if (issue_Drequest(handle, preq) != PBSE_NONE) { @@ -1398,10 +1398,10 @@ int handle_stagedel( } } else - unlock_ji_mutex(pjob, __func__, "3", LOGLEVEL); + unlock_ji_mutex(pjob, __func__, (char *)"3", LOGLEVEL); } else - unlock_ji_mutex(pjob, __func__, "4", LOGLEVEL); + unlock_ji_mutex(pjob, __func__, (char *)"4", LOGLEVEL); /* place if here so that jobs without staged files just fall through */ @@ -1444,7 +1444,7 @@ int handle_stagedel( svr_mailowner(pjob, MAIL_OTHER, MAIL_FORCE, log_buf); - unlock_ji_mutex(pjob, __func__, "5", LOGLEVEL); + unlock_ji_mutex(pjob, __func__, (char *)"5", LOGLEVEL); } free_br(preq); @@ -1454,7 +1454,7 @@ int handle_stagedel( { svr_setjobstate(pjob, JOB_STATE_EXITING, JOB_SUBSTATE_EXITED, FALSE); - unlock_ji_mutex(pjob, __func__, "6", LOGLEVEL); + unlock_ji_mutex(pjob, __func__, (char *)"6", LOGLEVEL); } handle_stagedel_cleanup: @@ -1497,13 +1497,13 @@ int handle_exited( if ((handle = mom_comm(pjob, on_job_exit_task)) < 0) { - unlock_ji_mutex(pjob, __func__, "1", LOGLEVEL); + unlock_ji_mutex(pjob, __func__, (char *)"1", LOGLEVEL); return PBSE_CONNECT; } else { - unlock_ji_mutex(pjob, __func__, "2", LOGLEVEL); + unlock_ji_mutex(pjob, __func__, (char *)"2", LOGLEVEL); if ((rc = issue_Drequest(handle, preq)) != PBSE_NONE) { @@ -1520,7 +1520,7 @@ int handle_exited( } } else - unlock_ji_mutex(pjob, __func__, "3", LOGLEVEL); + unlock_ji_mutex(pjob, __func__, (char *)"3", LOGLEVEL); preq = NULL; @@ -1537,7 +1537,7 @@ int handle_exited( { if (check_if_checkpoint_restart_failed(pjob) == TRUE) { - unlock_ji_mutex(pjob, __func__, "4", LOGLEVEL); + unlock_ji_mutex(pjob, __func__, (char *)"4", LOGLEVEL); return(-1); } @@ -1551,15 +1551,15 @@ int handle_exited( { pque->qu_numcompleted++; - unlock_queue(pque, __func__, NULL, LOGLEVEL); + unlock_queue(pque, __func__, (char *)NULL, LOGLEVEL); } else if (pjob == NULL) { - log_err(PBSE_JOBNOTFOUND, __func__, "Job lost while acquiring queue 3"); + log_err(PBSE_JOBNOTFOUND, __func__, (char *)"Job lost while acquiring queue 3"); return(PBSE_JOBNOTFOUND); } - unlock_ji_mutex(pjob, __func__, "5", LOGLEVEL); + unlock_ji_mutex(pjob, __func__, (char *)"5", LOGLEVEL); return(PBSE_NONE); } /* END handle_exited() */ @@ -1577,8 +1577,8 @@ int handle_complete_subjob( int rc = PBSE_NONE; int complete_parent = FALSE; - unlock_ji_mutex(pjob, __func__, NULL, 0); - lock_ji_mutex(parent_job, __func__, NULL, 0); + unlock_ji_mutex(pjob, __func__, (char *)NULL, 0); + lock_ji_mutex(parent_job, __func__, (char *)NULL, 0); if (parent_job->ji_being_recycled == FALSE) { @@ -1587,13 +1587,13 @@ int handle_complete_subjob( else other_subjob = parent_job->ji_cray_clone; - lock_ji_mutex(other_subjob, __func__, NULL, 0); + lock_ji_mutex(other_subjob, __func__, (char *)NULL, 0); if ((other_subjob->ji_being_recycled == TRUE) || (other_subjob->ji_qs.ji_state == JOB_STATE_COMPLETE)) complete_parent = TRUE; - unlock_ji_mutex(other_subjob, __func__, NULL, 0); + unlock_ji_mutex(other_subjob, __func__, (char *)NULL, 0); if (complete_parent == TRUE) { @@ -1614,7 +1614,7 @@ int handle_complete_subjob( } } - unlock_ji_mutex(parent_job, __func__, NULL, 0); + unlock_ji_mutex(parent_job, __func__, (char *)NULL, 0); return(rc); } /* END handle_complete_subjob() */ @@ -1636,7 +1636,7 @@ int handle_complete_first_time( int job_complete = 0; if (LOGLEVEL >= 10) - LOG_EVENT(PBSEVENT_JOB, PBS_EVENTCLASS_JOB, __func__, pjob->ji_qs.ji_jobid); + LOG_EVENT(PBSEVENT_JOB, PBS_EVENTCLASS_JOB, __func__, (char *)pjob->ji_qs.ji_jobid); /* first time in */ if (LOGLEVEL >= 4) @@ -1655,12 +1655,12 @@ int handle_complete_first_time( 0); pthread_mutex_unlock(server.sv_attr_mutex); - unlock_queue(pque, __func__, NULL, LOGLEVEL); + unlock_queue(pque, __func__, (char *)NULL, LOGLEVEL); } else if (pjob == NULL) { /* let the caller know the job is gone */ - log_err(PBSE_JOBNOTFOUND, __func__, "Job lost while acquiring queue 4"); + log_err(PBSE_JOBNOTFOUND, __func__, (char *)"Job lost while acquiring queue 4"); return PBSE_JOBNOTFOUND; } @@ -1739,7 +1739,7 @@ int handle_complete_first_time( job_save(pjob, SAVEJOB_FULL, 0); } - unlock_ji_mutex(pjob, __func__, "2", LOGLEVEL); + unlock_ji_mutex(pjob, __func__, (char *)"2", LOGLEVEL); return(FALSE); } /* END handle_complete_first_time() */ @@ -1755,7 +1755,7 @@ void handle_complete_second_time( { char log_buf[LOCAL_LOG_BUF_SIZE+1]; time_t time_now = time(NULL); - char *job_id = ptask->wt_parm1; + char *job_id = (char *)ptask->wt_parm1; job *pjob; free(ptask->wt_mutex); @@ -1840,14 +1840,14 @@ void on_job_exit( type = WORK_Immed; else { - job_id = preq->rq_extra; + job_id = (char *)preq->rq_extra; preq->rq_extra = NULL; } /* check for calloc errors */ if (job_id == NULL) { - log_err(ENOMEM, __func__, "Cannot allocate memory!"); + log_err(ENOMEM, __func__, (char *)"Cannot allocate memory!"); return; } @@ -1957,12 +1957,12 @@ void on_job_exit( handle_complete_first_time(pjob); else { - struct work_task *ptask = calloc(1, sizeof(struct work_task)); + struct work_task *ptask = (struct work_task *)calloc(1, sizeof(struct work_task)); if (ptask == NULL) return; - if ((ptask->wt_mutex = calloc(1, sizeof(pthread_mutex_t))) == NULL) + if ((ptask->wt_mutex = (pthread_mutex_t *)calloc(1, sizeof(pthread_mutex_t))) == NULL) { free(ptask); return; @@ -1982,7 +1982,7 @@ void on_job_exit( default: - unlock_ji_mutex(pjob, __func__, "1", LOGLEVEL); + unlock_ji_mutex(pjob, __func__, (char *)"1", LOGLEVEL); break; } /* END switch (pjob->ji_qs.ji_substate) */ @@ -2001,7 +2001,7 @@ void *on_job_exit_task( { struct work_task *ptask = (struct work_task *)vp; - char *jobid = ptask->wt_parm1; + char *jobid = (char *)ptask->wt_parm1; free(ptask->wt_mutex); free(ptask); @@ -2022,7 +2022,7 @@ void *on_job_rerun_task( { struct work_task *ptask = (struct work_task *)vp; - char *jobid = ptask->wt_parm1; + char *jobid = (char *)ptask->wt_parm1; free(ptask->wt_mutex); free(ptask); @@ -2075,7 +2075,7 @@ void on_job_rerun( /* check for memory allocation */ if (job_id == NULL) { - log_err(ENOMEM, __func__, "Cannot allocate memory"); + log_err(ENOMEM, __func__, (char *)"Cannot allocate memory"); if (preq != NULL) free_br(preq); return; @@ -2095,7 +2095,7 @@ void on_job_rerun( if ((handle = mom_comm(pjob, on_job_rerun_task)) < 0) { - unlock_ji_mutex(pjob, __func__, "1", LOGLEVEL); + unlock_ji_mutex(pjob, __func__, (char *)"1", LOGLEVEL); if (preq != NULL) free_br(preq); @@ -2125,7 +2125,7 @@ void on_job_rerun( if ((preq = alloc_br(PBS_BATCH_Rerun)) == NULL) { - unlock_ji_mutex(pjob, __func__, "3", LOGLEVEL); + unlock_ji_mutex(pjob, __func__, (char *)"3", LOGLEVEL); return; } @@ -2134,7 +2134,7 @@ void on_job_rerun( preq->rq_extra = strdup(pjob->ji_qs.ji_jobid); job_id = strdup(pjob->ji_qs.ji_jobid); - unlock_ji_mutex(pjob, __func__, "4", LOGLEVEL); + unlock_ji_mutex(pjob, __func__, (char *)"4", LOGLEVEL); if (issue_Drequest(handle, preq) != PBSE_NONE) { @@ -2374,7 +2374,7 @@ void on_job_rerun( { strcpy(preq->rq_ind.rq_delete.rq_objname, pjob->ji_qs.ji_jobid); job_id = strdup(pjob->ji_qs.ji_jobid); - unlock_ji_mutex(pjob, __func__, "9", LOGLEVEL); + unlock_ji_mutex(pjob, __func__, (char *)"9", LOGLEVEL); rc = issue_Drequest(handle, preq); @@ -2436,7 +2436,7 @@ void on_job_rerun( break; } /* END switch (pjob->ji_qs.ji_substate) */ - unlock_ji_mutex(pjob, __func__, "10", LOGLEVEL); + unlock_ji_mutex(pjob, __func__, (char *)"10", LOGLEVEL); return; } /* END on_job_rerun() */ @@ -2456,7 +2456,7 @@ static void wait_for_send( struct work_task *ptask) { - batch_request *preq = get_remove_batch_request(ptask->wt_parm1); + batch_request *preq = (batch_request *)get_remove_batch_request(ptask->wt_parm1); if (preq != NULL) req_jobobit(preq); @@ -2917,7 +2917,7 @@ int req_jobobit( log_err(rc, job_id, log_buf); if (pjob != NULL) - unlock_ji_mutex(pjob, __func__, "1", LOGLEVEL); + unlock_ji_mutex(pjob, __func__, (char *)"1", LOGLEVEL); free(tmp); @@ -2928,7 +2928,7 @@ int req_jobobit( if (pjob->ji_qs.ji_state == JOB_STATE_COMPLETE) { - unlock_ji_mutex(pjob, __func__, "2", LOGLEVEL); + unlock_ji_mutex(pjob, __func__, (char *)"2", LOGLEVEL); reply_ack(preq); return(PBSE_BADSTATE); @@ -2962,7 +2962,7 @@ int req_jobobit( rc = PBSE_BADSTATE; } - unlock_ji_mutex(pjob, __func__, "3", LOGLEVEL); + unlock_ji_mutex(pjob, __func__, (char *)"3", LOGLEVEL); req_reject(rc, 0, preq, NULL, NULL); @@ -2976,7 +2976,7 @@ int req_jobobit( ptask = set_task(WORK_Timed, time_now + 1, wait_for_send, (void *)preq, FALSE); - unlock_ji_mutex(pjob, __func__, "4", LOGLEVEL); + unlock_ji_mutex(pjob, __func__, (char *)"4", LOGLEVEL); if (ptask == NULL) req_reject(PBSE_SYSTEM, 0, preq, NULL, NULL); @@ -3016,7 +3016,7 @@ int req_jobobit( PBSEVENT_ERROR | PBSEVENT_JOB, PBS_EVENTCLASS_JOB, job_id, - "obit received - updating final job usage info"); + (char *)"obit received - updating final job usage info"); } modify_job_attr( @@ -3065,7 +3065,7 @@ int req_jobobit( log_event(PBSEVENT_DEBUG, PBS_EVENTCLASS_REQUEST, __func__, log_buf); - unlock_ji_mutex(pjob, __func__, "5", LOGLEVEL); + unlock_ji_mutex(pjob, __func__, (char *)"5", LOGLEVEL); req_reject(PBSE_SYSTEM, 0, preq, NULL, NULL); return(PBSE_SYSTEM); @@ -3202,7 +3202,7 @@ int req_jobobit( PBSEVENT_JOB_USAGE | PBSEVENT_JOB_USAGE, PBS_EVENTCLASS_JOB, job_id, - "received JOB_EXEC_INITRST, setting job CHECKPOINT_FLAG flag"); + (char *)"received JOB_EXEC_INITRST, setting job CHECKPOINT_FLAG flag"); } rel_resc(pjob); @@ -3216,7 +3216,7 @@ int req_jobobit( close_conn(pjob->ji_momhandle, FALSE); pjob->ji_momhandle = -1; - unlock_ji_mutex(pjob, __func__, "6", LOGLEVEL); + unlock_ji_mutex(pjob, __func__, (char *)"6", LOGLEVEL); return(PBSE_SYSTEM); @@ -3308,12 +3308,12 @@ int req_jobobit( job_atr_hold = pjob->ji_wattr[JOB_ATR_hold].at_val.at_long; job_exit_status = pjob->ji_qs.ji_un.ji_exect.ji_exitstat; - unlock_ji_mutex(pjob, __func__, "7", LOGLEVEL); + unlock_ji_mutex(pjob, __func__, (char *)"7", LOGLEVEL); update_array_values(pa, JOB_STATE_RUNNING, aeTerminate, job_id, job_atr_hold, job_exit_status); - unlock_ai_mutex(pa, __func__, "1", LOGLEVEL); + unlock_ai_mutex(pa, __func__, (char *)"1", LOGLEVEL); pjob = svr_find_job(job_id, TRUE); if (pjob == NULL) return(PBSE_UNKJOBID); @@ -3326,7 +3326,7 @@ int req_jobobit( PBSEVENT_ERROR | PBSEVENT_JOB, PBS_EVENTCLASS_JOB, job_id, - "on_job_exit task assigned to job"); + (char *)"on_job_exit task assigned to job"); } /* remove checkpoint restart file if there is one */ @@ -3363,10 +3363,10 @@ int req_jobobit( PBSEVENT_ERROR | PBSEVENT_JOB, PBS_EVENTCLASS_JOB, job_id, - "req_jobobit completed"); + (char *)"req_jobobit completed"); } - unlock_ji_mutex(pjob, __func__, "9", LOGLEVEL); + unlock_ji_mutex(pjob, __func__, (char *)"9", LOGLEVEL); if (rerunning_job == FALSE) { diff --git a/src/server/req_locate.c b/src/server/req_locate.c index a8273a4631..14d6975996 100644 --- a/src/server/req_locate.c +++ b/src/server/req_locate.c @@ -137,7 +137,7 @@ int req_locatejob( if (pjob) { - unlock_ji_mutex(pjob, __func__, "1", LOGLEVEL); + unlock_ji_mutex(pjob, __func__, (char *)"1", LOGLEVEL); location = server_name; } diff --git a/src/server/req_manager.c b/src/server/req_manager.c index 84d81cb86a..8bc98612e8 100644 --- a/src/server/req_manager.c +++ b/src/server/req_manager.c @@ -974,7 +974,7 @@ void mgr_queue_create( if ((pque = find_queuebyname(preq->rq_ind.rq_manager.rq_objname))) { - unlock_queue(pque, "mgr_queue_create", "fail", LOGLEVEL); + unlock_queue(pque, "mgr_queue_create", (char *)"fail", LOGLEVEL); req_reject(PBSE_QUEEXIST, 0, preq, NULL, NULL); return; } @@ -1031,7 +1031,7 @@ void mgr_queue_create( reply_ack(preq); } - unlock_queue(pque, "mgr_queue_create", "success", LOGLEVEL); + unlock_queue(pque, "mgr_queue_create", (char *)"success", LOGLEVEL); } return; @@ -1070,7 +1070,7 @@ void mgr_queue_delete( if ((rc = que_purge(pque)) != PBSE_NONE) { /* FAILURE */ - unlock_queue(pque, __func__, "", LOGLEVEL); + unlock_queue(pque, __func__, (char *)"", LOGLEVEL); req_reject(rc, 0, preq, NULL, NULL); return; } @@ -1468,7 +1468,7 @@ void mgr_queue_set( if (rc != 0) { - unlock_queue(pque, "mgr_queue_set", "fail badattr", LOGLEVEL); + unlock_queue(pque, "mgr_queue_set", (char *)"fail badattr", LOGLEVEL); reply_badattr(rc, bad, plist, preq); return; } @@ -1480,7 +1480,7 @@ void mgr_queue_set( if (allques == FALSE) break; - unlock_queue(pque, "mgr_queue_set", "before next_queue call", LOGLEVEL); + unlock_queue(pque, "mgr_queue_set", (char *)"before next_queue call", LOGLEVEL); pque = next_queue(&svr_queues,&iter); } /* END while (pque != NULL) */ @@ -1496,12 +1496,12 @@ void mgr_queue_set( if ((badattr = check_que_attr(pque)) != NULL) { sprintf(log_buf, msg_attrtype, pque->qu_qs.qu_name, badattr); - unlock_queue(pque, "mgr_queue_set", "attrtype", LOGLEVEL); + unlock_queue(pque, "mgr_queue_set", (char *)"attrtype", LOGLEVEL); reply_text(preq, PBSE_ATTRTYPE, log_buf); return; } - unlock_queue(pque, "mgr_queue_set", "last loop before next_queue", LOGLEVEL); + unlock_queue(pque, "mgr_queue_set", (char *)"last loop before next_queue", LOGLEVEL); if (allques == FALSE) break; @@ -1577,7 +1577,7 @@ void mgr_queue_unset( if (rc != 0) { - unlock_queue(pque, "mgr_queue_unset", "badattr", LOGLEVEL); + unlock_queue(pque, "mgr_queue_unset", (char *)"badattr", LOGLEVEL); reply_badattr(rc, bad_attr, plist, preq); return; } @@ -1589,7 +1589,7 @@ void mgr_queue_unset( if ((pque->qu_attr[QA_ATR_QType].at_flags & ATR_VFLAG_SET) == 0) pque->qu_qs.qu_type = QTYPE_Unset; - unlock_queue(pque, "mgr_queue_unset", "success", LOGLEVEL); + unlock_queue(pque, "mgr_queue_unset", (char *)"success", LOGLEVEL); if (allques == FALSE) break; @@ -2401,7 +2401,7 @@ int extra_resc_chk( { /* Is there anything to validate? Maybe check for all alphanum? */ /* the new resource is at pattr->at_val.at_str */ - set_task(WORK_Immed, 0, on_extra_resc, NULL, FALSE); + set_task(WORK_Immed, 0, on_extra_resc, (char *)NULL, FALSE); return(TRUE); } @@ -2415,7 +2415,7 @@ void free_extraresc( pbs_attribute *attr) { - set_task(WORK_Immed, 0, on_extra_resc, NULL, FALSE); + set_task(WORK_Immed, 0, on_extra_resc, (char *)NULL, FALSE); free_arst(attr); } diff --git a/src/server/req_manager.h b/src/server/req_manager.h index 73d740d6f1..091331f0fb 100644 --- a/src/server/req_manager.h +++ b/src/server/req_manager.h @@ -62,6 +62,6 @@ int schiter_chk(pbs_attribute *pattr, void *pobject, int actmode); int nextjobnum_chk(pbs_attribute *pattr, void *pobject, int actmode); -int set_nextjobnum(struct pbs_attribute *attr, struct pbs_attribute *new, enum batch_op op); +int set_nextjobnum(struct pbs_attribute *attr, struct pbs_attribute *new_attr, enum batch_op op); #endif /* _REQ_MANAGER_H */ diff --git a/src/server/req_message.c b/src/server/req_message.c index 86e5c94a3a..c553a94fde 100644 --- a/src/server/req_message.c +++ b/src/server/req_message.c @@ -140,7 +140,7 @@ void *req_messagejob( { req_reject(PBSE_BADSTATE, 0, preq, NULL, NULL); - unlock_ji_mutex(pjob, __func__, "1", LOGLEVEL); + unlock_ji_mutex(pjob, __func__, (char *)"1", LOGLEVEL); return(NULL); } @@ -165,7 +165,7 @@ void *req_messagejob( /* After MOM acts and replies to us, we pick up in post_message_req() */ if (pjob != NULL) - unlock_ji_mutex(pjob, __func__, "2", LOGLEVEL); + unlock_ji_mutex(pjob, __func__, (char *)"2", LOGLEVEL); return(NULL); } /* END req_messagejob() */ diff --git a/src/server/req_modify.c b/src/server/req_modify.c index ee9b5d89da..90a2d6d314 100644 --- a/src/server/req_modify.c +++ b/src/server/req_modify.c @@ -195,7 +195,7 @@ void post_modify_req( log_event(PBSEVENT_JOB,PBS_EVENTCLASS_JOB,pjob->ji_qs.ji_jobid,log_buf); } - unlock_ji_mutex(pjob, __func__, "1", LOGLEVEL); + unlock_ji_mutex(pjob, __func__, (char *)"1", LOGLEVEL); } } @@ -233,7 +233,7 @@ void mom_cleanup_checkpoint_hold( if (jobid == NULL) { - log_err(ENOMEM, __func__, "Cannot allocate memory"); + log_err(ENOMEM, __func__, (char *)"Cannot allocate memory"); return; } @@ -272,7 +272,7 @@ void mom_cleanup_checkpoint_hold( { if ((preq = alloc_br(PBS_BATCH_DeleteJob)) == NULL) { - log_err(-1, __func__, "unable to allocate DeleteJob request - big trouble!"); + log_err(-1, __func__, (char *)"unable to allocate DeleteJob request - big trouble!"); } else { @@ -289,7 +289,7 @@ void mom_cleanup_checkpoint_hold( log_err(rc, __func__, log_buf); - unlock_ji_mutex(pjob, __func__, "1", LOGLEVEL); + unlock_ji_mutex(pjob, __func__, (char *)"1", LOGLEVEL); } free_br(preq); @@ -316,7 +316,7 @@ void mom_cleanup_checkpoint_hold( } if (pjob != NULL) - unlock_ji_mutex(pjob, __func__, "2", LOGLEVEL); + unlock_ji_mutex(pjob, __func__, (char *)"2", LOGLEVEL); } /* END mom_cleanup_checkpoint_hold() */ @@ -618,7 +618,7 @@ int modify_job( if (pjob != NULL) { strcpy(jobid, pjob->ji_qs.ji_jobid); - unlock_ji_mutex(pjob, __func__, "2", LOGLEVEL); + unlock_ji_mutex(pjob, __func__, (char *)"2", LOGLEVEL); } post_modify_req(dup_req); @@ -667,7 +667,7 @@ int modify_job( } else { - log_err(-1, __func__, "Failed to get batch request"); + log_err(-1, __func__, (char *)"Failed to get batch request"); } } @@ -886,7 +886,7 @@ int modify_whole_array( rc = copy_batchrequest(&array_req, preq, 0, i); if (rc != 0) { - unlock_ji_mutex(pjob, __func__, "1", LOGLEVEL); + unlock_ji_mutex(pjob, __func__, (char *)"1", LOGLEVEL); return(rc); } @@ -908,7 +908,7 @@ int modify_whole_array( "Unable to relay information to mom for job '%s'\n", pjob->ji_qs.ji_jobid); log_err(rc, __func__, log_buf); - unlock_ji_mutex(pjob, __func__, "2", LOGLEVEL); + unlock_ji_mutex(pjob, __func__, (char *)"2", LOGLEVEL); } return(rc); /* unable to get to MOM */ @@ -917,7 +917,7 @@ int modify_whole_array( { if (pjob != NULL) { - unlock_ji_mutex(pjob, __func__, "3", LOGLEVEL); + unlock_ji_mutex(pjob, __func__, (char *)"3", LOGLEVEL); pjob = NULL; } @@ -926,7 +926,7 @@ int modify_whole_array( } if (pjob != NULL) - unlock_ji_mutex(pjob, __func__, "3", LOGLEVEL); + unlock_ji_mutex(pjob, __func__, (char *)"3", LOGLEVEL); } } /* END foreach job in array */ @@ -1014,7 +1014,7 @@ void *modify_array_work( if ((rc != 0) && (rc != PBSE_RELAYED_TO_MOM)) { - unlock_ai_mutex(pa, __func__, "1", LOGLEVEL); + unlock_ai_mutex(pa, __func__, (char *)"1", LOGLEVEL); req_reject(PBSE_IVALREQ,0,preq,NULL,"Error reading array range"); return(NULL); } @@ -1024,7 +1024,7 @@ void *modify_array_work( if (rc == PBSE_RELAYED_TO_MOM) { - unlock_ai_mutex(pa, __func__, "2", LOGLEVEL); + unlock_ai_mutex(pa, __func__, (char *)"2", LOGLEVEL); return(NULL); } } @@ -1035,7 +1035,7 @@ void *modify_array_work( if ((rc != 0) && (rc != PBSE_RELAYED_TO_MOM)) { - unlock_ai_mutex(pa, __func__, "1", LOGLEVEL); + unlock_ai_mutex(pa, __func__, (char *)"1", LOGLEVEL); req_reject(PBSE_IVALREQ,0,preq,NULL,"Error altering the array"); return(NULL); } @@ -1054,8 +1054,8 @@ void *modify_array_work( If either of these fail, return the error. This makes it so some elements fo the array will be updated but others are not. But at least the user will know something went wrong.*/ - unlock_ai_mutex(pa, __func__, "1", LOGLEVEL); - unlock_ji_mutex(pjob, __func__, "1", LOGLEVEL); + unlock_ai_mutex(pa, __func__, (char *)"1", LOGLEVEL); + unlock_ji_mutex(pjob, __func__, (char *)"1", LOGLEVEL); req_reject(rc,0,preq,NULL,NULL); return(NULL); @@ -1063,17 +1063,17 @@ void *modify_array_work( if (rc == PBSE_RELAYED_TO_MOM) { - unlock_ai_mutex(pa, __func__, "1", LOGLEVEL); - unlock_ji_mutex(pjob, __func__, "2", LOGLEVEL); + unlock_ai_mutex(pa, __func__, (char *)"1", LOGLEVEL); + unlock_ji_mutex(pjob, __func__, (char *)"2", LOGLEVEL); return(NULL); } - unlock_ji_mutex(pjob, __func__, "3", LOGLEVEL); + unlock_ji_mutex(pjob, __func__, (char *)"3", LOGLEVEL); } /* SUCCESS */ - unlock_ai_mutex(pa, __func__, "4", LOGLEVEL); + unlock_ai_mutex(pa, __func__, (char *)"4", LOGLEVEL); reply_ack(preq); @@ -1105,7 +1105,7 @@ void *req_modifyarray( return(NULL); } - unlock_ai_mutex(pa, __func__, "4", LOGLEVEL); + unlock_ai_mutex(pa, __func__, (char *)"4", LOGLEVEL); /* If async modify, reply now; otherwise reply is handled later */ if (preq->rq_type == PBS_BATCH_AsyModifyJob) @@ -1166,7 +1166,7 @@ void *modify_job_work( } else if ( rc == PBSE_RELAYED_TO_MOM ) { - unlock_ji_mutex(pjob, __func__, "2", LOGLEVEL); + unlock_ji_mutex(pjob, __func__, (char *)"2", LOGLEVEL); return(NULL); } @@ -1176,7 +1176,7 @@ void *modify_job_work( else reply_ack(preq); - unlock_ji_mutex(pjob, __func__, "3", LOGLEVEL); + unlock_ji_mutex(pjob, __func__, (char *)"3", LOGLEVEL); return(NULL); } /* END modify_job_work() */ @@ -1216,12 +1216,12 @@ void *req_modifyjob( reply_ack(preq); /* SUCCESS */ - unlock_ji_mutex(pjob, __func__, "1", LOGLEVEL); + unlock_ji_mutex(pjob, __func__, (char *)"1", LOGLEVEL); return(NULL); } - unlock_ji_mutex(pjob, __func__, "2", LOGLEVEL); + unlock_ji_mutex(pjob, __func__, (char *)"2", LOGLEVEL); /* If async modify, reply now; otherwise reply is handled later */ if (preq->rq_type == PBS_BATCH_AsyModifyJob) @@ -1269,7 +1269,7 @@ int modify_job_attr( if (pque->qu_qs.qu_type != QTYPE_Execution) allow_unkn = JOB_ATR_UNKN; - unlock_queue(pque, __func__, NULL, LOGLEVEL); + unlock_queue(pque, __func__, (char *)NULL, LOGLEVEL); } else if (pjob->ji_parent_job != NULL) { @@ -1277,7 +1277,7 @@ int modify_job_attr( } else { - log_err(PBSE_JOBNOTFOUND, __func__, "Job lost while acquiring queue 5"); + log_err(PBSE_JOBNOTFOUND, __func__, (char *)"Job lost while acquiring queue 5"); return(PBSE_JOBNOTFOUND); } @@ -1329,11 +1329,11 @@ int modify_job_attr( if ((pque = get_jobs_queue(&pjob)) != NULL) { rc = chk_resc_limits( &newattr[JOB_ATR_resource], pque, NULL); - unlock_queue(pque, __func__, NULL, LOGLEVEL); + unlock_queue(pque, __func__, (char *)NULL, LOGLEVEL); } else if (pjob == NULL) { - log_err(PBSE_JOBNOTFOUND, __func__, "Job lost while acquiring queue 6"); + log_err(PBSE_JOBNOTFOUND, __func__, (char *)"Job lost while acquiring queue 6"); return(PBSE_JOBNOTFOUND); } else @@ -1562,7 +1562,7 @@ void post_modify_arrayreq( log_event(PBSEVENT_JOB,PBS_EVENTCLASS_JOB,pjob->ji_qs.ji_jobid,log_buf); } - unlock_ji_mutex(pjob, __func__, "1", LOGLEVEL); + unlock_ji_mutex(pjob, __func__, (char *)"1", LOGLEVEL); } } diff --git a/src/server/req_movejob.c b/src/server/req_movejob.c index e77e7238a8..b6855094cc 100644 --- a/src/server/req_movejob.c +++ b/src/server/req_movejob.c @@ -152,7 +152,7 @@ int req_movejob( req_reject(PBSE_BADSTATE, 0, req, NULL, NULL); - unlock_ji_mutex(jobp, __func__, "1", LOGLEVEL); + unlock_ji_mutex(jobp, __func__, (char *)"1", LOGLEVEL); return(PBSE_NONE); } @@ -172,7 +172,7 @@ int req_movejob( { log_event(PBSEVENT_JOB, PBS_EVENTCLASS_JOB, __func__, log_buf); } - unlock_ji_mutex(jobp, __func__, "2", LOGLEVEL); + unlock_ji_mutex(jobp, __func__, (char *)"2", LOGLEVEL); req_reject(PBSE_JOB_ALREADY_IN_QUEUE, 0, req, NULL, log_buf); return(PBSE_NONE); } @@ -215,7 +215,7 @@ int req_movejob( break; } /* END switch (svr_movejob(jobp,req->rq_ind.rq_move.rq_destin,req)) */ - unlock_ji_mutex(jobp, __func__, "1", LOGLEVEL); + unlock_ji_mutex(jobp, __func__, (char *)"1", LOGLEVEL); return(PBSE_NONE); } /* END req_movejob() */ @@ -276,8 +276,8 @@ int req_orderjob( req_reject(PBSE_BADSTATE, 0, req, NULL, NULL); - unlock_ji_mutex(pjob1, __func__, "1", LOGLEVEL); - unlock_ji_mutex(pjob2, __func__, "2", LOGLEVEL); + unlock_ji_mutex(pjob1, __func__, (char *)"1", LOGLEVEL); + unlock_ji_mutex(pjob2, __func__, (char *)"2", LOGLEVEL); return(PBSE_NONE); } @@ -297,7 +297,7 @@ int req_orderjob( { if ((rc = svr_chkque(pjob1, pque2, get_variable(pjob1, pbs_o_host), MOVE_TYPE_Order, NULL)) == PBSE_NONE) { - unlock_queue(pque2, "req_orderjob", "pque2 svr_chkque pass", LOGLEVEL); + unlock_queue(pque2, "req_orderjob", (char *)"pque2 svr_chkque pass", LOGLEVEL); if ((pque1 = get_jobs_queue(&pjob1)) == NULL) { rc = PBSE_BADSTATE; @@ -308,11 +308,11 @@ int req_orderjob( { ok = TRUE; } - unlock_queue(pque1, "req_orderjob", "pque1", LOGLEVEL); + unlock_queue(pque1, "req_orderjob", (char *)"pque1", LOGLEVEL); } } else - unlock_queue(pque2, "req_orderjob", "pque2 svr_chkque fail", LOGLEVEL); + unlock_queue(pque2, "req_orderjob", (char *)"pque2 svr_chkque fail", LOGLEVEL); } if (ok == FALSE) @@ -320,9 +320,9 @@ int req_orderjob( req_reject(rc, 0, req, NULL, NULL); if (pjob1 != NULL) - unlock_ji_mutex(pjob1, __func__, "3", LOGLEVEL); + unlock_ji_mutex(pjob1, __func__, (char *)"3", LOGLEVEL); if (pjob2 != NULL) - unlock_ji_mutex(pjob2, __func__, "4", LOGLEVEL); + unlock_ji_mutex(pjob2, __func__, (char *)"4", LOGLEVEL); return(PBSE_NONE); } @@ -344,8 +344,8 @@ int req_orderjob( strcpy(pjob2->ji_qs.ji_queue, tmpqn); strcpy(job_id1, pjob1->ji_qs.ji_jobid); strcpy(job_id2, pjob2->ji_qs.ji_jobid); - unlock_ji_mutex(pjob1, __func__, "5", LOGLEVEL); - unlock_ji_mutex(pjob2, __func__, "6", LOGLEVEL); + unlock_ji_mutex(pjob1, __func__, (char *)"5", LOGLEVEL); + unlock_ji_mutex(pjob2, __func__, (char *)"6", LOGLEVEL); svr_dequejob(job_id1, FALSE); svr_dequejob(job_id2, FALSE); @@ -362,7 +362,7 @@ int req_orderjob( { swap_jobs(pque1->qu_jobs,pjob1,pjob2); swap_jobs(NULL,pjob1,pjob2); - unlock_queue(pque1, "req_orderjob", "pque1 after swap", LOGLEVEL); + unlock_queue(pque1, "req_orderjob", (char *)"pque1 after swap", LOGLEVEL); } } @@ -370,13 +370,13 @@ int req_orderjob( if (pjob1 != NULL) { job_save(pjob1, SAVEJOB_FULL, 0); - unlock_ji_mutex(pjob1, __func__, "7", LOGLEVEL); + unlock_ji_mutex(pjob1, __func__, (char *)"7", LOGLEVEL); } if (pjob2 != NULL) { job_save(pjob2, SAVEJOB_FULL, 0); - unlock_ji_mutex(pjob2, __func__, "8", LOGLEVEL); + unlock_ji_mutex(pjob2, __func__, (char *)"8", LOGLEVEL); } /* SUCCESS */ diff --git a/src/server/req_quejob.c b/src/server/req_quejob.c index 3c2b1420f0..685dd92a26 100644 --- a/src/server/req_quejob.c +++ b/src/server/req_quejob.c @@ -619,7 +619,7 @@ int req_quejob( if (!strcmp(pj->ji_qs.ji_jobid, jid)) break; - unlock_ji_mutex(pj, __func__, "1", LOGLEVEL); + unlock_ji_mutex(pj, __func__, (char *)"1", LOGLEVEL); } } @@ -630,7 +630,7 @@ int req_quejob( rc = PBSE_JOBEXIST; log_err(rc, __func__, "cannot queue new job, job already exists"); req_reject(rc, 0, preq, NULL, NULL); - unlock_ji_mutex(pj, __func__, "2", LOGLEVEL); + unlock_ji_mutex(pj, __func__, (char *)"2", LOGLEVEL); return rc; } @@ -952,7 +952,7 @@ int req_quejob( /* make sure the job id doesn't already exist */ if ((tmpjob = svr_find_job(tmp_job_id, FALSE)) != NULL) { - unlock_ji_mutex(tmpjob, __func__, "3", LOGLEVEL); + unlock_ji_mutex(tmpjob, __func__, (char *)"3", LOGLEVEL); /* not unique, reject job */ svr_job_purge(pj); @@ -1194,9 +1194,9 @@ int req_quejob( * set any "unspecified" checkpoint with queue default values, if any */ - lock_queue(pque, __func__, "locking for set_chkpt_deflt", LOGLEVEL); + lock_queue(pque, __func__, (char *)"locking for set_chkpt_deflt", LOGLEVEL); set_chkpt_deflt(pj, pque); - unlock_queue(pque, __func__, "unlocking for set_chkpt_deflt", LOGLEVEL); + unlock_queue(pque, __func__, (char *)"unlocking for set_chkpt_deflt", LOGLEVEL); /* If queue has checkpoint directory name specified, propagate it to the job. */ @@ -1389,15 +1389,15 @@ int req_quejob( free(oldid); } - lock_queue(pque, __func__, "lock for svr_chkque", LOGLEVEL); + lock_queue(pque, __func__, (char *)"lock for svr_chkque", LOGLEVEL); if ((rc = svr_chkque(pj, pque, preq->rq_host, MOVE_TYPE_Move, EMsg))) { - unlock_queue(pque, __func__, "can not move", LOGLEVEL); + unlock_queue(pque, __func__, (char *)"can not move", LOGLEVEL); svr_job_purge(pj); req_reject(rc, 0, preq, NULL, EMsg); return(rc); } - unlock_queue(pque, __func__, "unlock for svr_chkque", LOGLEVEL); + unlock_queue(pque, __func__, (char *)"unlock for svr_chkque", LOGLEVEL); /* FIXME: if EMsg[0] != '\0', send a warning email to the user */ @@ -1439,7 +1439,7 @@ int req_quejob( insert_job(&newjobs,pj); *pjob_id = strdup(pj->ji_qs.ji_jobid); - unlock_ji_mutex(pj, __func__, "4", LOGLEVEL); + unlock_ji_mutex(pj, __func__, (char *)"4", LOGLEVEL); return rc; } /* END req_quejob() */ @@ -1476,12 +1476,12 @@ int req_jobcredential( { rc = PBSE_PERM; req_reject(rc, 0, preq, NULL, "job request not authorized"); - unlock_ji_mutex(pj, __func__, "1", LOGLEVEL); + unlock_ji_mutex(pj, __func__, (char *)"1", LOGLEVEL); return rc; } reply_ack(preq); - unlock_ji_mutex(pj, __func__, "2", LOGLEVEL); + unlock_ji_mutex(pj, __func__, (char *)"2", LOGLEVEL); return rc; } /* END req_jobcredential() */ @@ -1543,7 +1543,7 @@ int req_jobscript( } log_err(rc, __func__, log_buf); req_reject(rc, 0, preq, NULL, log_buf); - unlock_ji_mutex(pj, __func__, "1", LOGLEVEL); + unlock_ji_mutex(pj, __func__, (char *)"1", LOGLEVEL); return(rc); } @@ -1555,7 +1555,7 @@ int req_jobscript( preq->rq_ind.rq_jobfile.rq_jobid, errno, strerror(errno)); log_err(rc, __func__, log_buf); req_reject(rc, 0, preq, NULL, log_buf); - unlock_ji_mutex(pj, __func__, "2", LOGLEVEL); + unlock_ji_mutex(pj, __func__, (char *)"2", LOGLEVEL); return rc; } @@ -1582,7 +1582,7 @@ int req_jobscript( msg_script_open); log_err(rc, __func__, log_buf); req_reject(rc, 0, preq, NULL, log_buf); - unlock_ji_mutex(pj, __func__, "3", LOGLEVEL); + unlock_ji_mutex(pj, __func__, (char *)"3", LOGLEVEL); return rc; } @@ -1600,7 +1600,7 @@ int req_jobscript( log_err(rc, __func__, log_buf); req_reject(PBSE_INTERNAL, 0, preq, NULL, log_buf); close(fds); - unlock_ji_mutex(pj, __func__, "4", LOGLEVEL); + unlock_ji_mutex(pj, __func__, (char *)"4", LOGLEVEL); return rc; } @@ -1614,7 +1614,7 @@ int req_jobscript( (pj->ji_qs.ji_svrflags & ~JOB_SVFLG_CHECKPOINT_FILE) | JOB_SVFLG_SCRIPT; /* SUCCESS */ - unlock_ji_mutex(pj, __func__, "5", LOGLEVEL); + unlock_ji_mutex(pj, __func__, (char *)"5", LOGLEVEL); reply_ack(preq); @@ -1659,7 +1659,7 @@ int req_mvjobfile( log_err(rc, __func__, log_buf); req_reject(rc, 0, preq, NULL, NULL); if (pj != NULL) - unlock_ji_mutex(pj, __func__, "1", LOGLEVEL); + unlock_ji_mutex(pj, __func__, (char *)"1", LOGLEVEL); return(rc); } @@ -1693,7 +1693,7 @@ int req_mvjobfile( pj->ji_qs.ji_jobid, errno, strerror(errno)); log_err(rc, __func__, log_buf); req_reject(rc, 0, preq, NULL, log_buf); - unlock_ji_mutex(pj, __func__, "2", LOGLEVEL); + unlock_ji_mutex(pj, __func__, (char *)"2", LOGLEVEL); return(rc); break; } @@ -1714,7 +1714,7 @@ int req_mvjobfile( namebuf, pj->ji_qs.ji_jobid, errno, strerror(errno), msg_script_open); log_err(errno, __func__, log_buf); req_reject(rc, 0, preq, NULL, log_buf); - unlock_ji_mutex(pj, __func__, "3", LOGLEVEL); + unlock_ji_mutex(pj, __func__, (char *)"3", LOGLEVEL); return(rc); } @@ -1730,7 +1730,7 @@ int req_mvjobfile( log_err(rc, "req_jobfile", log_buf); req_reject(PBSE_SYSTEM, 0, preq, NULL, log_buf); close(fds); - unlock_ji_mutex(pj, __func__, "4", LOGLEVEL); + unlock_ji_mutex(pj, __func__, (char *)"4", LOGLEVEL); return(rc); } @@ -1752,7 +1752,7 @@ int req_mvjobfile( reply_ack(preq); - unlock_ji_mutex(pj, __func__, "5", LOGLEVEL); + unlock_ji_mutex(pj, __func__, (char *)"5", LOGLEVEL); return(rc); } /* END req_mvjobfile() */ @@ -1815,7 +1815,7 @@ int req_rdytocommit( preq->rq_ind.rq_rdytocommit, errno, strerror(errno)); log_err(rc, __func__, log_buf); req_reject(rc, 0, preq, NULL, log_buf); - unlock_ji_mutex(pj, __func__, "1", LOGLEVEL); + unlock_ji_mutex(pj, __func__, (char *)"1", LOGLEVEL); return(rc); } @@ -1825,7 +1825,7 @@ int req_rdytocommit( snprintf(log_buf, LOCAL_LOG_BUF_SIZE, "can not authorize job req %s", preq->rq_ind.rq_rdytocommit); req_reject(rc, 0, preq, NULL, log_buf); - unlock_ji_mutex(pj, __func__, "2", LOGLEVEL); + unlock_ji_mutex(pj, __func__, (char *)"2", LOGLEVEL); return(rc); } @@ -1873,7 +1873,7 @@ int req_rdytocommit( pj->ji_wattr[JOB_ATR_state].at_flags = OrigFlags; req_reject(rc, 0, preq, NULL, log_buf); - unlock_ji_mutex(pj, __func__, "3", LOGLEVEL); + unlock_ji_mutex(pj, __func__, (char *)"3", LOGLEVEL); return(rc); } @@ -1881,7 +1881,7 @@ int req_rdytocommit( strcpy(jobid, pj->ji_qs.ji_jobid); /* unlock now to prevent a potential deadlock */ - unlock_ji_mutex(pj, __func__, "4", LOGLEVEL); + unlock_ji_mutex(pj, __func__, (char *)"4", LOGLEVEL); if (reply_jobid(preq, jobid, BATCH_REPLY_CHOICE_RdytoCom) != 0) { @@ -2041,7 +2041,7 @@ int req_commit( errno, strerror(errno)); log_err(rc, __func__, log_buf); req_reject(PBSE_IVALREQ, 0, preq, NULL, log_buf); - unlock_ji_mutex(pj, __func__, "5", LOGLEVEL); + unlock_ji_mutex(pj, __func__, (char *)"5", LOGLEVEL); return(rc); } @@ -2074,7 +2074,7 @@ int req_commit( errno, strerror(errno)); log_err(rc, __func__, "cannot commit job in unexpected state"); req_reject(rc, 0, preq, NULL, NULL); - unlock_ji_mutex(pj, __func__, "6", LOGLEVEL); + unlock_ji_mutex(pj, __func__, (char *)"6", LOGLEVEL); return(rc); } @@ -2086,7 +2086,7 @@ int req_commit( req_reject(rc, 0, preq, NULL, log_buf); if (LOGLEVEL >= 6) log_record(PBSEVENT_JOB, PBS_EVENTCLASS_JOB, pj->ji_qs.ji_jobid, log_buf); - unlock_ji_mutex(pj, __func__, "7", LOGLEVEL); + unlock_ji_mutex(pj, __func__, (char *)"7", LOGLEVEL); return(rc); } @@ -2126,7 +2126,7 @@ int req_commit( req_reject(rc, 0, preq, NULL, NULL); } - unlock_ji_mutex(pj, __func__, "8", LOGLEVEL); + unlock_ji_mutex(pj, __func__, (char *)"8", LOGLEVEL); return(rc); } @@ -2267,7 +2267,7 @@ int req_commit( issue_track(pj); } - unlock_ji_mutex(pj, __func__, "9", LOGLEVEL); + unlock_ji_mutex(pj, __func__, (char *)"9", LOGLEVEL); #ifdef AUTORUN_JOBS /* If we are auto running jobs with start_count = 0 then the @@ -2350,7 +2350,7 @@ static job *locate_new_job( break; } - unlock_ji_mutex(pj, __func__, "1", LOGLEVEL); + unlock_ji_mutex(pj, __func__, (char *)"1", LOGLEVEL); } /* END while(pj != NULL) */ /* return job slot located (NULL on FAILURE) */ diff --git a/src/server/req_register.c b/src/server/req_register.c index 26487d5df2..c98f4cc971 100644 --- a/src/server/req_register.c +++ b/src/server/req_register.c @@ -256,7 +256,7 @@ int req_register( rc = PBSE_BADSTATE; req_reject(rc, 0, preq, NULL, NULL); - unlock_ji_mutex(pjob, __func__, "1", LOGLEVEL); + unlock_ji_mutex(pjob, __func__, (char *)"1", LOGLEVEL); return(rc); } @@ -607,7 +607,7 @@ int req_register( } if (pjob != NULL) - unlock_ji_mutex(pjob, __func__, "2", LOGLEVEL); + unlock_ji_mutex(pjob, __func__, (char *)"2", LOGLEVEL); return(rc); } /* END req_register() */ @@ -724,7 +724,7 @@ int req_registerarray( if (type < JOB_DEPEND_TYPE_AFTERSTARTARRAY) { - unlock_ai_mutex(pa, __func__, "1", LOGLEVEL); + unlock_ai_mutex(pa, __func__, (char *)"1", LOGLEVEL); rc = PBSE_IVALREQ; req_reject(rc,0,preq,NULL, "Arrays may only be given array dependencies"); @@ -758,7 +758,7 @@ int req_registerarray( break; } /* END switch (preq->rq_ind.rq_register.rq_op */ - unlock_ai_mutex(pa, __func__, "2", LOGLEVEL); + unlock_ai_mutex(pa, __func__, (char *)"2", LOGLEVEL); return(rc); } /* END req_registerarray() */ @@ -964,7 +964,7 @@ void set_array_depend_holds( set_depend_hold(pjob,&pjob->ji_wattr[JOB_ATR_depend]); } - unlock_ji_mutex(pjob, __func__, "1", LOGLEVEL); + unlock_ji_mutex(pjob, __func__, (char *)"1", LOGLEVEL); } pdj = (struct array_depend_job *)GET_NEXT(pdj->dc_link); @@ -1040,7 +1040,7 @@ void post_doq( set_depend_hold(pjob, pattr); - unlock_ji_mutex(pjob, __func__, "1", LOGLEVEL); + unlock_ji_mutex(pjob, __func__, (char *)"1", LOGLEVEL); } } } @@ -1075,7 +1075,7 @@ static void alter_unreg( char job_id[PBS_MAXSVRJOBID+1]; strcpy(job_id, pjob->ji_qs.ji_jobid); - unlock_ji_mutex(pjob, __func__, "1", LOGLEVEL); + unlock_ji_mutex(pjob, __func__, (char *)"1", LOGLEVEL); pjob = NULL; for (poldd = (struct depend *)GET_NEXT(old->at_val.at_list); @@ -1143,7 +1143,7 @@ int depend_on_que( { if (pjob == NULL) { - log_err(PBSE_JOBNOTFOUND, __func__, "Job lost while acquiring queue 8"); + log_err(PBSE_JOBNOTFOUND, __func__, (char *)"Job lost while acquiring queue 8"); return(PBSE_JOBNOTFOUND); } else @@ -1153,11 +1153,11 @@ int depend_on_que( (mode != ATR_ACTION_NOOP)) || (pque->qu_qs.qu_type != QTYPE_Execution)) { - unlock_queue(pque, __func__, NULL, LOGLEVEL); + unlock_queue(pque, __func__, (char *)NULL, LOGLEVEL); return(PBSE_NONE); } else - unlock_queue(pque, __func__, NULL, LOGLEVEL); + unlock_queue(pque, __func__, (char *)NULL, LOGLEVEL); if (mode == ATR_ACTION_ALTER) { @@ -1170,7 +1170,7 @@ int depend_on_que( /* First set a System hold if required */ - unlock_ji_mutex(pjob, __func__, "2", LOGLEVEL); + unlock_ji_mutex(pjob, __func__, (char *)"2", LOGLEVEL); set_depend_hold(pjob, pattr); if ((pjob = svr_find_job(job_id, FALSE)) == NULL) return PBSE_JOBNOTFOUND; @@ -1268,7 +1268,7 @@ void post_doe( } } - unlock_ji_mutex(pjob, __func__, "1", LOGLEVEL); + unlock_ji_mutex(pjob, __func__, (char *)"1", LOGLEVEL); } free_br(preq); @@ -1521,7 +1521,7 @@ int depend_on_term( } /* END loop over each dependency */ if (!job_unlocked) - unlock_ji_mutex(pjob, __func__, "1", LOGLEVEL); + unlock_ji_mutex(pjob, __func__, (char *)"1", LOGLEVEL); return(0); } /* END depend_on_term() */ @@ -1674,7 +1674,7 @@ void set_depend_hold( } if (djp != NULL) - unlock_ji_mutex(djp, __func__, "1", LOGLEVEL); + unlock_ji_mutex(djp, __func__, (char *)"1", LOGLEVEL); } break; @@ -2133,7 +2133,7 @@ int send_depend_req( if (preq == NULL) { log_err(errno, __func__, msg_err_malloc); - unlock_ji_mutex(pjob, __func__, "1", LOGLEVEL); + unlock_ji_mutex(pjob, __func__, (char *)"1", LOGLEVEL); return(PBSE_SYSTEM); } @@ -2141,7 +2141,7 @@ int send_depend_req( { if (pjob->ji_wattr[JOB_ATR_job_owner].at_val.at_str == NULL) { - unlock_ji_mutex(pjob, __func__, "2", LOGLEVEL); + unlock_ji_mutex(pjob, __func__, (char *)"2", LOGLEVEL); free_br(preq); return(PBSE_BADATVAL); } @@ -2191,7 +2191,7 @@ int send_depend_req( /* save jobid and unlock mutex */ strcpy(job_id, pjob->ji_qs.ji_jobid); - unlock_ji_mutex(pjob, __func__, "2", LOGLEVEL); + unlock_ji_mutex(pjob, __func__, (char *)"2", LOGLEVEL); get_batch_request_id(preq); strcpy(br_id, preq->rq_id); diff --git a/src/server/req_rerun.c b/src/server/req_rerun.c index 67ddb6dde1..439bcc6fa8 100644 --- a/src/server/req_rerun.c +++ b/src/server/req_rerun.c @@ -147,7 +147,7 @@ void post_rerun( svr_setjobstate(pjob, newstate, newsub, FALSE); - unlock_ji_mutex(pjob, __func__, "1", LOGLEVEL); + unlock_ji_mutex(pjob, __func__, (char *)"1", LOGLEVEL); } } @@ -218,7 +218,7 @@ int req_rerunjob( snprintf(log_buf, LOCAL_LOG_BUF_SIZE, "job %s is in a bad state", preq->rq_ind.rq_rerun); req_reject(rc, 0, preq, NULL, log_buf); - unlock_ji_mutex(pjob, __func__, "2", LOGLEVEL); + unlock_ji_mutex(pjob, __func__, (char *)"2", LOGLEVEL); return rc; } @@ -231,7 +231,7 @@ int req_rerunjob( snprintf(log_buf, LOCAL_LOG_BUF_SIZE, "additional permissions required (ATR_DFLAG_MGWR | ATR_DFLAG_OPWR)"); req_reject(rc, 0, preq, NULL, log_buf); - unlock_ji_mutex(pjob, __func__, "3", LOGLEVEL); + unlock_ji_mutex(pjob, __func__, (char *)"3", LOGLEVEL); return rc; } @@ -248,7 +248,7 @@ int req_rerunjob( snprintf(log_buf, LOCAL_LOG_BUF_SIZE, "job %s not rerunnable", preq->rq_ind.rq_rerun); req_reject(rc, 0, preq, NULL, log_buf); - unlock_ji_mutex(pjob, __func__, "4", LOGLEVEL); + unlock_ji_mutex(pjob, __func__, (char *)"4", LOGLEVEL); return rc; } @@ -320,7 +320,7 @@ int req_rerunjob( snprintf(log_buf, LOCAL_LOG_BUF_SIZE, "Rejected by mom"); req_reject(rc, 0, preq, NULL, log_buf); if (pjob != NULL) - unlock_ji_mutex(pjob, __func__, "5", LOGLEVEL); + unlock_ji_mutex(pjob, __func__, (char *)"5", LOGLEVEL); return rc; } else @@ -408,7 +408,7 @@ int req_rerunjob( /* note in accounting file */ account_record(PBS_ACCT_RERUN, pjob, NULL); - unlock_ji_mutex(pjob, __func__, "6", LOGLEVEL); + unlock_ji_mutex(pjob, __func__, (char *)"6", LOGLEVEL); } return rc; diff --git a/src/server/req_runjob.c b/src/server/req_runjob.c index 7116c7fad3..43a18d61d2 100644 --- a/src/server/req_runjob.c +++ b/src/server/req_runjob.c @@ -215,7 +215,7 @@ void *check_and_run_job( if (pjob == NULL) { req_reject(PBSE_JOBNOTFOUND, 0, preq, NULL, "Job unexpectedly deleted"); - unlock_ai_mutex(pa, __func__, "1", LOGLEVEL); + unlock_ai_mutex(pa, __func__, (char *)"1", LOGLEVEL); *rc_ptr = PBSE_JOBNOTFOUND; return(rc_ptr); } @@ -227,7 +227,7 @@ void *check_and_run_job( job_exit_status = pjob->ji_qs.ji_un.ji_exect.ji_exitstat; job_state = pjob->ji_qs.ji_state; - unlock_ji_mutex(pjob, __func__, "1", LOGLEVEL); + unlock_ji_mutex(pjob, __func__, (char *)"1", LOGLEVEL); update_array_values(pa,job_state,aeRun, job_id, job_atr_hold, job_exit_status); @@ -236,7 +236,7 @@ void *check_and_run_job( { req_reject(PBSE_JOBNOTFOUND, 0, preq, NULL, "Job deleted while updating array values"); - unlock_ai_mutex(pa, __func__, "2", LOGLEVEL); + unlock_ai_mutex(pa, __func__, (char *)"2", LOGLEVEL); *rc_ptr = PBSE_JOBNOTFOUND; return(rc_ptr); } @@ -250,15 +250,15 @@ void *check_and_run_job( req_reject(PBSE_IVALREQ, 0, preq, NULL, log_buf); - unlock_ji_mutex(pjob, __func__, "2", LOGLEVEL); - unlock_ai_mutex(pa, __func__, "1", LOGLEVEL); + unlock_ji_mutex(pjob, __func__, (char *)"2", LOGLEVEL); + unlock_ai_mutex(pa, __func__, (char *)"1", LOGLEVEL); *rc_ptr = PBSE_IVALREQ; return(rc_ptr); } - unlock_ai_mutex(pa, __func__, "1", LOGLEVEL); + unlock_ai_mutex(pa, (char *)__func__, "1", LOGLEVEL); } /* NOTE: nodes assigned to job in svr_startjob() */ @@ -282,7 +282,7 @@ void *check_and_run_job( } } - unlock_ji_mutex(pjob, __func__, "3", LOGLEVEL); + unlock_ji_mutex(pjob, __func__, (char *)"3", LOGLEVEL); return(rc_ptr); } /* END check_and_run_job() */ @@ -329,7 +329,7 @@ int req_runjob( if (strstr(pjob->ji_qs.ji_jobid,"[]") != NULL) { - unlock_ji_mutex(pjob, __func__, "1", LOGLEVEL); + unlock_ji_mutex(pjob, __func__, (char *)"1", LOGLEVEL); req_reject(PBSE_IVALREQ, 0, preq, NULL, "cannot run a job array"); return(PBSE_IVALREQ); } @@ -345,7 +345,7 @@ int req_runjob( /* If async run, reply now; otherwise reply is handled in */ /* post_sendmom or post_stagein */ - unlock_ji_mutex(pjob, __func__, "2", LOGLEVEL); + unlock_ji_mutex(pjob, __func__, (char *)"2", LOGLEVEL); if (preq->rq_type == PBS_BATCH_AsyrunJob) { @@ -476,7 +476,7 @@ void post_checkpointsend( } if (pjob != NULL) - unlock_ji_mutex(pjob, __func__, "1", LOGLEVEL); + unlock_ji_mutex(pjob, __func__, (char *)"1", LOGLEVEL); } /* END if (pjob != NULL) */ free_br(preq); /* close connection and release request */ @@ -538,7 +538,7 @@ int svr_send_checkpoint( { svr_setjobstate(pjob, state, substate, FALSE); strcpy(jobid, pjob->ji_qs.ji_jobid); - unlock_ji_mutex(pjob, __func__, "1", LOGLEVEL); + unlock_ji_mutex(pjob, __func__, (char *)"1", LOGLEVEL); } post_checkpointsend(momreq); @@ -603,7 +603,7 @@ int req_stagein( req_reject(PBSE_IVALREQ, 0, preq, NULL, NULL); - unlock_ji_mutex(pjob, __func__, "1", LOGLEVEL); + unlock_ji_mutex(pjob, __func__, (char *)"1", LOGLEVEL); return(PBSE_IVALREQ); } @@ -619,7 +619,7 @@ int req_stagein( req_reject(rc, 0, preq, NULL, NULL); } - unlock_ji_mutex(pjob, __func__, "2", LOGLEVEL); + unlock_ji_mutex(pjob, __func__, (char *)"2", LOGLEVEL); return(rc); } /* END req_stagein() */ @@ -721,7 +721,7 @@ void post_stagein( } if (pjob != NULL) - unlock_ji_mutex(pjob, __func__, "1", LOGLEVEL); + unlock_ji_mutex(pjob, __func__, (char *)"1", LOGLEVEL); } /* END if (pjob != NULL) */ free_br(preq); /* close connection and release request */ @@ -785,7 +785,7 @@ int svr_stagein( { strcpy(jobid, pjob->ji_qs.ji_jobid); svr_setjobstate(pjob, state, substate, FALSE); - unlock_ji_mutex(pjob, __func__, "1", LOGLEVEL); + unlock_ji_mutex(pjob, __func__, (char *)"1", LOGLEVEL); } post_stagein(momreq); @@ -1153,7 +1153,7 @@ int send_job_to_mom( job_momaddr = pjob->ji_qs.ji_un.ji_exect.ji_momaddr; strcpy(job_id, pjob->ji_qs.ji_jobid); - unlock_ji_mutex(pjob, __func__, "1", LOGLEVEL); + unlock_ji_mutex(pjob, __func__, (char *)"1", LOGLEVEL); *pjob_ptr = NULL; pjob = NULL; @@ -1270,9 +1270,9 @@ int handle_heterogeneous_job_launch( batch_request *external_preq; batch_request *cray_preq; - unlock_ji_mutex(pjob, __func__, NULL, 0); - lock_ji_mutex(external_clone, __func__, NULL, 0); - lock_ji_mutex(cray_clone, __func__, NULL, 0); + unlock_ji_mutex(pjob, __func__, (char *)NULL, 0); + lock_ji_mutex(external_clone, __func__, (char *)NULL, 0); + lock_ji_mutex(cray_clone, __func__, (char *)NULL, 0); /* clone the batch requests to avoid double frees */ external_preq = duplicate_request(preq); @@ -1296,12 +1296,12 @@ int handle_heterogeneous_job_launch( free_br(cray_preq); if (cray_clone != NULL) - unlock_ji_mutex(cray_clone, __func__, NULL, 0); + unlock_ji_mutex(cray_clone, __func__, (char *)NULL, 0); if (external_clone != NULL) - unlock_ji_mutex(external_clone, __func__, NULL, 0); + unlock_ji_mutex(external_clone, __func__, (char *)NULL, 0); - lock_ji_mutex(pjob, __func__, NULL, 0); + lock_ji_mutex(pjob, __func__, (char *)NULL, 0); if (both_running == TRUE) { @@ -1554,7 +1554,7 @@ void finish_sendmom( pjob->ji_momstat = 0; /* update mom-based job status */ - unlock_ji_mutex(pjob, __func__, "2", LOGLEVEL); + unlock_ji_mutex(pjob, __func__, (char *)"2", LOGLEVEL); stat_mom_job(job_id); pjob = svr_find_job(job_id, TRUE); } @@ -1576,7 +1576,7 @@ void finish_sendmom( } } /* END switch (status) */ - unlock_ji_mutex(pjob, __func__, "3", LOGLEVEL); + unlock_ji_mutex(pjob, __func__, (char *)"3", LOGLEVEL); } /* END finish_sendmom() */ @@ -1625,7 +1625,7 @@ job *chk_job_torun( req_reject(PBSE_BADSTATE, 0, preq, NULL, "job already running"); - unlock_ji_mutex(pjob, __func__, "1", LOGLEVEL); + unlock_ji_mutex(pjob, __func__, (char *)"1", LOGLEVEL); return(NULL); } @@ -1638,7 +1638,7 @@ job *chk_job_torun( req_reject(PBSE_BADSTATE, 0, preq, NULL, NULL); - unlock_ji_mutex(pjob, __func__, "2", LOGLEVEL); + unlock_ji_mutex(pjob, __func__, (char *)"2", LOGLEVEL); return(NULL); } @@ -1650,7 +1650,7 @@ job *chk_job_torun( req_reject(PBSE_PERM, 0, preq, NULL, NULL); - unlock_ji_mutex(pjob, __func__, "3", LOGLEVEL); + unlock_ji_mutex(pjob, __func__, (char *)"3", LOGLEVEL); return(NULL); } @@ -1664,13 +1664,13 @@ job *chk_job_torun( req_reject(PBSE_IVALREQ, 0, preq, NULL, "job not in execution queue"); - unlock_queue(pque, __func__, NULL, LOGLEVEL); - unlock_ji_mutex(pjob, __func__, "4", LOGLEVEL); + unlock_queue(pque, __func__, (char *)NULL, LOGLEVEL); + unlock_ji_mutex(pjob, __func__, (char *)"4", LOGLEVEL); return(NULL); } - unlock_queue(pque, __func__, NULL, LOGLEVEL); + unlock_queue(pque, __func__, (char *)NULL, LOGLEVEL); } else if (pjob == NULL) { @@ -1694,7 +1694,7 @@ job *chk_job_torun( if ((exec_host = strdup(pjob->ji_wattr[JOB_ATR_exec_host].at_val.at_str)) == NULL) { req_reject(PBSE_RMSYSTEM, 0, preq, NULL, "Cannot allocate memory"); - unlock_ji_mutex(pjob, __func__, "5", LOGLEVEL); + unlock_ji_mutex(pjob, __func__, (char *)"5", LOGLEVEL); return(NULL); } @@ -1711,7 +1711,7 @@ job *chk_job_torun( else req_reject(PBSE_EXECTHERE, 0, preq, NULL, "allocated nodes must match input file stagein location"); - unlock_ji_mutex(pjob, __func__, "6", LOGLEVEL); + unlock_ji_mutex(pjob, __func__, (char *)"6", LOGLEVEL); return(NULL); } @@ -1732,7 +1732,7 @@ job *chk_job_torun( { req_reject(PBSE_EXECTHERE, 0, preq, FailHost, EMsg); - unlock_ji_mutex(pjob, __func__, "7", LOGLEVEL); + unlock_ji_mutex(pjob, __func__, (char *)"7", LOGLEVEL); return(NULL); } @@ -1768,7 +1768,7 @@ job *chk_job_torun( req_reject(rc, 0, preq, FailHost, EMsg); - unlock_ji_mutex(pjob, __func__, "8", LOGLEVEL); + unlock_ji_mutex(pjob, __func__, (char *)"8", LOGLEVEL); return(NULL); } diff --git a/src/server/req_select.c b/src/server/req_select.c index 38cbc7ab28..1476cabcba 100644 --- a/src/server/req_select.c +++ b/src/server/req_select.c @@ -358,7 +358,7 @@ int req_selectjobs( } if (pque != NULL) - unlock_queue(pque, "req_selectjobs", NULL, LOGLEVEL); + unlock_queue(pque, "req_selectjobs", (char *)NULL, LOGLEVEL); return PBSE_NONE; } /* END req_selectjobs() */ @@ -442,10 +442,10 @@ static void sel_step2( if (pque->qu_qs.qu_type != QTYPE_Execution) { - unlock_queue(pque, "sel_step2", "not exec queue", LOGLEVEL); + unlock_queue(pque, "sel_step2", (char *)"not exec queue", LOGLEVEL); continue; } - unlock_queue(pque, "sel_step2", "exec queue", LOGLEVEL); + unlock_queue(pque, "sel_step2", (char *)"exec queue", LOGLEVEL); } } @@ -460,7 +460,7 @@ static void sel_step2( strcpy(job_id, pjob->ji_qs.ji_jobid); job_substate = pjob->ji_qs.ji_substate; job_momstattime = pjob->ji_momstat; - unlock_ji_mutex(pjob, __func__, "1", LOGLEVEL); + unlock_ji_mutex(pjob, __func__, (char *)"1", LOGLEVEL); if ((job_substate == JOB_SUBSTATE_RUNNING) && ((time_now - job_momstattime) > JobStatRate)) @@ -482,10 +482,10 @@ static void sel_step2( } } else - unlock_ji_mutex(pjob, __func__, "2", LOGLEVEL); + unlock_ji_mutex(pjob, __func__, (char *)"2", LOGLEVEL); } else - unlock_ji_mutex(pjob, __func__, "3", LOGLEVEL); + unlock_ji_mutex(pjob, __func__, (char *)"3", LOGLEVEL); } sel_step3(cntl); @@ -588,10 +588,10 @@ static void sel_step3( if (pque->qu_qs.qu_type != QTYPE_Execution) { - unlock_queue(pque, "sel_step3", "not exec queue", LOGLEVEL); + unlock_queue(pque, "sel_step3", (char *)"not exec queue", LOGLEVEL); goto nextjob; } - unlock_queue(pque, "sel_step3", "exec queue", LOGLEVEL); + unlock_queue(pque, "sel_step3", (char *)"exec queue", LOGLEVEL); } } @@ -609,7 +609,7 @@ static void sel_step3( { rc = PBSE_SYSTEM; - unlock_ji_mutex(pjob, __func__, "1", LOGLEVEL); + unlock_ji_mutex(pjob, __func__, (char *)"1", LOGLEVEL); break; } @@ -630,7 +630,7 @@ static void sel_step3( if (rc && (rc != PBSE_PERM)) { - unlock_ji_mutex(pjob, __func__, "2", LOGLEVEL); + unlock_ji_mutex(pjob, __func__, (char *)"2", LOGLEVEL); break; } @@ -640,7 +640,7 @@ static void sel_step3( nextjob: - unlock_ji_mutex(pjob, __func__, "3", LOGLEVEL); + unlock_ji_mutex(pjob, __func__, (char *)"3", LOGLEVEL); if (summarize_arrays) { @@ -973,7 +973,7 @@ static int build_selist( if (*pque == (pbs_queue *)0) return (PBSE_UNKQUE); - unlock_queue(*pque, __func__, NULL, LOGLEVEL); + unlock_queue(*pque, __func__, (char *)NULL, LOGLEVEL); } } } diff --git a/src/server/req_shutdown.c b/src/server/req_shutdown.c index e708cc37c7..93b0a4b636 100644 --- a/src/server/req_shutdown.c +++ b/src/server/req_shutdown.c @@ -154,7 +154,7 @@ void save_queues() while ((pque = next_queue(&svr_queues, &iter)) != NULL) { que_save(pque); - unlock_queue(pque, __func__, NULL, 0); + unlock_queue(pque, __func__, (char *)NULL, 0); } } /* END save_queues() */ @@ -267,7 +267,7 @@ void svr_shutdown( if (shutdown_checkpoint(&pjob) == 0) { if (pjob != NULL) - unlock_ji_mutex(pjob, __func__, "1", LOGLEVEL); + unlock_ji_mutex(pjob, __func__, (char *)"1", LOGLEVEL); continue; } @@ -280,7 +280,7 @@ void svr_shutdown( } if (pjob != NULL) - unlock_ji_mutex(pjob, __func__, "2", LOGLEVEL); + unlock_ji_mutex(pjob, __func__, (char *)"2", LOGLEVEL); } return; @@ -426,7 +426,7 @@ static int shutdown_checkpoint( job_save(pjob, SAVEJOB_QUICK, 0); strcpy(jobid, pjob->ji_qs.ji_jobid); - unlock_ji_mutex(pjob, __func__, "1", LOGLEVEL); + unlock_ji_mutex(pjob, __func__, (char *)"1", LOGLEVEL); } if (rc == PBSE_NONE) @@ -491,7 +491,7 @@ void post_checkpoint( free_br(preq); if (pjob != NULL) - unlock_ji_mutex(pjob, __func__, "1", LOGLEVEL); + unlock_ji_mutex(pjob, __func__, (char *)"1", LOGLEVEL); } /* END post_checkpoint() */ @@ -525,7 +525,7 @@ void rerun_or_kill( { snprintf(log_buf, sizeof(log_buf), "%s%s%s", msg_init_queued, pque->qu_qs.qu_name, text); - unlock_queue(pque, __func__, NULL, LOGLEVEL); + unlock_queue(pque, __func__, (char *)NULL, LOGLEVEL); } } } diff --git a/src/server/req_signal.c b/src/server/req_signal.c index 55c682af04..9d3d24c60d 100644 --- a/src/server/req_signal.c +++ b/src/server/req_signal.c @@ -149,7 +149,7 @@ int req_signaljob( { req_reject(PBSE_BADSTATE, 0, preq, NULL, NULL); - unlock_ji_mutex(pjob, __func__, "1", LOGLEVEL); + unlock_ji_mutex(pjob, __func__, (char *)"1", LOGLEVEL); return(PBSE_NONE); } @@ -163,7 +163,7 @@ int req_signaljob( /* for suspend/resume, must be mgr/op */ req_reject(PBSE_PERM, 0, preq, NULL, NULL); - unlock_ji_mutex(pjob, __func__, "2", LOGLEVEL); + unlock_ji_mutex(pjob, __func__, (char *)"2", LOGLEVEL); return(PBSE_NONE); } @@ -184,7 +184,7 @@ int req_signaljob( { req_reject(PBSE_JOBTYPE, 0, preq, NULL, NULL); - unlock_ji_mutex(pjob, __func__, "3", LOGLEVEL); + unlock_ji_mutex(pjob, __func__, (char *)"3", LOGLEVEL); return(PBSE_NONE); } @@ -209,7 +209,7 @@ int req_signaljob( if ((rc = copy_batchrequest(&dup_req, preq, 0, -1)) != 0) { req_reject(rc, 0, preq, NULL, "can not allocate memory"); - unlock_ji_mutex(pjob, __func__, "4", LOGLEVEL); + unlock_ji_mutex(pjob, __func__, (char *)"4", LOGLEVEL); } /* The dup_req is freed in relay_to_mom (failure) * or in issue_Drequest (success) */ @@ -218,7 +218,7 @@ int req_signaljob( rc = relay_to_mom(&pjob, dup_req, NULL); if (pjob != NULL) - unlock_ji_mutex(pjob, __func__, "4", LOGLEVEL); + unlock_ji_mutex(pjob, __func__, (char *)"4", LOGLEVEL); if (rc != PBSE_NONE) { @@ -284,7 +284,7 @@ int issue_signal( unlock_ji_mutex(pjob, __func__, NULL, 0); func(newreq); - *pjob_ptr = svr_find_job(jobid, TRUE); + *pjob_ptr = svr_find_job((char *)jobid, TRUE); } else { @@ -337,7 +337,7 @@ void post_signal_req( { if ((jobid = preq->rq_extra) == NULL) { - log_err(ENOMEM, __func__, "Cannot allocate memory! FAILURE"); + log_err(ENOMEM, __func__, (char *)"Cannot allocate memory! FAILURE"); return; } @@ -374,7 +374,7 @@ void post_signal_req( } } - unlock_ji_mutex(pjob, __func__, "5", LOGLEVEL); + unlock_ji_mutex(pjob, __func__, (char *)"5", LOGLEVEL); } else { diff --git a/src/server/req_stat.c b/src/server/req_stat.c index e5f5ebcf35..3f2bcbf6b5 100644 --- a/src/server/req_stat.c +++ b/src/server/req_stat.c @@ -261,7 +261,7 @@ int req_stat_job( rc = PBSE_UNKJOBID; } else - unlock_ji_mutex(pjob, __func__, "1", LOGLEVEL); + unlock_ji_mutex(pjob, __func__, (char *)"1", LOGLEVEL); } } else if (isalpha(name[0])) @@ -308,7 +308,7 @@ int req_stat_job( if (cntl == NULL) { if (pque != NULL) - unlock_queue(pque, "req_stat_job", "no memory cntl", LOGLEVEL); + unlock_queue(pque, "req_stat_job", (char *)"no memory cntl", LOGLEVEL); req_reject(PBSE_SYSTEM, 0, preq, NULL, NULL); return(PBSE_SYSTEM); @@ -319,7 +319,7 @@ int req_stat_job( { if (pque != NULL) { - unlock_queue(pque, __func__, "", LOGLEVEL); + unlock_queue(pque, __func__, (char *)"", LOGLEVEL); pque = NULL; } } @@ -338,7 +338,7 @@ int req_stat_job( req_stat_job_step2(cntl); /* go to step 2, see if running is current */ if (pque != NULL) - unlock_queue(pque, "req_stat_job", "success", LOGLEVEL); + unlock_queue(pque, "req_stat_job", (char *)"success", LOGLEVEL); free(cntl); return(PBSE_NONE); @@ -483,7 +483,7 @@ static void req_stat_job_step2( { if ((pjob = svr_find_job(pa->job_ids[job_array_index], FALSE)) != NULL) { - unlock_ji_mutex(pjob, __func__, "2", LOGLEVEL); + unlock_ji_mutex(pjob, __func__, (char *)"2", LOGLEVEL); break; } } @@ -500,7 +500,7 @@ static void req_stat_job_step2( else { strcpy(job_id, pjob->ji_qs.ji_jobid); - unlock_ji_mutex(pjob, __func__, "3", LOGLEVEL); + unlock_ji_mutex(pjob, __func__, (char *)"3", LOGLEVEL); if (type == tjstJob) break; @@ -517,7 +517,7 @@ static void req_stat_job_step2( { if ((pjob = svr_find_job(pa->job_ids[job_array_index], FALSE)) != NULL) { - unlock_ji_mutex(pjob, __func__, "3", LOGLEVEL); + unlock_ji_mutex(pjob, __func__, (char *)"3", LOGLEVEL); break; } } @@ -535,7 +535,7 @@ static void req_stat_job_step2( job_substate = pjob->ji_qs.ji_substate; job_momstattime = pjob->ji_momstat; strcpy(cntl->sc_jobid, job_id); - unlock_ji_mutex(pjob, __func__, "4", LOGLEVEL); + unlock_ji_mutex(pjob, __func__, (char *)"4", LOGLEVEL); pjob = NULL; /* PBS_RESTAT_JOB defaults to 30 seconds */ @@ -556,7 +556,7 @@ static void req_stat_job_step2( } if (pa != NULL) - unlock_ai_mutex(pa, __func__, "1", LOGLEVEL); + unlock_ai_mutex(pa, __func__, (char *)"1", LOGLEVEL); return; /* will pick up after mom replies */ } @@ -565,7 +565,7 @@ static void req_stat_job_step2( if (rc != 0) { if (pa != NULL) - unlock_ai_mutex(pa, __func__, "2", LOGLEVEL); + unlock_ai_mutex(pa, __func__, (char *)"2", LOGLEVEL); reply_free(preply); @@ -657,7 +657,7 @@ static void req_stat_job_step2( (pque->qu_qs.qu_type != QTYPE_Execution)) { /* ignore routing queues */ - unlock_queue(pque, __func__, "ignore queue", LOGLEVEL); + unlock_queue(pque, __func__, (char *)"ignore queue", LOGLEVEL); continue; } @@ -684,7 +684,7 @@ static void req_stat_job_step2( /* loop through jobs in queue */ if (pjob != NULL) - unlock_ji_mutex(pjob, __func__, "5", LOGLEVEL); + unlock_ji_mutex(pjob, __func__, (char *)"5", LOGLEVEL); iter = -1; @@ -694,7 +694,7 @@ static void req_stat_job_step2( (pjob->ji_qs.ji_state == JOB_STATE_QUEUED)) { /* max_report of queued jobs reached for queue */ - unlock_ji_mutex(pjob, __func__, "6", LOGLEVEL); + unlock_ji_mutex(pjob, __func__, (char *)"6", LOGLEVEL); continue; } @@ -714,10 +714,10 @@ static void req_stat_job_step2( if (pa != NULL) { - unlock_ai_mutex(pa, __func__, "1", LOGLEVEL); + unlock_ai_mutex(pa, __func__, (char *)"1", LOGLEVEL); } - unlock_ji_mutex(pjob, __func__, "7", LOGLEVEL); - unlock_queue(pque, __func__, "perm", LOGLEVEL); + unlock_ji_mutex(pjob, __func__, (char *)"7", LOGLEVEL); + unlock_queue(pque, __func__, (char *)"perm", LOGLEVEL); return; } @@ -726,7 +726,7 @@ static void req_stat_job_step2( if (pjob->ji_qs.ji_state == JOB_STATE_QUEUED) qjcounter++; - unlock_ji_mutex(pjob, __func__, "8", LOGLEVEL); + unlock_ji_mutex(pjob, __func__, (char *)"8", LOGLEVEL); } /* END foreach (pjob from pque) */ if (LOGLEVEL >= 5) @@ -738,11 +738,11 @@ static void req_stat_job_step2( log_event(PBSEVENT_SYSTEM,PBS_EVENTCLASS_QUEUE,pque->qu_qs.qu_name,log_buf); } - unlock_queue(pque, __func__, "end while", LOGLEVEL); + unlock_queue(pque, __func__, (char *)"end while", LOGLEVEL); } /* END for (pque) */ if (pa != NULL) - unlock_ai_mutex(pa, __func__, "1", LOGLEVEL); + unlock_ai_mutex(pa, __func__, (char *)"1", LOGLEVEL); reply_send_svr(preq); @@ -774,12 +774,12 @@ static void req_stat_job_step2( if (pque->qu_qs.qu_type != QTYPE_Execution) { - unlock_queue(pque, __func__, "not exec", LOGLEVEL); + unlock_queue(pque, __func__, (char *)"not exec", LOGLEVEL); goto nextjob; } - unlock_queue(pque, __func__, "exec", LOGLEVEL); + unlock_queue(pque, __func__, (char *)"exec", LOGLEVEL); } } @@ -797,9 +797,9 @@ static void req_stat_job_step2( { if (pa != NULL) { - unlock_ai_mutex(pa, __func__, "1", LOGLEVEL); + unlock_ai_mutex(pa, __func__, (char *)"1", LOGLEVEL); } - unlock_ji_mutex(pjob, __func__, "9", LOGLEVEL); + unlock_ji_mutex(pjob, __func__, (char *)"9", LOGLEVEL); req_reject(rc, bad, preq, NULL, NULL); @@ -811,7 +811,7 @@ static void req_stat_job_step2( nextjob: if (pjob != NULL) - unlock_ji_mutex(pjob, __func__, "10", LOGLEVEL); + unlock_ji_mutex(pjob, __func__, (char *)"10", LOGLEVEL); if (type == tjstJob) break; @@ -845,7 +845,7 @@ static void req_stat_job_step2( if (pa != NULL) { - unlock_ai_mutex(pa, __func__, "1", LOGLEVEL); + unlock_ai_mutex(pa, __func__, (char *)"1", LOGLEVEL); } reply_send_svr(preq); @@ -899,7 +899,7 @@ int stat_to_mom( job_momaddr = pjob->ji_qs.ji_un.ji_exect.ji_momaddr; job_momport = pjob->ji_qs.ji_un.ji_exect.ji_momport; job_momname = strdup(pjob->ji_wattr[JOB_ATR_exec_host].at_val.at_str); - unlock_ji_mutex(pjob, __func__, "1", LOGLEVEL); + unlock_ji_mutex(pjob, __func__, (char *)"1", LOGLEVEL); if (job_momname == NULL) return PBSE_MEM_MALLOC; @@ -1025,7 +1025,7 @@ void stat_update( pjob->ji_momstat = time_now; - unlock_ji_mutex(pjob, __func__, "1", LOGLEVEL); + unlock_ji_mutex(pjob, __func__, (char *)"1", LOGLEVEL); } pstatus = (struct brp_status *)GET_NEXT(pstatus->brp_stlink); @@ -1135,7 +1135,7 @@ void poll_job_task( if (pjob != NULL) { job_state = pjob->ji_qs.ji_state; - unlock_ji_mutex(pjob, __func__, "1", LOGLEVEL); + unlock_ji_mutex(pjob, __func__, (char *)"1", LOGLEVEL); get_svr_attr_l(SRV_ATR_PollJobs, &poll_jobs); if ((poll_jobs) && (job_state == JOB_STATE_RUNNING)) { @@ -1224,7 +1224,7 @@ int req_stat_que( /* get status of the named queue */ rc = status_que(pque, preq, &preply->brp_un.brp_status); - unlock_queue(pque, "req_stat_que", "type == 0", LOGLEVEL); + unlock_queue(pque, "req_stat_que", (char *)"type == 0", LOGLEVEL); } else { @@ -1240,14 +1240,14 @@ int req_stat_que( { if (rc != PBSE_PERM) { - unlock_queue(pque, "req_stat_que", "break", LOGLEVEL); + unlock_queue(pque, "req_stat_que", (char *)"break", LOGLEVEL); break; } rc = 0; } - unlock_queue(pque, "req_stat_que", "end while", LOGLEVEL); + unlock_queue(pque, "req_stat_que", (char *)"end while", LOGLEVEL); } } diff --git a/src/server/req_track.c b/src/server/req_track.c index 0e7a39dd1e..b0c147e45a 100644 --- a/src/server/req_track.c +++ b/src/server/req_track.c @@ -206,7 +206,7 @@ int req_track( { /* FAILURE */ - log_err(errno, "req_track", "calloc failed"); + log_err(errno, "req_track", (char *)"calloc failed"); req_reject(PBSE_SYSTEM, 0, preq, NULL, NULL); @@ -278,10 +278,10 @@ void track_save( free(pwt->wt_mutex); free(pwt); - wt = set_task(WORK_Timed, (long)time_now + PBS_SAVE_TRACK_TM, track_save, NULL, FALSE); + wt = set_task(WORK_Timed, (long)time_now + PBS_SAVE_TRACK_TM, track_save, (char *)NULL, FALSE); if (wt == NULL) - log_err(errno, myid, "Unable to set task for save"); + log_err(errno, myid, (char *)"Unable to set task for save"); } if (server.sv_trackmodifed == 0) @@ -291,19 +291,19 @@ void track_save( if (fd < 0) { - log_err(errno, myid, "Unable to open tracking file"); + log_err(errno, myid, (char *)"Unable to open tracking file"); return; } if (write(fd, (char *)server.sv_track, server.sv_tracksize * sizeof(struct tracking)) != (ssize_t)(server.sv_tracksize * sizeof(struct tracking))) { - log_err(errno, myid, "failed to write to track file"); + log_err(errno, myid, (char *)"failed to write to track file"); } if (close(fd) < 0) { - log_err(errno, myid, "failed to close track file after saving"); + log_err(errno, myid, (char *)"failed to close track file after saving"); return; } diff --git a/src/server/run_sched.c b/src/server/run_sched.c index d25d47ac02..2300cc46df 100644 --- a/src/server/run_sched.c +++ b/src/server/run_sched.c @@ -280,14 +280,14 @@ int schedule_jobs(void) { /* Can not init thread attribute structure */ perror("could not create listener thread for scheduler"); - log_err(-1, __func__, "Failed to create listener thread for scheduler"); + log_err(-1, __func__, (char *)"Failed to create listener thread for scheduler"); } else if (pthread_attr_setdetachstate(&t_attr, PTHREAD_CREATE_DETACHED) != 0) { /* Can not set thread initial state as detached */ pthread_attr_destroy(&t_attr); perror("could not detach listener thread for scheduler"); - log_err(-1, __func__, "Failed to detach listener thread for scheduler"); + log_err(-1, __func__, (char *)"Failed to detach listener thread for scheduler"); } else { @@ -298,7 +298,7 @@ int schedule_jobs(void) != 0) { perror("could not start listener thread for scheduler"); - log_err(-1, __func__, "Failed to start listener thread for scheduler"); + log_err(-1, __func__, (char *)"Failed to start listener thread for scheduler"); return(-1); } } diff --git a/src/server/svr_attr_def.c b/src/server/svr_attr_def.c index 80a6ff1e17..52b04b9a68 100644 --- a/src/server/svr_attr_def.c +++ b/src/server/svr_attr_def.c @@ -141,7 +141,7 @@ attribute_def svr_attr_def[] = { /* SRV_ATR_State */ - { ATTR_status, /* "server_state" */ + { (char *)ATTR_status, /* "server_state" */ decode_null, encode_svrstate, set_null, @@ -154,7 +154,7 @@ attribute_def svr_attr_def[] = }, /* SRV_ATR_scheduling */ - { ATTR_scheduling, + { (char *)ATTR_scheduling, decode_b, encode_b, set_b, @@ -167,7 +167,7 @@ attribute_def svr_attr_def[] = }, /* SRV_ATR_max_running */ - { ATTR_maxrun, /* "max_running" */ + { (char *)ATTR_maxrun, /* "max_running" */ decode_l, encode_l, set_l, @@ -180,7 +180,7 @@ attribute_def svr_attr_def[] = }, /* SRV_ATR_MaxUserRun */ - { ATTR_maxuserrun, /* "max_user_run" */ + { (char *)ATTR_maxuserrun, /* "max_user_run" */ decode_l, encode_l, set_l, @@ -193,7 +193,7 @@ attribute_def svr_attr_def[] = }, /* SRV_ATR_MaxGrpRun */ - { ATTR_maxgrprun, /* "max_group_run" */ + { (char *)ATTR_maxgrprun, /* "max_group_run" */ decode_l, encode_l, set_l, @@ -206,7 +206,7 @@ attribute_def svr_attr_def[] = }, /* SRV_ATR_TotalJobs */ - { ATTR_total, /* "total_jobs" */ + { (char *)ATTR_total, /* "total_jobs" */ decode_null, encode_l, set_null, @@ -219,7 +219,7 @@ attribute_def svr_attr_def[] = }, /* SRV_ATR_JobsByState */ - { ATTR_count, /* "state_count" */ + { (char *)ATTR_count, /* "state_count" */ decode_null, /* note-uses fixed buffer in server struct */ encode_str, set_null, @@ -232,7 +232,7 @@ attribute_def svr_attr_def[] = }, /* SRV_ATR_acl_host_enable */ - { ATTR_aclhten, /* "acl_host_enable" */ + { (char *)ATTR_aclhten, /* "acl_host_enable" */ decode_b, encode_b, set_b, @@ -245,7 +245,7 @@ attribute_def svr_attr_def[] = }, /* SRV_ATR_acl_hosts */ - { ATTR_aclhost, /* "acl_hosts" */ + { (char *)ATTR_aclhost, /* "acl_hosts" */ decode_arst, encode_arst, set_hostacl, @@ -258,7 +258,7 @@ attribute_def svr_attr_def[] = }, /* SRV_ATR_AclUserEnabled */ /* User ACL to be used */ - { ATTR_acluren, /* "acl_user_enable" */ + { (char *)ATTR_acluren, /* "acl_user_enable" */ decode_b, encode_b, set_b, @@ -271,7 +271,7 @@ attribute_def svr_attr_def[] = }, /* SRV_ATR_AclUsers */ /* User Acess Control List */ - { ATTR_acluser, /* "acl_users" */ + { (char *)ATTR_acluser, /* "acl_users" */ decode_arst, encode_arst, set_uacl, @@ -284,7 +284,7 @@ attribute_def svr_attr_def[] = }, /* SRV_ATR_AclRoot */ /* List of which roots may execute jobs */ - { ATTR_aclroot, /* "acl_roots" */ + { (char *)ATTR_aclroot, /* "acl_roots" */ decode_arst, encode_arst, set_uacl, @@ -297,7 +297,7 @@ attribute_def svr_attr_def[] = }, /* SRV_ATR_managers */ - { ATTR_managers, /* "managers" */ + { (char *)ATTR_managers, /* "managers" */ decode_arst, encode_arst, set_uacl, @@ -310,7 +310,7 @@ attribute_def svr_attr_def[] = }, /* SRV_ATR_operators */ - { ATTR_operators, /* "operators" */ + { (char *)ATTR_operators, /* "operators" */ decode_arst, encode_arst, set_uacl, @@ -323,7 +323,7 @@ attribute_def svr_attr_def[] = }, /* SRV_ATR_dflt_que */ - { ATTR_dfltque, /* "default_queue" */ + { (char *)ATTR_dfltque, /* "default_queue" */ decode_str, encode_str, set_str, @@ -336,7 +336,7 @@ attribute_def svr_attr_def[] = }, /* SRV_ATR_log_events */ - { ATTR_logevents, /* "log_events" */ + { (char *)ATTR_logevents, /* "log_events" */ decode_l, encode_l, set_l, @@ -349,7 +349,7 @@ attribute_def svr_attr_def[] = }, /* SRV_ATR_mailfrom */ - { ATTR_mailfrom, /* "mail_from" */ + { (char *)ATTR_mailfrom, /* "mail_from" */ decode_str, encode_str, set_str, @@ -362,7 +362,7 @@ attribute_def svr_attr_def[] = }, /* SRV_ATR_query_others */ - { ATTR_queryother, /* "query_other_jobs" */ + { (char *)ATTR_queryother, /* "query_other_jobs" */ decode_b, encode_b, set_b, @@ -375,7 +375,7 @@ attribute_def svr_attr_def[] = }, /* SRV_ATR_resource_avail */ - { ATTR_rescavail, /* "resources_available" */ + { (char *)ATTR_rescavail, /* "resources_available" */ decode_resc, encode_resc, set_resc, @@ -388,7 +388,7 @@ attribute_def svr_attr_def[] = }, /* SRV_ATR_resource_deflt */ - { ATTR_rescdflt, /* "resources_default" */ + { (char *)ATTR_rescdflt, /* "resources_default" */ decode_resc, encode_resc, set_resc, @@ -401,7 +401,7 @@ attribute_def svr_attr_def[] = }, /* SRV_ATR_ResourceMax */ - { ATTR_rescmax, /* "resources_max" */ + { (char *)ATTR_rescmax, /* "resources_max" */ decode_resc, encode_resc, set_resc, @@ -414,7 +414,7 @@ attribute_def svr_attr_def[] = }, /* SRV_ATR_resource_assn */ - { ATTR_rescassn, /* "resources_assigned" */ + { (char *)ATTR_rescassn, /* "resources_assigned" */ decode_resc, encode_resc, set_resc, @@ -427,7 +427,7 @@ attribute_def svr_attr_def[] = }, /* SRV_ATR_resource_cost */ - { ATTR_resccost, /* "resources_cost" */ + { (char *)ATTR_resccost, /* "resources_cost" */ decode_rcost, /* these are not right, haven't figured this out yet */ encode_rcost, set_rcost, @@ -440,7 +440,7 @@ attribute_def svr_attr_def[] = }, /* SRV_ATR_sys_cost */ - { ATTR_syscost, /* "system_cost" */ + { (char *)ATTR_syscost, /* "system_cost" */ decode_l, encode_l, set_l, @@ -453,7 +453,7 @@ attribute_def svr_attr_def[] = }, /* SRV_ATR_schedule_iteration */ - { ATTR_schedit, /* "schedule_iteration" */ + { (char *)ATTR_schedit, /* "schedule_iteration" */ decode_l, encode_l, set_l, @@ -466,7 +466,7 @@ attribute_def svr_attr_def[] = }, /* SRV_ATR_ping_rate */ - { ATTR_pingrate, /* "node_ping_rate" */ + { (char *)ATTR_pingrate, /* "node_ping_rate" */ decode_l, encode_l, set_l, @@ -479,7 +479,7 @@ attribute_def svr_attr_def[] = }, /* SRV_ATR_check_rate */ - { ATTR_ndchkrate, /* "node_check_rate" */ + { (char *)ATTR_ndchkrate, /* "node_check_rate" */ decode_l, encode_l, set_l, @@ -492,7 +492,7 @@ attribute_def svr_attr_def[] = }, /* SRV_ATR_tcp_timeout */ - { ATTR_tcptimeout, /* "tcp_timeout" */ + { (char *)ATTR_tcptimeout, /* "tcp_timeout" */ decode_l, encode_l, set_l, @@ -505,7 +505,7 @@ attribute_def svr_attr_def[] = }, /* SRV_ATR_Comment */ - { ATTR_comment, /* "comment" - information */ + { (char *)ATTR_comment, /* "comment" - information */ decode_str, encode_str, set_str, @@ -518,7 +518,7 @@ attribute_def svr_attr_def[] = }, /* SRV_ATR_DefNode */ - { ATTR_defnode, /* "default_node" */ + { (char *)ATTR_defnode, /* "default_node" */ decode_str, encode_str, set_str, @@ -531,7 +531,7 @@ attribute_def svr_attr_def[] = }, /* SRV_ATR_NodePack */ - { ATTR_nodepack, /* "node_pack" */ + { (char *)ATTR_nodepack, /* "node_pack" */ decode_b, encode_b, set_b, @@ -544,7 +544,7 @@ attribute_def svr_attr_def[] = }, /* SRV_ATR_NodeSuffix */ - { ATTR_nodesuffix, /* "node_suffix" */ + { (char *)ATTR_nodesuffix, /* "node_suffix" */ decode_str, encode_str, set_str, @@ -557,7 +557,7 @@ attribute_def svr_attr_def[] = }, /* SRV_ATR_JobStatRate */ - { ATTR_jobstatrate, /* "job_stat_rate" */ + { (char *)ATTR_jobstatrate, /* "job_stat_rate" */ decode_l, encode_l, set_l, @@ -570,7 +570,7 @@ attribute_def svr_attr_def[] = }, /* SRV_ATR_PollJobs */ - { ATTR_polljobs, /* "poll_jobs" */ + { (char *)ATTR_polljobs, /* "poll_jobs" */ decode_b, encode_b, set_b, @@ -583,7 +583,7 @@ attribute_def svr_attr_def[] = }, /* SRV_ATR_LogLevel */ - { ATTR_loglevel, /* "log_level" */ + { (char *)ATTR_loglevel, /* "log_level" */ decode_l, encode_l, set_l, @@ -596,7 +596,7 @@ attribute_def svr_attr_def[] = }, /* SRV_ATR_DownOnError */ - { ATTR_downonerror, /* "down_on_error" */ + { (char *)ATTR_downonerror, /* "down_on_error" */ decode_b, encode_b, set_b, @@ -609,7 +609,7 @@ attribute_def svr_attr_def[] = }, /* SRV_ATR_DisableServerIdCheck */ - { ATTR_disableserveridcheck, /* "disable_server_id_check" */ + { (char *)ATTR_disableserveridcheck, /* "disable_server_id_check" */ decode_b, encode_b, set_b, @@ -622,7 +622,7 @@ attribute_def svr_attr_def[] = }, /* SRV_ATR_JobNanny */ - { ATTR_jobnanny, /* "job_nanny" */ + { (char *)ATTR_jobnanny, /* "job_nanny" */ decode_b, encode_b, set_b, @@ -635,7 +635,7 @@ attribute_def svr_attr_def[] = }, /* SRV_ATR_OwnerPurge */ - { ATTR_ownerpurge, /* "owner_purge" */ + { (char *)ATTR_ownerpurge, /* "owner_purge" */ decode_b, encode_b, set_b, @@ -648,7 +648,7 @@ attribute_def svr_attr_def[] = }, /* SRV_ATR_QCQLimits */ - { ATTR_qcqlimits, /* "queue_centric_limits" */ + { (char *)ATTR_qcqlimits, /* "queue_centric_limits" */ decode_b, encode_b, set_b, @@ -661,7 +661,7 @@ attribute_def svr_attr_def[] = }, /* SRV_ATR_MomJobSync */ - { ATTR_momjobsync, /* "mom_job_sync" */ + { (char *)ATTR_momjobsync, /* "mom_job_sync" */ decode_b, encode_b, set_b, @@ -674,7 +674,7 @@ attribute_def svr_attr_def[] = }, /* SRV_ATR_MailDomain */ - { ATTR_maildomain, /* "mail_domain" */ + { (char *)ATTR_maildomain, /* "mail_domain" */ decode_str, encode_str, set_str, @@ -687,7 +687,7 @@ attribute_def svr_attr_def[] = }, /* SRV_ATR_version */ - { ATTR_pbsversion, /* "pbs_version" */ + { (char *)ATTR_pbsversion, /* "pbs_version" */ decode_str, encode_str, set_str, @@ -700,7 +700,7 @@ attribute_def svr_attr_def[] = }, /* SRV_ATR_KillDelay */ - { ATTR_killdelay, /* "kill_delay" */ + { (char *)ATTR_killdelay, /* "kill_delay" */ decode_l, encode_l, set_l, @@ -713,7 +713,7 @@ attribute_def svr_attr_def[] = }, /* SRV_ATR_AclLogic */ - { ATTR_acllogic, /* "acl_logic_or" */ + { (char *)ATTR_acllogic, /* "acl_logic_or" */ decode_b, encode_b, set_b, @@ -726,7 +726,7 @@ attribute_def svr_attr_def[] = }, /* SRV_ATR_AclGroupSloppy */ - { ATTR_aclgrpslpy, /* "acl_group_sloppy" */ + { (char *)ATTR_aclgrpslpy, /* "acl_group_sloppy" */ decode_b, encode_b, set_b, @@ -739,7 +739,7 @@ attribute_def svr_attr_def[] = }, /* SRV_ATR_KeepCompleted */ - { ATTR_keepcompleted, /* "keep_completed" */ + { (char *)ATTR_keepcompleted, /* "keep_completed" */ decode_l, encode_l, set_l, @@ -752,7 +752,7 @@ attribute_def svr_attr_def[] = }, /* SRV_ATR_SubmitHosts */ - { ATTR_submithosts, /* "submit_hosts" */ + { (char *)ATTR_submithosts, /* "submit_hosts" */ decode_arst, encode_arst, set_arst, @@ -765,7 +765,7 @@ attribute_def svr_attr_def[] = }, /* SRV_ATR_AllowNodeSubmit */ - { ATTR_allownodesubmit, /* "allow_node_submit" */ + { (char *)ATTR_allownodesubmit, /* "allow_node_submit" */ decode_b, encode_b, set_b, @@ -778,7 +778,7 @@ attribute_def svr_attr_def[] = }, /* SRV_ATR_AllowProxyUser */ - { ATTR_allowproxyuser, /* "allow_proxy_user" */ + { (char *)ATTR_allowproxyuser, /* "allow_proxy_user" */ decode_b, encode_b, set_b, @@ -791,7 +791,7 @@ attribute_def svr_attr_def[] = }, /* SRV_ATR_AutoNodeNP */ - { ATTR_autonodenp, /* "auto_node_np" */ + { (char *)ATTR_autonodenp, /* "auto_node_np" */ decode_b, encode_b, set_b, @@ -804,7 +804,7 @@ attribute_def svr_attr_def[] = }, /* SRV_ATR_LogFileMaxSize */ - { ATTR_logfilemaxsize, /* "log_file_max_size" */ + { (char *)ATTR_logfilemaxsize, /* "log_file_max_size" */ decode_l, encode_l, set_l, @@ -817,7 +817,7 @@ attribute_def svr_attr_def[] = }, /* SRV_ATR_LogFileRollDepth */ - { ATTR_logfilerolldepth, /* "log_file_roll_depth" */ + { (char *)ATTR_logfilerolldepth, /* "log_file_roll_depth" */ decode_l, encode_l, set_l, @@ -831,7 +831,7 @@ attribute_def svr_attr_def[] = /* SVR_ATR_LogKeepDays */ { - ATTR_logkeepdays, /* "log_keep_days" */ + (char *)ATTR_logkeepdays, /* "log_keep_days" */ decode_l, encode_l, set_l, @@ -844,7 +844,7 @@ attribute_def svr_attr_def[] = }, /* SRV_ATR_NextJobNumber */ - { ATTR_nextjobnum, + { (char *)ATTR_nextjobnum, decode_l, encode_l, set_nextjobnum, @@ -857,7 +857,7 @@ attribute_def svr_attr_def[] = }, /* SRV_ATR_tokens */ - { ATTR_tokens, + { (char *)ATTR_tokens, decode_arst, encode_arst, set_tokens, @@ -870,7 +870,7 @@ attribute_def svr_attr_def[] = }, /* SRV_ATR_NetCounter */ - { ATTR_netcounter, /* "net_counter" */ + { (char *)ATTR_netcounter, /* "net_counter" */ decode_null, encode_str, set_null, @@ -883,7 +883,7 @@ attribute_def svr_attr_def[] = }, /* SRV_ATR_ExtraResc */ - { ATTR_extraresc, /* "extra_resc" */ + { (char *)ATTR_extraresc, /* "extra_resc" */ decode_arst, encode_arst, set_arst, @@ -896,7 +896,7 @@ attribute_def svr_attr_def[] = }, /* SRV_ATR_ServerName */ - { ATTR_servername, /* "server_name" */ + { (char *)ATTR_servername, /* "server_name" */ decode_str, encode_str, set_str, @@ -909,7 +909,7 @@ attribute_def svr_attr_def[] = }, /* SRV_ATR_SchedVersion */ - { ATTR_schedversion, /* "sched_version" */ + { (char *)ATTR_schedversion, /* "sched_version" */ decode_str, encode_str, set_str, @@ -922,7 +922,7 @@ attribute_def svr_attr_def[] = }, /* SRV_ATR_AcctKeepDays */ - { ATTR_acctkeepdays, /* "accounting_keep_days" */ + { (char *)ATTR_acctkeepdays, /* "accounting_keep_days" */ decode_l, encode_l, set_l, @@ -935,7 +935,7 @@ attribute_def svr_attr_def[] = }, /* SRV_ATR_lockfile */ - { ATTR_lockfile, /* "lock_file" */ + { (char *)ATTR_lockfile, /* "lock_file" */ decode_str, encode_str, set_str, @@ -948,7 +948,7 @@ attribute_def svr_attr_def[] = }, /* SRV_ATR_LockfileUpdateTime */ - { ATTR_LockfileUpdateTime, /* lock_file_update_time */ + { (char *)ATTR_LockfileUpdateTime, /* lock_file_update_time */ decode_l, encode_l, set_l, @@ -961,7 +961,7 @@ attribute_def svr_attr_def[] = }, /* SRV_ATR_LockfileCheckTime */ - { ATTR_LockfileCheckTime, /* lock_file_check_time */ + { (char *)ATTR_LockfileCheckTime, /* lock_file_check_time */ decode_l, encode_l, set_l, @@ -974,7 +974,7 @@ attribute_def svr_attr_def[] = }, /* SRV_ATR_CredentialLifetime */ - { ATTR_credentiallifetime, /* "credential_lifetime" */ + { (char *)ATTR_credentiallifetime, /* "credential_lifetime" */ decode_l, encode_l, set_l, @@ -987,7 +987,7 @@ attribute_def svr_attr_def[] = }, /* SRV_ATR_JobMustReport */ - { ATTR_jobmustreport, /* "job_must_report" */ + { (char *)ATTR_jobmustreport, /* "job_must_report" */ decode_b, encode_b, set_b, @@ -1000,7 +1000,7 @@ attribute_def svr_attr_def[] = }, /* SRV_ATR_checkpoint_dir */ - { ATTR_checkpoint_dir, /* "checkpoint_dir" */ + { (char *)ATTR_checkpoint_dir, /* "checkpoint_dir" */ decode_str, encode_str, set_str, @@ -1013,7 +1013,7 @@ attribute_def svr_attr_def[] = }, /* SRV_ATR_display_job_server_suffix */ - { ATTR_dispsvrsuffix, /* "display_job_server_suffix" */ + { (char *)ATTR_dispsvrsuffix, /* "display_job_server_suffix" */ decode_b, encode_b, set_b, @@ -1026,7 +1026,7 @@ attribute_def svr_attr_def[] = }, /* SRV_ATR_job_suffix_alias */ - { ATTR_jobsuffixalias, /* "job_suffix_alias" */ + { (char *)ATTR_jobsuffixalias, /* "job_suffix_alias" */ decode_str, encode_str, set_str, @@ -1039,7 +1039,7 @@ attribute_def svr_attr_def[] = }, /* SRV_ATR_MailSubjectFmt */ - { ATTR_mailsubjectfmt, /* "mail_subject_fmt" */ + { (char *)ATTR_mailsubjectfmt, /* "mail_subject_fmt" */ decode_str, encode_str, set_str, @@ -1052,7 +1052,7 @@ attribute_def svr_attr_def[] = }, /* SRV_ATR_MailBodyFmt */ - { ATTR_mailbodyfmt, /* "mail_body_fmt" */ + { (char *)ATTR_mailbodyfmt, /* "mail_body_fmt" */ decode_str, encode_str, set_str, @@ -1064,7 +1064,7 @@ attribute_def svr_attr_def[] = PARENT_TYPE_SERVER }, /* SRV_ATR_NPDefault */ - { ATTR_npdefault, /* "np_default" */ + { (char *)ATTR_npdefault, /* "np_default" */ decode_l, encode_l, set_l, @@ -1077,7 +1077,7 @@ attribute_def svr_attr_def[] = }, /* SRV_ATR_clonebatchsize */ - { ATTR_clonebatchsize, /* "clone_batch_size" */ + { (char *)ATTR_clonebatchsize, /* "clone_batch_size" */ decode_l, encode_l, set_l, @@ -1090,7 +1090,7 @@ attribute_def svr_attr_def[] = }, /* SRV_ATR_clonebatchdelay */ - { ATTR_clonebatchdelay, /* "clone_batch_delay" */ + { (char *)ATTR_clonebatchdelay, /* "clone_batch_delay" */ decode_l, encode_l, set_l, @@ -1103,7 +1103,7 @@ attribute_def svr_attr_def[] = }, /* SRV_ATR_JobStartTimeout */ - { ATTR_jobstarttimeout, /* "job_start_timeout" */ + { (char *)ATTR_jobstarttimeout, /* "job_start_timeout" */ decode_l, encode_l, set_l, @@ -1116,7 +1116,7 @@ attribute_def svr_attr_def[] = }, /* SRV_ATR_JobForceCancelTime */ - { ATTR_jobforcecanceltime, /* job_force_cancel_time */ + { (char *)ATTR_jobforcecanceltime, /* job_force_cancel_time */ decode_l, encode_l, set_l, @@ -1129,7 +1129,7 @@ attribute_def svr_attr_def[] = }, /* SRV_ATR_MaxArraySize */ - { ATTR_maxarraysize, /* max_job_array_size */ + { (char *)ATTR_maxarraysize, /* max_job_array_size */ decode_l, encode_l, set_l, @@ -1142,7 +1142,7 @@ attribute_def svr_attr_def[] = }, /* SRV_ATR_MaxSlotLimit */ - { ATTR_maxslotlimit, /* max_slot_limit */ + { (char *)ATTR_maxslotlimit, /* max_slot_limit */ decode_l, encode_l, set_l, @@ -1155,7 +1155,7 @@ attribute_def svr_attr_def[] = }, /* SRV_ATR_RecordJobInfo */ - { ATTR_recordjobinfo, /* record_job_info */ + { (char *)ATTR_recordjobinfo, /* record_job_info */ decode_b, encode_b, set_b, @@ -1168,7 +1168,7 @@ attribute_def svr_attr_def[] = }, /* SRV_ATR_RecordJobScript */ - { ATTR_recordjobscript, /* record_job_script */ + { (char *)ATTR_recordjobscript, /* record_job_script */ decode_b, encode_b, set_b, @@ -1181,7 +1181,7 @@ attribute_def svr_attr_def[] = }, /* SRV_ATR_JobLogFileMaxSize */ - {ATTR_joblogfilemaxsize, /* "job_log_file_max_size" */ + {(char *)ATTR_joblogfilemaxsize, /* "job_log_file_max_size" */ decode_l, encode_l, set_l, @@ -1193,7 +1193,7 @@ attribute_def svr_attr_def[] = PARENT_TYPE_SERVER}, /* SRV_ATR_JobLogFileRollDepth */ - {ATTR_joblogfilerolldepth, /* "job_log_file_roll_depth" */ + {(char *)ATTR_joblogfilerolldepth, /* "job_log_file_roll_depth" */ decode_l, encode_l, set_l, @@ -1206,7 +1206,7 @@ attribute_def svr_attr_def[] = /* SVR_ATR_JobLogKeepDays */ { - ATTR_joblogkeepdays, /* "job_log_keep_days" */ + (char *)ATTR_joblogkeepdays, /* "job_log_keep_days" */ decode_l, encode_l, set_l, @@ -1219,7 +1219,7 @@ attribute_def svr_attr_def[] = #ifdef MUNGE_AUTH /* SRV_ATR_authusers */ - {ATTR_authusers, /* "autorized_users" */ + {(char *)ATTR_authusers, /* "autorized_users" */ decode_arst, encode_arst, set_uacl, @@ -1232,7 +1232,7 @@ attribute_def svr_attr_def[] = #endif /* SRV_ATR_minthreads */ - {ATTR_minthreads, /* "min_threads" */ + {(char *)ATTR_minthreads, /* "min_threads" */ decode_l, encode_l, set_l, @@ -1245,7 +1245,7 @@ attribute_def svr_attr_def[] = }, /* SRV_ATR_maxthreads */ - {ATTR_maxthreads, /* "max_threads" */ + {(char *)ATTR_maxthreads, /* "max_threads" */ decode_l, encode_l, set_l, @@ -1258,7 +1258,7 @@ attribute_def svr_attr_def[] = }, /* SRV_ATR_threadidleseconds */ - {ATTR_threadidleseconds, /* "thread_idle_seconds" */ + {(char *)ATTR_threadidleseconds, /* "thread_idle_seconds" */ decode_l, encode_l, set_l, @@ -1271,7 +1271,7 @@ attribute_def svr_attr_def[] = }, /* SRV_ATR_MoabArrayCompatible */ - {ATTR_moabarraycompatible, + {(char *)ATTR_moabarraycompatible, decode_b, encode_b, set_b, @@ -1284,7 +1284,7 @@ attribute_def svr_attr_def[] = }, /* SRV_ATR_NoMailForce */ - {ATTR_nomailforce, /* "no_mail_force" */ + {(char *)ATTR_nomailforce, /* "no_mail_force" */ decode_b, encode_b, set_b, @@ -1296,7 +1296,7 @@ attribute_def svr_attr_def[] = PARENT_TYPE_SERVER}, /* SRV_ATR_CrayEnabled */ - {ATTR_crayenabled, /* "cray_enabled" */ + {(char *)ATTR_crayenabled, /* "cray_enabled" */ decode_b, encode_b, set_b, @@ -1308,7 +1308,7 @@ attribute_def svr_attr_def[] = PARENT_TYPE_SERVER}, /* SRV_ATR_InteractiveJobsCanRoam */ /* NOTE: this only has effect if pbs_server is cray enabled */ - {ATTR_interactivejobscanroam, /* "interactive_jobs_can_roam" */ + {(char *)ATTR_interactivejobscanroam, /* "interactive_jobs_can_roam" */ decode_b, encode_b, set_b, @@ -1320,7 +1320,7 @@ attribute_def svr_attr_def[] = PARENT_TYPE_SERVER}, /* SRV_ATR_MaxUserQueuable */ - {ATTR_maxuserqueuable, /* "max_user_queuable" */ + {(char *)ATTR_maxuserqueuable, /* "max_user_queuable" */ decode_l, encode_l, set_l, diff --git a/src/server/svr_chk_owner.c b/src/server/svr_chk_owner.c index 794cddfc5e..2571fc0dff 100644 --- a/src/server/svr_chk_owner.c +++ b/src/server/svr_chk_owner.c @@ -575,7 +575,7 @@ void chk_job_req_permissions( req_reject(PBSE_PERM, 0, preq, NULL, "operation not permitted"); - unlock_ji_mutex(pjob, __func__, "1", LOGLEVEL); + unlock_ji_mutex(pjob, __func__, (char *)"1", LOGLEVEL); *pjob_ptr = NULL; } @@ -608,7 +608,7 @@ void chk_job_req_permissions( req_reject(PBSE_BADSTATE, 0, preq, NULL, tmpLine); - unlock_ji_mutex(pjob, __func__, "2", LOGLEVEL); + unlock_ji_mutex(pjob, __func__, (char *)"2", LOGLEVEL); *pjob_ptr = NULL; diff --git a/src/server/svr_func.c b/src/server/svr_func.c index 85bc632628..0dd22509c7 100644 --- a/src/server/svr_func.c +++ b/src/server/svr_func.c @@ -244,7 +244,7 @@ void set_resc_assigned( pque->qu_qs.qu_name); log_err(-1, __func__, log_buf); - unlock_queue(pque, __func__, NULL, LOGLEVEL); + unlock_queue(pque, __func__, (char *)NULL, LOGLEVEL); return; } @@ -252,7 +252,7 @@ void set_resc_assigned( { if (pjob->ji_qs.ji_svrflags & JOB_SVFLG_RescAssn) { - unlock_queue(pque, __func__, NULL, LOGLEVEL); + unlock_queue(pque, __func__, (char *)NULL, LOGLEVEL); return; /* already added in */ } @@ -262,7 +262,7 @@ void set_resc_assigned( { if ((pjob->ji_qs.ji_svrflags & JOB_SVFLG_RescAssn) == 0) { - unlock_queue(pque, __func__, NULL, LOGLEVEL); + unlock_queue(pque, __func__, (char *)NULL, LOGLEVEL); return; /* not currently included */ } @@ -270,7 +270,7 @@ void set_resc_assigned( } else { - unlock_queue(pque, __func__, NULL, LOGLEVEL); + unlock_queue(pque, __func__, (char *)NULL, LOGLEVEL); return; /* invalid op */ } @@ -298,7 +298,7 @@ void set_resc_assigned( if (pr == NULL) { - unlock_queue(pque, __func__, "sysru", LOGLEVEL); + unlock_queue(pque, __func__, (char *)"sysru", LOGLEVEL); return; } } @@ -315,7 +315,7 @@ void set_resc_assigned( if (pr == NULL) { - unlock_queue(pque, __func__, "queru", LOGLEVEL); + unlock_queue(pque, __func__, (char *)"queru", LOGLEVEL); return; } } @@ -326,7 +326,7 @@ void set_resc_assigned( jobrsc = (resource *)GET_NEXT(jobrsc->rs_link); } /* END while (jobrsc != NULL) */ - unlock_queue(pque, __func__, "success", LOGLEVEL); + unlock_queue(pque, __func__, (char *)"success", LOGLEVEL); } else if (pjob == NULL) { diff --git a/src/server/svr_func.h b/src/server/svr_func.h index cfa164e314..17836d4ed9 100644 --- a/src/server/svr_func.h +++ b/src/server/svr_func.h @@ -14,7 +14,7 @@ int ck_checkpoint(pbs_attribute *pattr, void *pobject, int mode); int decode_null(pbs_attribute *patr, char *name, char *rn, char *val, int perm); -int set_null(pbs_attribute *pattr, pbs_attribute *new, enum batch_op op); +int set_null(pbs_attribute *pattr, pbs_attribute *new_attr, enum batch_op op); int poke_scheduler(pbs_attribute *pattr, void *pobj, int actmode); diff --git a/src/server/svr_jobfunc.c b/src/server/svr_jobfunc.c index ac1e304d54..ba9ce0d186 100644 --- a/src/server/svr_jobfunc.c +++ b/src/server/svr_jobfunc.c @@ -297,7 +297,7 @@ int insert_into_alljobs_by_rank( long job_qrank = pjob->ji_wattr[JOB_ATR_qrank].at_val.at_long; int index = -1; - unlock_ji_mutex(pjob, __func__, "4", LOGLEVEL); + unlock_ji_mutex(pjob, __func__, (char *)"4", LOGLEVEL); while ((pjcur = next_job_from_back(aj, &iter)) != NULL) { @@ -308,17 +308,17 @@ int insert_into_alljobs_by_rank( if (strcmp(jobid, pjcur->ji_qs.ji_jobid) == 0) { - unlock_ji_mutex(pjcur, __func__, "6", LOGLEVEL); + unlock_ji_mutex(pjcur, __func__, (char *)"6", LOGLEVEL); return(ALREADY_IN_LIST); } - unlock_ji_mutex(pjcur, __func__, "7", LOGLEVEL); + unlock_ji_mutex(pjcur, __func__, (char *)"7", LOGLEVEL); } if (pjcur != NULL) { index = get_jobs_index(aj, pjcur); - unlock_ji_mutex(pjcur, __func__, "8", LOGLEVEL); + unlock_ji_mutex(pjcur, __func__, (char *)"8", LOGLEVEL); pjcur = NULL; } @@ -370,7 +370,7 @@ int svr_enquejob( strcpy(job_id, pjob->ji_qs.ji_jobid); /* ji_qs.ji_queue now holds the name of the destination queue */ strcpy(queue_name, pjob->ji_qs.ji_queue); - unlock_ji_mutex(pjob, __func__, "1", LOGLEVEL); + unlock_ji_mutex(pjob, __func__, (char *)"1", LOGLEVEL); pque = find_queuebyname(queue_name); if (pque == NULL) @@ -380,12 +380,12 @@ int svr_enquejob( /* This is called when a job is not yet in the queue, * so svr_find_job can not be used.... */ - lock_ji_mutex(pjob, __func__, NULL, LOGLEVEL); + lock_ji_mutex(pjob, __func__, (char *)NULL, LOGLEVEL); if (pjob->ji_being_recycled == TRUE) { - unlock_queue(pque, __func__, NULL, 0); - unlock_ji_mutex(pjob, __func__, "2", LOGLEVEL); + unlock_queue(pque, __func__, (char *)NULL, 0); + unlock_ji_mutex(pjob, __func__, (char *)"2", LOGLEVEL); return(PBSE_JOB_RECYCLED); } @@ -402,8 +402,8 @@ int svr_enquejob( total_jobs = count_queued_jobs(pque, NULL); if (total_jobs + array_jobs >= pque->qu_attr[QA_ATR_MaxJobs].at_val.at_long) { - unlock_queue(pque, __func__, "1", LOGLEVEL); - unlock_ji_mutex(pjob, __func__, "3", LOGLEVEL); + unlock_queue(pque, __func__, (char *)"1", LOGLEVEL); + unlock_ji_mutex(pjob, __func__, (char *)"3", LOGLEVEL); return(PBSE_MAXQUED); } } @@ -414,8 +414,8 @@ int svr_enquejob( user_jobs = count_queued_jobs(pque, pjob->ji_wattr[JOB_ATR_job_owner].at_val.at_str); if (user_jobs >= pque->qu_attr[QA_ATR_MaxUserJobs].at_val.at_long) { - unlock_queue(pque, __func__, "1", LOGLEVEL); - unlock_ji_mutex(pjob, __func__, "3", LOGLEVEL); + unlock_queue(pque, __func__, (char *)"1", LOGLEVEL); + unlock_ji_mutex(pjob, __func__, (char *)"3", LOGLEVEL); return(PBSE_MAXUSERQUED); } } @@ -475,7 +475,7 @@ int svr_enquejob( if ((rc == ALREADY_IN_LIST) || (rc == PBSE_JOBNOTFOUND)) { - unlock_queue(pque, __func__, "not array_template check", LOGLEVEL); + unlock_queue(pque, __func__, (char *)"not array_template check", LOGLEVEL); if (rc == ALREADY_IN_LIST) rc = PBSE_NONE; @@ -498,7 +498,7 @@ int svr_enquejob( if ((rc == ALREADY_IN_LIST) || (rc == PBSE_JOBNOTFOUND)) { - unlock_queue(pque, __func__, "not array_template check", LOGLEVEL); + unlock_queue(pque, __func__, (char *)"not array_template check", LOGLEVEL); if (rc == ALREADY_IN_LIST) rc = PBSE_NONE; @@ -566,7 +566,7 @@ int svr_enquejob( &pque->qu_attr[QE_ATR_checkpoint_min]); /* do anything needed doing regarding job dependencies */ - unlock_queue(pque, __func__, "anything", LOGLEVEL); + unlock_queue(pque, __func__, (char *)"anything", LOGLEVEL); if ((pjob->ji_qs.ji_state != JOB_STATE_COMPLETE) && (pjob->ji_qs.ji_substate != JOB_SUBSTATE_COMPLETE) && @@ -605,10 +605,10 @@ int svr_enquejob( /* must be set to 1 so that routing is attempted */ pjob->ji_qs.ji_un.ji_routet.ji_rteretry = 1; - unlock_queue(pque, __func__, "route job", LOGLEVEL); + unlock_queue(pque, __func__, (char *)"route job", LOGLEVEL); } else - unlock_queue(pque, __func__, "pull queue", LOGLEVEL); + unlock_queue(pque, __func__, (char *)"pull queue", LOGLEVEL); return(PBSE_NONE); } /* END svr_enquejob() */ @@ -651,7 +651,7 @@ int svr_dequejob( if ((pjob == NULL) || (pque == NULL)) { - log_err(PBSE_JOBNOTFOUND, __func__, "Job lost while acquiring queue 10"); + log_err(PBSE_JOBNOTFOUND, __func__, (char *)"Job lost while acquiring queue 10"); return(PBSE_JOBNOTFOUND); } } @@ -699,7 +699,7 @@ int svr_dequejob( pjob->ji_qhdr = NULL; if (parent_queue_mutex_held == FALSE) - unlock_queue(pque, __func__, NULL, LOGLEVEL); + unlock_queue(pque, __func__, (char *)NULL, LOGLEVEL); } #ifndef NDEBUG @@ -715,12 +715,12 @@ int svr_dequejob( char queue_name[PBS_MAXQUEUENAME]; /* this function will lock queues and jobs */ - unlock_ji_mutex(pjob, __func__, NULL, 0); + unlock_ji_mutex(pjob, __func__, (char *)NULL, 0); if (parent_queue_mutex_held == TRUE) { strcpy(queue_name, pque->qu_qs.qu_name); - unlock_queue(pque, __func__, NULL, LOGLEVEL); + unlock_queue(pque, __func__, (char *)NULL, LOGLEVEL); } correct_ct(); @@ -873,7 +873,7 @@ int svr_setjobstate( if (pjob == NULL) { - log_err(PBSE_JOBNOTFOUND, __func__, "Job lost while acquiring queue 11"); + log_err(PBSE_JOBNOTFOUND, __func__, (char *)"Job lost while acquiring queue 11"); return(PBSE_JOBNOTFOUND); } } @@ -918,7 +918,7 @@ int svr_setjobstate( } if (has_queue_mutex == FALSE) - unlock_queue(pque, __func__, NULL, LOGLEVEL); + unlock_queue(pque, __func__, (char *)NULL, LOGLEVEL); } } } /* END if (pjob->ji_qs.ji_substate != JOB_SUBSTATE_TRANSICM) */ @@ -1143,12 +1143,12 @@ int chk_svr_resc_limit( if (EMsg != NULL) EMsg[0] = '\0'; - noderesc = find_resc_def(svr_resc_def, "nodes", svr_resc_size); - needresc = find_resc_def(svr_resc_def, "neednodes", svr_resc_size); - nodectresc = find_resc_def(svr_resc_def, "nodect", svr_resc_size); - mppwidthresc = find_resc_def(svr_resc_def, "mppwidth", svr_resc_size); - mppnppn = find_resc_def(svr_resc_def, "mppnppn", svr_resc_size); - procresc = find_resc_def(svr_resc_def, "procs", svr_resc_size); + noderesc = (resource_def *)find_resc_def(svr_resc_def, "nodes", svr_resc_size); + needresc = (resource_def *)find_resc_def(svr_resc_def, "neednodes", svr_resc_size); + nodectresc = (resource_def *)find_resc_def(svr_resc_def, "nodect", svr_resc_size); + mppwidthresc = (resource_def *)find_resc_def(svr_resc_def, "mppwidth", svr_resc_size); + mppnppn = (resource_def *)find_resc_def(svr_resc_def, "mppnppn", svr_resc_size); + procresc = (resource_def *)find_resc_def(svr_resc_def, "procs", svr_resc_size); SvrNodeCt = 0; @@ -1192,7 +1192,7 @@ int chk_svr_resc_limit( { qurc = find_resc_entry(&pque->qu_attr[QA_ATR_ResourceMax], jbrc->rs_defin); - LimitName = (jbrc->rs_defin->rs_name == NULL)?"resource":jbrc->rs_defin->rs_name; + LimitName = (jbrc->rs_defin->rs_name == NULL)?(char *)"resource":jbrc->rs_defin->rs_name; pthread_mutex_lock(server.sv_attr_mutex); cmpwith = get_resource(&pque->qu_attr[QA_ATR_ResourceMax], @@ -1963,13 +1963,13 @@ int svr_chkque( if ((pque->qu_attr[QA_ATR_MaxJobs].at_flags & ATR_VFLAG_SET)) { - unlock_ji_mutex(pjob, __func__, "1", LOGLEVEL); + unlock_ji_mutex(pjob, __func__, (char *)"1", LOGLEVEL); total_jobs = count_queued_jobs(pque, NULL); - lock_ji_mutex(pjob, __func__, "1", LOGLEVEL); + lock_ji_mutex(pjob, __func__, (char *)"1", LOGLEVEL); if (pjob->ji_being_recycled == TRUE) { - unlock_ji_mutex(pjob, __func__, "1", LOGLEVEL); + unlock_ji_mutex(pjob, __func__, (char *)"1", LOGLEVEL); return(PBSE_JOB_RECYCLED); } @@ -1990,15 +1990,15 @@ int svr_chkque( (pque->qu_attr[QA_ATR_MaxUserJobs].at_val.at_long >= 0)) { /* count number of jobs user has in queue */ - unlock_ji_mutex(pjob, __func__, NULL, 0); + unlock_ji_mutex(pjob, __func__, (char *)NULL, 0); user_jobs = count_queued_jobs(pque, pjob->ji_wattr[JOB_ATR_job_owner].at_val.at_str); - lock_ji_mutex(pjob, __func__, "1", LOGLEVEL); + lock_ji_mutex(pjob, __func__, (char *)"1", LOGLEVEL); if (pjob->ji_being_recycled == TRUE) { - unlock_ji_mutex(pjob, __func__, "1", LOGLEVEL); + unlock_ji_mutex(pjob, __func__, (char *)"1", LOGLEVEL); return(PBSE_JOB_RECYCLED); } @@ -2160,7 +2160,7 @@ void job_wait_over( if (jobid == NULL) { - log_err(ENOMEM, __func__, "Cannot allocate memory"); + log_err(ENOMEM, __func__, (char *)"Cannot allocate memory"); return; } @@ -2183,7 +2183,7 @@ void job_wait_over( /* recreate the work task entry */ set_task(WORK_Timed, when, job_wait_over, strdup(pjob->ji_qs.ji_jobid), FALSE); - unlock_ji_mutex(pjob, __func__, "1", LOGLEVEL); + unlock_ji_mutex(pjob, __func__, (char *)"1", LOGLEVEL); return; } @@ -2201,7 +2201,7 @@ void job_wait_over( svr_evaljobstate(pjob, &newstate, &newsub, 0); svr_setjobstate(pjob, newstate, newsub, FALSE); - unlock_ji_mutex(pjob, __func__, "2", LOGLEVEL); + unlock_ji_mutex(pjob, __func__, (char *)"2", LOGLEVEL); } return; @@ -2542,7 +2542,7 @@ void set_resc_deflt( pque = get_jobs_queue(&pjob); if (pjob == NULL) { - log_err(PBSE_JOBNOTFOUND, __func__, "Job lost while acquiring queue 12"); + log_err(PBSE_JOBNOTFOUND, __func__, (char *)"Job lost while acquiring queue 12"); return; } } @@ -2569,7 +2569,7 @@ void set_resc_deflt( #endif pthread_mutex_unlock(server.sv_attr_mutex); - unlock_queue(pque, __func__, NULL, LOGLEVEL); + unlock_queue(pque, __func__, (char *)NULL, LOGLEVEL); } for (i = 0;i < JOB_ATR_LAST;++i) @@ -2590,11 +2590,11 @@ void set_resc_deflt( if ((pque = get_jobs_queue(&pjob)) != NULL) { if (has_queue_mutex == FALSE) - unlock_queue(pque, __func__, NULL, LOGLEVEL); + unlock_queue(pque, __func__, (char *)NULL, LOGLEVEL); } else if (pjob == NULL) { - log_err(PBSE_JOBNOTFOUND, __func__, "Job lost while acquiring queue 13"); + log_err(PBSE_JOBNOTFOUND, __func__, (char *)"Job lost while acquiring queue 13"); } return; @@ -2820,10 +2820,10 @@ void correct_ct() if (pjob->ji_qs.ji_state == JOB_STATE_COMPLETE) pque->qu_numcompleted++; - unlock_ji_mutex(pjob, __func__, "1", LOGLEVEL); + unlock_ji_mutex(pjob, __func__, (char *)"1", LOGLEVEL); } - unlock_queue(pque, __func__, NULL, LOGLEVEL); + unlock_queue(pque, __func__, (char *)NULL, LOGLEVEL); } /* END for each queue */ sprintf(log_buf, "%s:2", __func__); diff --git a/src/server/svr_movejob.c b/src/server/svr_movejob.c index 19b95685d2..ba9ea4a90e 100644 --- a/src/server/svr_movejob.c +++ b/src/server/svr_movejob.c @@ -299,7 +299,7 @@ int local_move( if (pjob == NULL) { - log_err(PBSE_JOBNOTFOUND, __func__, "Job lost while acquiring queue 14"); + log_err(PBSE_JOBNOTFOUND, __func__, (char *)"Job lost while acquiring queue 14"); return(PBSE_JOBNOTFOUND); } } @@ -319,11 +319,11 @@ int local_move( if (get_parent_dest_queues(pjob->ji_qs.ji_queue, destination, &routing_que, &dest_que, &pjob) != PBSE_NONE) { if (dest_que != NULL) - unlock_queue(dest_que, __func__, NULL, 0); + unlock_queue(dest_que, __func__, (char *)NULL, 0); if ((parent_queue_mutex_held == FALSE) && (routing_que != NULL)) - unlock_queue(routing_que, __func__, NULL, 0); + unlock_queue(routing_que, __func__, (char *)NULL, 0); if (pjob == NULL) return(-10); @@ -356,11 +356,11 @@ int local_move( dest_que, get_variable(pjob, pbs_o_host), mtype, NULL))) { - unlock_queue(dest_que, __func__, NULL, 0); + unlock_queue(dest_que, __func__, (char *)NULL, 0); /* should this queue be retried? */ if (parent_queue_mutex_held == FALSE) - unlock_queue(routing_que, __func__, "retry", LOGLEVEL); + unlock_queue(routing_que, __func__, (char *)"retry", LOGLEVEL); return(should_retry_route(*my_err)); } @@ -369,7 +369,7 @@ int local_move( /* queue_rank for new queue and enqueue into destination */ strcpy(job_id, pjob->ji_qs.ji_jobid); - unlock_ji_mutex(pjob, __func__, "1", LOGLEVEL); + unlock_ji_mutex(pjob, __func__,(char *)"1", LOGLEVEL); /* if we come out of svr_dequejob successfully pjob->ji_mutex will be locked */ rc = svr_dequejob(job_id, TRUE); @@ -380,8 +380,8 @@ int local_move( pjob->ji_wattr[JOB_ATR_qrank].at_val.at_long = ++queue_rank; - unlock_queue(dest_que, __func__, NULL, 0); - unlock_queue(routing_que, __func__, "success", LOGLEVEL); + unlock_queue(dest_que, __func__, (char *)NULL, 0); + unlock_queue(routing_que, __func__, (char *)"success", LOGLEVEL); if ((*my_err = svr_enquejob(pjob, FALSE, -1)) == PBSE_JOB_RECYCLED) return(-1); @@ -390,7 +390,7 @@ int local_move( { /* re-lock the routing queue */ if ((tmp_que = lock_queue_with_job_held(routing_que, &pjob)) == NULL) - lock_queue(routing_que, __func__, NULL, 0); + lock_queue(routing_que, __func__, (char *)NULL, 0); else routing_que = tmp_que; } @@ -454,7 +454,7 @@ void finish_routing_processing( svr_mailowner(pjob, 'a', TRUE, "Coudln't route job to remote server"); - unlock_ji_mutex(pjob, __func__, "1", LOGLEVEL); + unlock_ji_mutex(pjob, __func__, (char *)"1", LOGLEVEL); return; } @@ -480,9 +480,9 @@ void finish_routing_processing( else if (status != 0) job_abt(&pjob, msg_routexceed); else - unlock_ji_mutex(pjob, __func__, "2", LOGLEVEL); + unlock_ji_mutex(pjob, __func__, (char *)"2", LOGLEVEL); - unlock_queue(pque, __func__, NULL, LOGLEVEL); + unlock_queue(pque, __func__, (char *)NULL, LOGLEVEL); } else if (pjob != NULL) { @@ -557,7 +557,7 @@ void finish_moving_processing( svr_evaljobstate(pjob, &newstate, &newsub, 1); svr_setjobstate(pjob, newstate, newsub, FALSE); - unlock_ji_mutex(pjob, __func__, "3", LOGLEVEL); + unlock_ji_mutex(pjob, __func__, (char *)"3", LOGLEVEL); } req_reject(status, 0, req, NULL, NULL); @@ -613,7 +613,7 @@ void finish_move_process( case MOVE_TYPE_Exec: - unlock_ji_mutex(pjob, __func__, "1", LOGLEVEL); + unlock_ji_mutex(pjob, __func__, (char *)"1", LOGLEVEL); pjob = NULL; finish_sendmom(job_id, preq, time, node_name, status, mom_err); @@ -622,7 +622,7 @@ void finish_move_process( } if (pjob != NULL) - unlock_ji_mutex(pjob, __func__, "2", LOGLEVEL); + unlock_ji_mutex(pjob, __func__, (char *)"2", LOGLEVEL); } /* END finish_move_process() */ @@ -749,7 +749,7 @@ int send_job_work( encode_type = ATR_ENCODE_SVR; /* clear default resource settings */ - unlock_ji_mutex(pjob, __func__, "1", LOGLEVEL); + unlock_ji_mutex(pjob, __func__, (char *)"1", LOGLEVEL); ret = svr_dequejob(job_id, FALSE); if (ret) return(ret); @@ -784,7 +784,7 @@ int send_job_work( { snprintf(script_name, sizeof(script_name), "%s%s%s", path_jobs, pa->ai_qs.fileprefix, JOB_SCRIPT_SUFFIX); - unlock_ai_mutex(pa, __func__, NULL, LOGLEVEL); + unlock_ai_mutex(pa, __func__, (char *)NULL, LOGLEVEL); } else if (pjob == NULL) return(PBSE_JOB_RECYCLED); @@ -801,7 +801,7 @@ int send_job_work( (get_job_file_path(pjob ,StdErr, stderr_path, sizeof(stderr_path)) != 0) || (get_job_file_path(pjob, Checkpoint, chkpt_path, sizeof(chkpt_path)) != 0)) { - unlock_ji_mutex(pjob, __func__, "2", LOGLEVEL); + unlock_ji_mutex(pjob, __func__, (char *)"2", LOGLEVEL); goto send_job_work_end; } } @@ -817,7 +817,7 @@ int send_job_work( change_substate_on_attempt_to_queue = TRUE; } - unlock_ji_mutex(pjob, __func__, "3", LOGLEVEL); + unlock_ji_mutex(pjob, __func__, (char *)"3", LOGLEVEL); for (NumRetries = 0;NumRetries < RETRY;NumRetries++) { @@ -863,7 +863,7 @@ int send_job_work( if (con == PBS_LOCAL_CONNECTION) { - log_err(-1, __func__, "attempting to run the job on pbs_server???"); + log_err(-1, __func__, (char *)"attempting to run the job on pbs_server???"); return(PBSE_SYSTEM); } @@ -878,7 +878,7 @@ int send_job_work( { pjob->ji_qs.ji_substate = JOB_SUBSTATE_TRNOUT; job_save(pjob, SAVEJOB_QUICK, 0); - unlock_ji_mutex(pjob, __func__, "4", LOGLEVEL); + unlock_ji_mutex(pjob, __func__, (char *)"4", LOGLEVEL); } else break; @@ -942,7 +942,7 @@ int send_job_work( { pjob->ji_qs.ji_substate = JOB_SUBSTATE_TRNOUTCM; job_save(pjob, SAVEJOB_QUICK, 0); - unlock_ji_mutex(pjob, __func__, "5", LOGLEVEL); + unlock_ji_mutex(pjob, __func__, (char *)"5", LOGLEVEL); } else break; @@ -1020,7 +1020,7 @@ int send_job_work( { pjob->ji_wattr[JOB_ATR_session_id].at_val.at_long = sid; pjob->ji_wattr[JOB_ATR_session_id].at_flags |= ATR_VFLAG_SET; - unlock_ji_mutex(pjob, __func__, "6", LOGLEVEL); + unlock_ji_mutex(pjob, __func__, (char *)"6", LOGLEVEL); } else { @@ -1107,7 +1107,7 @@ void *send_job( if (pjob != NULL) { job_momaddr = pjob->ji_qs.ji_un.ji_exect.ji_momaddr; - unlock_ji_mutex(pjob, __func__, "1", LOGLEVEL); + unlock_ji_mutex(pjob, __func__, (char *)"1", LOGLEVEL); if (LOGLEVEL >= 6) { @@ -1196,7 +1196,7 @@ int net_move( else { /* FAILURE */ - log_err(ENOMEM,"req_runjob","Cannot allocate space for arguments"); + log_err(ENOMEM,"req_runjob", (char *)"Cannot allocate space for arguments"); return(ENOMEM); } diff --git a/src/server/svr_recov.c b/src/server/svr_recov.c index 572db327d0..9161585338 100644 --- a/src/server/svr_recov.c +++ b/src/server/svr_recov.c @@ -180,9 +180,9 @@ int svr_recov( unlock_sv_qs_mutex(server.sv_qs_mutex, log_buf); if (i < 0) - log_err(errno, __func__, "read of serverdb failed"); + log_err(errno, __func__, (char *)"read of serverdb failed"); else - log_err(errno, __func__, "short read of serverdb"); + log_err(errno, __func__, (char *)"short read of serverdb"); close(sdb); @@ -204,7 +204,7 @@ int svr_recov( !read_only) != 0 ) { unlock_sv_qs_mutex(server.sv_qs_mutex, log_buf); - log_err(errno, __func__, "error on recovering server attr"); + log_err(errno, __func__, (char *)"error on recovering server attr"); close(sdb); @@ -511,7 +511,7 @@ int str_to_attr( (val == NULL) || (attr == NULL)) { - log_err(-1, __func__, "Illegal NULL pointer argument"); + log_err(-1, __func__, (char *)"Illegal NULL pointer argument"); return(-10); } @@ -554,7 +554,7 @@ int str_to_attr( if (attr[index].at_val.at_str == NULL) { - log_err(PBSE_SYSTEM, __func__, "Cannot allocate memory\n"); + log_err(PBSE_SYSTEM, __func__, (char *)"Cannot allocate memory\n"); return(PBSE_SYSTEM); } @@ -769,7 +769,7 @@ int svr_recov_xml( if (end == NULL) { /* no server tag???? */ - log_err(-1, __func__, "No server tag found in the database file???"); + log_err(-1, __func__, (char *)"No server tag found in the database file???"); close(sdb); return(-1); @@ -1056,7 +1056,7 @@ int save_acl( if (i < 0) { - log_err(-1, this_function_name, "unable to encode acl"); + log_err(-1, this_function_name, (char *)"unable to encode acl"); close(fds); @@ -1076,7 +1076,7 @@ int save_acl( if ((i == -1) && (errno == EINTR)) continue; - log_err(errno, this_function_name, "wrote incorrect amount"); + log_err(errno, this_function_name, (char *)"wrote incorrect amount"); close(fds); @@ -1094,7 +1094,7 @@ int save_acl( if (link(filename2, filename1) < 0) { - log_err(errno, this_function_name, "unable to relink file"); + log_err(errno, this_function_name, (char *)"unable to relink file"); return(-1); } @@ -1182,7 +1182,7 @@ void recov_acl( if (read(fds, buf, (unsigned int)sb.st_size) != (int)sb.st_size) { - log_err(errno, this_function_name, "unable to read acl file"); + log_err(errno, this_function_name, (char *)"unable to read acl file"); close(fds); free(buf); diff --git a/src/server/svr_task.c b/src/server/svr_task.c index feda07b8b0..7abc14f4ba 100644 --- a/src/server/svr_task.c +++ b/src/server/svr_task.c @@ -148,7 +148,7 @@ struct work_task *set_task( enum work_type type, long event_id, /* I - based on type can be time of event */ - void (*func)(), + void (*func)(work_task *), void *parm, int get_lock) @@ -306,14 +306,14 @@ void initialize_all_tasks_array( if (at->ra == NULL) { - log_err(ENOMEM, __func__, "Cannot allocate space for array...FAILURE"); + log_err(ENOMEM, __func__, (char *)"Cannot allocate space for array...FAILURE"); } at->alltasks_mutex = calloc(1, sizeof(pthread_mutex_t)); if (at->alltasks_mutex == NULL) { - log_err(ENOMEM, __func__, "Cannot allocate space for mutex...FAILURE"); + log_err(ENOMEM, __func__, (char *)"Cannot allocate space for mutex...FAILURE"); } else { @@ -376,7 +376,7 @@ int insert_task( if ((rc = insert_thing(at->ra,wt)) == -1) { rc = ENOMEM; - log_err(rc, __func__, "Cannot allocate space to resize the array"); + log_err(rc, __func__, (char *)"Cannot allocate space to resize the array"); } wt->wt_tasklist = at; @@ -430,7 +430,7 @@ int insert_task_before( if ((rc = insert_thing_before(at->ra,before,i)) == -1) { rc = ENOMEM; - log_err(rc, __func__, "Cannot allocate space to resize the array"); + log_err(rc, __func__, (char *)"Cannot allocate space to resize the array"); } else rc = PBSE_NONE; @@ -460,7 +460,7 @@ int insert_task_first( if ((rc = insert_thing_after(at->ra,wt,ALWAYS_EMPTY_INDEX)) == -1) { rc = ENOMEM; - log_err(rc, __func__, "Cannot allocate space to resize the array"); + log_err(rc, __func__, (char *)"Cannot allocate space to resize the array"); } wt->wt_tasklist = at; diff --git a/src/server/svr_task.h b/src/server/svr_task.h index 99ddc1be03..20d6c570c9 100644 --- a/src/server/svr_task.h +++ b/src/server/svr_task.h @@ -4,7 +4,7 @@ #include "work_task.h" /* work_type, work_task, all_tasks */ -struct work_task *set_task(enum work_type type, long event_id, void (*func)(), void *parm, int get_lock); +struct work_task *set_task(enum work_type type, long event_id, void (*func)(work_task *), void *parm, int get_lock); int task_is_in_threadpool(struct work_task *ptask); diff --git a/src/server/test/process_alps_status/scaffolding.c b/src/server/test/process_alps_status/scaffolding.c index c1b244acf2..db2e5dc536 100644 --- a/src/server/test/process_alps_status/scaffolding.c +++ b/src/server/test/process_alps_status/scaffolding.c @@ -1516,7 +1516,7 @@ int initialize_pbsnode( pnode->nd_mutex = (pthread_mutex_t *)calloc(1, sizeof(pthread_mutex_t)); if (pnode->nd_mutex == NULL) { - log_err(ENOMEM, __func__, "Could not allocate memory for the node's mutex"); + log_err(ENOMEM, __func__, (char *)"Could not allocate memory for the node's mutex"); return(ENOMEM); } @@ -1563,7 +1563,7 @@ int check_and_resize( if ((tmp = realloc(ra->slots,size)) == NULL) { - log_err(ENOMEM,id,"No memory left to resize the array"); + log_err(ENOMEM,id, (char *)"No memory left to resize the array"); return(ENOMEM); } diff --git a/src/server/test/track_alps_reservations/scaffolding.c b/src/server/test/track_alps_reservations/scaffolding.c index 70014761b8..e92332698d 100644 --- a/src/server/test/track_alps_reservations/scaffolding.c +++ b/src/server/test/track_alps_reservations/scaffolding.c @@ -69,7 +69,7 @@ int check_and_resize( if ((tmp = realloc(ra->slots,size)) == NULL) { - log_err(ENOMEM,id,"No memory left to resize the array"); + log_err(ENOMEM,id, (char *)"No memory left to resize the array"); return(ENOMEM); } diff --git a/src/server/track_alps_reservations.c b/src/server/track_alps_reservations.c index dfcbdb8f39..c7785d5405 100644 --- a/src/server/track_alps_reservations.c +++ b/src/server/track_alps_reservations.c @@ -254,7 +254,7 @@ int is_orphaned( if (pjob->ji_qs.ji_state == JOB_STATE_COMPLETE) orphaned = TRUE; - unlock_ji_mutex(pjob, __func__, "1", LOGLEVEL); + unlock_ji_mutex(pjob, __func__, (char *)"1", LOGLEVEL); } else orphaned = TRUE; diff --git a/src/server/user_info.c b/src/server/user_info.c index d591869236..31baf37cb6 100644 --- a/src/server/user_info.c +++ b/src/server/user_info.c @@ -202,7 +202,7 @@ int increment_queued_jobs( if ((index = insert_thing(uih->ui_ra, ui)) == -1) { rc = ENOMEM; - log_err(rc, __func__, "Can't resize the user info array"); + log_err(rc, __func__, (char *)"Can't resize the user info array"); } else { From f3690905adf2762bc994b285bdd3a83019c229d4 Mon Sep 17 00:00:00 2001 From: Daniel Hardman Date: Mon, 10 Dec 2012 08:40:25 -0700 Subject: [PATCH 03/20] first attempt at unit test for job_route.c --- src/server/test/job_route/test_job_route.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/server/test/job_route/test_job_route.c b/src/server/test/job_route/test_job_route.c index a9d88c1117..4dd7bffb4c 100644 --- a/src/server/test/job_route/test_job_route.c +++ b/src/server/test/job_route/test_job_route.c @@ -4,6 +4,18 @@ #include #include #include "pbs_error.h" + + +START_TEST(test_add_dest_null) + { + // This used to cause a seg fault. If it executes without + // crashing, the test passes. + add_dest(NULL); + } +END_TEST + + + START_TEST(test_one) { From 5d3fa74266ae4dfdd991d738c8fb70c9e46ddf75 Mon Sep 17 00:00:00 2001 From: Ken Nielson Date: Mon, 10 Dec 2012 10:18:52 -0700 Subject: [PATCH 04/20] rpp was removed in the previous commit but includes for rpp.h were not removed. This commit fixes that problem. --- src/cmds/pbspoe.c | 6 +++++- src/lib/Libdis/disrcs.c | 1 - src/lib/Libdis/disrd.c | 1 - src/lib/Libdis/disrf.c | 1 - src/lib/Libdis/disrfcs.c | 1 - src/lib/Libdis/disrfst.c | 1 - src/lib/Libdis/disrl.c | 1 - src/lib/Libdis/disrl_.c | 1 - src/lib/Libdis/disrsc.c | 1 - src/lib/Libdis/disrsi.c | 1 - src/lib/Libdis/disrsi_.c | 1 - src/lib/Libdis/disrsl.c | 1 - src/lib/Libdis/disrsl_.c | 1 - src/lib/Libdis/disrss.c | 1 - src/lib/Libdis/disrst.c | 1 - src/lib/Libdis/disruc.c | 1 - src/lib/Libdis/disrui.c | 1 - src/lib/Libdis/disrul.c | 1 - src/lib/Libdis/disrus.c | 1 - src/lib/Libdis/diswcs.c | 1 - src/lib/Libifl/lib_ifl.h | 2 -- src/lib/Libnet/get_hostaddr.c | 1 + src/lib/Libnet/lib_net.h | 2 ++ src/lib/Libsite/test/site_alt_rte/test_site_alt_rte.c | 2 ++ src/resmom/mom_comm.c | 1 - src/resmom/mom_main.c | 2 -- src/resmom/mom_server.c | 2 +- src/resmom/requests.c | 1 - src/resmom/start_exec.c | 1 - src/resmom/test/mom_main/scaffolding.c | 2 +- src/scheduler.basl/af_system.c | 1 - src/scheduler.cc/pbs_sched.c | 1 - src/scheduler.tcl/pbs_sched.c | 1 - src/server/node_manager.c | 1 - src/server/pbsd_init.c | 1 - src/server/pbsd_main.c | 1 - src/server/receive_mom_communication.c | 2 +- 37 files changed, 13 insertions(+), 36 deletions(-) diff --git a/src/cmds/pbspoe.c b/src/cmds/pbspoe.c index 23a8f16d39..87e5939c90 100644 --- a/src/cmds/pbspoe.c +++ b/src/cmds/pbspoe.c @@ -551,7 +551,7 @@ void run_command( char *argv[]) { - int junk = 0; + int junk = 0; int i; char *psyscmd; int syssz; @@ -600,6 +600,10 @@ void run_command( } junk = system(psyscmd); + if (junk) + { + ; + } clean_up(0); } diff --git a/src/lib/Libdis/disrcs.c b/src/lib/Libdis/disrcs.c index 76794cf713..a0d7c1308a 100644 --- a/src/lib/Libdis/disrcs.c +++ b/src/lib/Libdis/disrcs.c @@ -104,7 +104,6 @@ #include "dis.h" #include "lib_dis.h" -#include "rpp.h" #include "tcp.h" char *disrcs( diff --git a/src/lib/Libdis/disrd.c b/src/lib/Libdis/disrd.c index a8e78bede0..fdb3112920 100644 --- a/src/lib/Libdis/disrd.c +++ b/src/lib/Libdis/disrd.c @@ -103,7 +103,6 @@ #include "dis.h" #include "lib_dis.h" -#include "rpp.h" #include "tcp.h" #undef disrd diff --git a/src/lib/Libdis/disrf.c b/src/lib/Libdis/disrf.c index e07558bf72..01cb5fd94e 100644 --- a/src/lib/Libdis/disrf.c +++ b/src/lib/Libdis/disrf.c @@ -102,7 +102,6 @@ #include "dis.h" #include "lib_dis.h" -#include "rpp.h" #include "tcp.h" #undef disrf diff --git a/src/lib/Libdis/disrfcs.c b/src/lib/Libdis/disrfcs.c index 50408b4473..2fcc9a2590 100644 --- a/src/lib/Libdis/disrfcs.c +++ b/src/lib/Libdis/disrfcs.c @@ -99,7 +99,6 @@ #include "dis.h" #include "lib_dis.h" -#include "rpp.h" #include "tcp.h" int disrfcs( diff --git a/src/lib/Libdis/disrfst.c b/src/lib/Libdis/disrfst.c index cf59bd81c9..9303db7e85 100644 --- a/src/lib/Libdis/disrfst.c +++ b/src/lib/Libdis/disrfst.c @@ -104,7 +104,6 @@ #include "dis.h" #include "lib_dis.h" -#include "rpp.h" #include "tcp.h" int disrfst( diff --git a/src/lib/Libdis/disrl.c b/src/lib/Libdis/disrl.c index f9baeea890..da6bbce725 100644 --- a/src/lib/Libdis/disrl.c +++ b/src/lib/Libdis/disrl.c @@ -103,7 +103,6 @@ #include "dis.h" #include "lib_dis.h" -#include "rpp.h" #include "tcp.h" /* to work around a problem in a compiler */ diff --git a/src/lib/Libdis/disrl_.c b/src/lib/Libdis/disrl_.c index 3440266036..4904287e4e 100644 --- a/src/lib/Libdis/disrl_.c +++ b/src/lib/Libdis/disrl_.c @@ -84,7 +84,6 @@ #include "dis.h" #include "lib_dis.h" -#include "rpp.h" #include "tcp.h" int disrl_( diff --git a/src/lib/Libdis/disrsc.c b/src/lib/Libdis/disrsc.c index af881c4659..c954e67f37 100644 --- a/src/lib/Libdis/disrsc.c +++ b/src/lib/Libdis/disrsc.c @@ -110,7 +110,6 @@ #include "dis.h" #include "lib_dis.h" -#include "rpp.h" #include "tcp.h" #undef disrsc diff --git a/src/lib/Libdis/disrsi.c b/src/lib/Libdis/disrsi.c index 48f339a8b2..93349606f7 100644 --- a/src/lib/Libdis/disrsi.c +++ b/src/lib/Libdis/disrsi.c @@ -107,7 +107,6 @@ #include "dis.h" #include "lib_dis.h" -#include "rpp.h" #include "tcp.h" #undef disrsi diff --git a/src/lib/Libdis/disrsi_.c b/src/lib/Libdis/disrsi_.c index 14878d9e74..2adc3dd7dd 100644 --- a/src/lib/Libdis/disrsi_.c +++ b/src/lib/Libdis/disrsi_.c @@ -6,7 +6,6 @@ #include "dis.h" #include "lib_dis.h" -#include "rpp.h" #include "tcp.h" diff --git a/src/lib/Libdis/disrsl.c b/src/lib/Libdis/disrsl.c index 0a8dbf1998..1c16296a12 100644 --- a/src/lib/Libdis/disrsl.c +++ b/src/lib/Libdis/disrsl.c @@ -107,7 +107,6 @@ #include "dis.h" #include "lib_dis.h" -#include "rpp.h" #include "tcp.h" #undef disrsl diff --git a/src/lib/Libdis/disrsl_.c b/src/lib/Libdis/disrsl_.c index 64bca9926e..34d4eac007 100644 --- a/src/lib/Libdis/disrsl_.c +++ b/src/lib/Libdis/disrsl_.c @@ -86,7 +86,6 @@ #include "dis.h" #include "lib_dis.h" -#include "rpp.h" #include "tcp.h" static char *ulmax; diff --git a/src/lib/Libdis/disrss.c b/src/lib/Libdis/disrss.c index 071a3a2b9c..58f09aeeb5 100644 --- a/src/lib/Libdis/disrss.c +++ b/src/lib/Libdis/disrss.c @@ -109,7 +109,6 @@ #include "dis.h" #include "lib_dis.h" -#include "rpp.h" #include "tcp.h" #undef disrss diff --git a/src/lib/Libdis/disrst.c b/src/lib/Libdis/disrst.c index ed61bf9794..3b4b55193c 100644 --- a/src/lib/Libdis/disrst.c +++ b/src/lib/Libdis/disrst.c @@ -103,7 +103,6 @@ #include "dis.h" #include "lib_dis.h" -#include "rpp.h" #include "tcp.h" char *disrst( diff --git a/src/lib/Libdis/disruc.c b/src/lib/Libdis/disruc.c index b233e7f620..d58b47a3ec 100644 --- a/src/lib/Libdis/disruc.c +++ b/src/lib/Libdis/disruc.c @@ -111,7 +111,6 @@ #include "dis.h" #include "lib_dis.h" -#include "rpp.h" #include "tcp.h" #undef disruc diff --git a/src/lib/Libdis/disrui.c b/src/lib/Libdis/disrui.c index d7994f1a0c..564d444570 100644 --- a/src/lib/Libdis/disrui.c +++ b/src/lib/Libdis/disrui.c @@ -108,7 +108,6 @@ #include "dis.h" #include "lib_dis.h" -#include "rpp.h" #include "tcp.h" #undef disrui diff --git a/src/lib/Libdis/disrul.c b/src/lib/Libdis/disrul.c index f19b77c281..803dd32022 100644 --- a/src/lib/Libdis/disrul.c +++ b/src/lib/Libdis/disrul.c @@ -108,7 +108,6 @@ #include "dis.h" #include "lib_dis.h" -#include "rpp.h" #include "tcp.h" unsigned long disrul( diff --git a/src/lib/Libdis/disrus.c b/src/lib/Libdis/disrus.c index 7ea3981915..1cb07593f1 100644 --- a/src/lib/Libdis/disrus.c +++ b/src/lib/Libdis/disrus.c @@ -111,7 +111,6 @@ #include "dis.h" #include "lib_dis.h" -#include "rpp.h" #include "tcp.h" #undef disrus diff --git a/src/lib/Libdis/diswcs.c b/src/lib/Libdis/diswcs.c index b0689bf90b..9ada426c53 100644 --- a/src/lib/Libdis/diswcs.c +++ b/src/lib/Libdis/diswcs.c @@ -97,7 +97,6 @@ #include "dis.h" #include "lib_dis.h" -#include "rpp.h" #include "tcp.h" int diswcs( diff --git a/src/lib/Libifl/lib_ifl.h b/src/lib/Libifl/lib_ifl.h index 5532a2b818..58cbf0aaef 100644 --- a/src/lib/Libifl/lib_ifl.h +++ b/src/lib/Libifl/lib_ifl.h @@ -383,8 +383,6 @@ void blog_init(char *s, int len); int blog_write(char *s); void blog_out(char *filename); /* static int next_seq(int *seq); */ -char * netaddr_long(long ap, char *out); -char * netaddr(struct sockaddr_in *ap); void set_rpp_throttle_sleep_time(long sleep_time); /* static void rpp_form_pkt(int index, int type, int seq, u_char *buf, int len); */ /* static struct stream *rpp_check_pkt(int index, struct sockaddr_in *addrp); */ diff --git a/src/lib/Libnet/get_hostaddr.c b/src/lib/Libnet/get_hostaddr.c index 9461544af8..dc8b7c8c7b 100644 --- a/src/lib/Libnet/get_hostaddr.c +++ b/src/lib/Libnet/get_hostaddr.c @@ -95,6 +95,7 @@ #include "pbs_error.h" #include "log.h" #include "../Liblog/log_event.h" +#include "../Libnet/lib_net.h" #if !defined(H_ERRNO_DECLARED) && !defined(_AIX) /*extern int h_errno;*/ diff --git a/src/lib/Libnet/lib_net.h b/src/lib/Libnet/lib_net.h index 66f645d0d1..523b82692d 100644 --- a/src/lib/Libnet/lib_net.h +++ b/src/lib/Libnet/lib_net.h @@ -113,3 +113,5 @@ int flushreq(void); int activereq(void); void fullresp(int flag); +char * netaddr_long(long ap, char *out); +char * netaddr(struct sockaddr_in *ap); diff --git a/src/lib/Libsite/test/site_alt_rte/test_site_alt_rte.c b/src/lib/Libsite/test/site_alt_rte/test_site_alt_rte.c index 98fd9903d9..0d16af91cc 100644 --- a/src/lib/Libsite/test/site_alt_rte/test_site_alt_rte.c +++ b/src/lib/Libsite/test/site_alt_rte/test_site_alt_rte.c @@ -22,6 +22,8 @@ START_TEST(test_one) pbs_queue *qp = calloc(1, sizeof(pbs_queue)); int retry_time = 3; rc = site_alt_router(pjob, qp, retry_time); + if (rc) + {;} fail_unless(pjob == scaf_pjob, "job ptr changed in the function!!!!"); fail_unless(qp == scaf_qp, "queue ptr changed in the function!!!!"); fail_unless(retry_time == scaf_retry_time, "retry value changed in the function!!!!"); diff --git a/src/resmom/mom_comm.c b/src/resmom/mom_comm.c index 2eb9ca34bf..f6c1b340ce 100644 --- a/src/resmom/mom_comm.c +++ b/src/resmom/mom_comm.c @@ -112,7 +112,6 @@ #include "../lib/Liblog/pbs_log.h" #include "../lib/Liblog/log_event.h" #include "net_connect.h" -#include "rpp.h" #include "dis.h" #include "dis_init.h" #include "mom_func.h" diff --git a/src/resmom/mom_main.c b/src/resmom/mom_main.c index 6652205545..897edd26f2 100644 --- a/src/resmom/mom_main.c +++ b/src/resmom/mom_main.c @@ -63,7 +63,6 @@ #include "../lib/Liblog/setup_env.h" #include "../lib/Libnet/lib_net.h" /* socket_avail_bytes_on_descriptor */ #include "net_connect.h" -#include "rpp.h" #include "dis.h" #include "dis_init.h" #include "resmon.h" @@ -75,7 +74,6 @@ #ifdef PENABLE_LINUX26_CPUSETS #include "pbs_cpuset.h" #endif -#include "rpp.h" #include "threadpool.h" #include "mom_hierarchy.h" #include "../lib/Libutils/u_lock_ctl.h" /* lock_init */ diff --git a/src/resmom/mom_server.c b/src/resmom/mom_server.c index 4350207114..e426791766 100644 --- a/src/resmom/mom_server.c +++ b/src/resmom/mom_server.c @@ -219,7 +219,6 @@ #include "../lib/Liblog/pbs_log.h" #include "../lib/Liblog/log_event.h" #include "net_connect.h" -#include "rpp.h" #include "dis.h" #include "dis_init.h" #include "list_link.h" @@ -238,6 +237,7 @@ #include "mom_server_lib.h" #include "../lib/Libifl/lib_ifl.h" /* pbs_disconnect_socket */ #include "alps_functions.h" +#include "../lib/Libnet/lib_net.h" /* netaddr */ #define MAX_RETRY_TIME_IN_SECS (5 * 60) #define STARTING_RETRY_INTERVAL_IN_SECS 2 diff --git a/src/resmom/requests.c b/src/resmom/requests.c index ee83047461..34b436cf6d 100644 --- a/src/resmom/requests.c +++ b/src/resmom/requests.c @@ -110,7 +110,6 @@ #include "../lib/Liblog/pbs_log.h" #include "../lib/Liblog/log_event.h" #include "checkpoint.h" /* start_checkpoint */ -#include "rpp.h" #include "resmon.h" #include "net_connect.h" #include "utils.h" diff --git a/src/resmom/start_exec.c b/src/resmom/start_exec.c index da87fc2a85..1f469adedf 100644 --- a/src/resmom/start_exec.c +++ b/src/resmom/start_exec.c @@ -94,7 +94,6 @@ #include #endif /* IBM SP */ -#include "rpp.h" #include "libpbs.h" #include "portability.h" #include "list_link.h" diff --git a/src/resmom/test/mom_main/scaffolding.c b/src/resmom/test/mom_main/scaffolding.c index e42b604c69..60feddd08f 100644 --- a/src/resmom/test/mom_main/scaffolding.c +++ b/src/resmom/test/mom_main/scaffolding.c @@ -26,7 +26,7 @@ int mom_server_count = 0; char *msg_daemonname = "unset"; struct sig_tbl sig_tbl[2]; char pbs_current_user[PBS_MAXUSER]; -char *server_alias = NULL; +char *server_alias; const char *dis_emsg[10]; long *log_event_mask = NULL; int rpp_dbprt = 0; diff --git a/src/scheduler.basl/af_system.c b/src/scheduler.basl/af_system.c index b51c668b0a..9ce908adc7 100644 --- a/src/scheduler.basl/af_system.c +++ b/src/scheduler.basl/af_system.c @@ -118,7 +118,6 @@ #include "af_que.h" #include "af_cnodemap.h" #include "af_resmom.h" -#include "rpp.h" #include "dis.h" /* Macros */ #ifndef OPEN_MAX diff --git a/src/scheduler.cc/pbs_sched.c b/src/scheduler.cc/pbs_sched.c index 75f75e1d88..199076b943 100644 --- a/src/scheduler.cc/pbs_sched.c +++ b/src/scheduler.cc/pbs_sched.c @@ -122,7 +122,6 @@ #include "sched_cmds.h" #include "server_limits.h" #include "net_connect.h" -#include "rpp.h" #include "rm.h" #include "libpbs.h" diff --git a/src/scheduler.tcl/pbs_sched.c b/src/scheduler.tcl/pbs_sched.c index 1dc03f3b17..ac7e3afd77 100644 --- a/src/scheduler.tcl/pbs_sched.c +++ b/src/scheduler.tcl/pbs_sched.c @@ -122,7 +122,6 @@ #include "resmon.h" #include "sched_cmds.h" #include "net_connect.h" -#include "rpp.h" #include "rm.h" diff --git a/src/server/node_manager.c b/src/server/node_manager.c index 2507c4a23d..a0b6eceaee 100644 --- a/src/server/node_manager.c +++ b/src/server/node_manager.c @@ -111,7 +111,6 @@ #include "../lib/Liblog/pbs_log.h" #include "../lib/Liblog/log_event.h" #include "pbs_nodes.h" -#include "rpp.h" #include "dis.h" #include "dis_init.h" #include "resmon.h" diff --git a/src/server/pbsd_init.c b/src/server/pbsd_init.c index 1a2cc5333a..229351c8e0 100644 --- a/src/server/pbsd_init.c +++ b/src/server/pbsd_init.c @@ -108,7 +108,6 @@ #include "tracking.h" #include "svrfunc.h" #include "acct.h" -#include "rpp.h" #include "net_connect.h" #include "pbs_proto.h" #include "batch_request.h" diff --git a/src/server/pbsd_main.c b/src/server/pbsd_main.c index 2d5b0b1073..c41cf02dbb 100644 --- a/src/server/pbsd_main.c +++ b/src/server/pbsd_main.c @@ -120,7 +120,6 @@ #include "tracking.h" #include "acct.h" #include "sched_cmds.h" -#include "rpp.h" #include "dis.h" #include "dis_init.h" #include "batch_request.h" diff --git a/src/server/receive_mom_communication.c b/src/server/receive_mom_communication.c index d1f95997fa..80e9028a3f 100644 --- a/src/server/receive_mom_communication.c +++ b/src/server/receive_mom_communication.c @@ -88,11 +88,11 @@ #include "dis.h" #include "alps_functions.h" #include "attribute.h" -#include "rpp.h" #include "mom_update.h" #include "u_tree.h" #include "net_cache.h" #include "threadpool.h" +#include "../lib/Libnet/lib_net.h" From 0884cb5ef76cac8dc3893130974d3a0113c57e92 Mon Sep 17 00:00:00 2001 From: Daniel Hardman Date: Mon, 10 Dec 2012 10:26:47 -0700 Subject: [PATCH 05/20] Revert "first attempt at unit test for job_route.c" This reverts commit f3690905adf2762bc994b285bdd3a83019c229d4. --- src/server/test/job_route/test_job_route.c | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/src/server/test/job_route/test_job_route.c b/src/server/test/job_route/test_job_route.c index 4dd7bffb4c..a9d88c1117 100644 --- a/src/server/test/job_route/test_job_route.c +++ b/src/server/test/job_route/test_job_route.c @@ -4,18 +4,6 @@ #include #include #include "pbs_error.h" - - -START_TEST(test_add_dest_null) - { - // This used to cause a seg fault. If it executes without - // crashing, the test passes. - add_dest(NULL); - } -END_TEST - - - START_TEST(test_one) { From 36c17d8226acd50c3a2c0a424e37b10501ebe535 Mon Sep 17 00:00:00 2001 From: Daniel Hardman Date: Mon, 10 Dec 2012 10:28:02 -0700 Subject: [PATCH 06/20] Revert "Revert "first attempt at unit test for job_route.c"" This reverts commit 0884cb5ef76cac8dc3893130974d3a0113c57e92. --- src/server/test/job_route/test_job_route.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/server/test/job_route/test_job_route.c b/src/server/test/job_route/test_job_route.c index a9d88c1117..4dd7bffb4c 100644 --- a/src/server/test/job_route/test_job_route.c +++ b/src/server/test/job_route/test_job_route.c @@ -4,6 +4,18 @@ #include #include #include "pbs_error.h" + + +START_TEST(test_add_dest_null) + { + // This used to cause a seg fault. If it executes without + // crashing, the test passes. + add_dest(NULL); + } +END_TEST + + + START_TEST(test_one) { From 4727d22792318d37ae498a8eb8612ec75c56b342 Mon Sep 17 00:00:00 2001 From: Ken Nielson Date: Mon, 10 Dec 2012 11:01:59 -0700 Subject: [PATCH 07/20] Added (char *) to macro definition for GET_NEXT and GET_PRIOR --- src/include/list_link.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/include/list_link.h b/src/include/list_link.h index be970e03fc..a9830e8cd9 100644 --- a/src/include/list_link.h +++ b/src/include/list_link.h @@ -131,8 +131,8 @@ typedef struct pidl #define GET_NEXT(pe) (pe).ll_next->ll_struct #define GET_PRIOR(pe) (pe).ll_prior->ll_struct #else -#define GET_NEXT(pe) get_next(pe, __FILE__, __LINE__) -#define GET_PRIOR(pe) get_prior(pe, __FILE__, __LINE__) +#define GET_NEXT(pe) get_next(pe, (char *)__FILE__, __LINE__) +#define GET_PRIOR(pe) get_prior(pe,(char *) __FILE__, __LINE__) #endif /* function prototypes */ From 43d2fcb66de4c62ea32f63a705ed7570aea1b659 Mon Sep 17 00:00:00 2001 From: Ken Nielson Date: Mon, 10 Dec 2012 11:49:54 -0700 Subject: [PATCH 08/20] commiting changes for last type casting errors from src/lib for c++ --- src/lib/Libnet/get_hostaddr.c | 2 +- src/lib/Libutils/u_threadpool.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/lib/Libnet/get_hostaddr.c b/src/lib/Libnet/get_hostaddr.c index dc8b7c8c7b..bf3315a0e4 100644 --- a/src/lib/Libnet/get_hostaddr.c +++ b/src/lib/Libnet/get_hostaddr.c @@ -134,7 +134,7 @@ char * netaddr(struct sockaddr_in *ap) char tmp[80]; if (ap == NULL) - return "unknown"; + return (char *)"unknown"; netaddr_long( ntohl(ap->sin_addr.s_addr), tmp); diff --git a/src/lib/Libutils/u_threadpool.c b/src/lib/Libutils/u_threadpool.c index 8654deb8a6..4b23d14232 100644 --- a/src/lib/Libutils/u_threadpool.c +++ b/src/lib/Libutils/u_threadpool.c @@ -114,7 +114,7 @@ int create_work_thread(void) if ((rc = pthread_attr_init(&attr)) != 0) { perror("pthread_attr_init failed. Could not start worker thread."); - log_err(-1, "work_thread","pthread_attr_init failed. Could not start worker thread."); + log_err(-1, __func__, (char *)"pthread_attr_init failed. Could not start worker thread."); return rc; } @@ -368,7 +368,7 @@ int initialize_threadpool( if ((rc = pthread_attr_init(&(*pool)->tp_attr)) != 0) { perror("pthread_attr_init failed. Could not init thread pool."); - log_err(-1, "initialize_threadpool","pthread_attr_init failed. Could not init thread pool."); + log_err(-1, __func__, (char *)"pthread_attr_init failed. Could not init thread pool."); return rc; } From 889ba768b74d49b4d37fe85f73f183d15d5ce407 Mon Sep 17 00:00:00 2001 From: bdaw Date: Mon, 10 Dec 2012 12:16:06 -0700 Subject: [PATCH 09/20] Fixed some c++ bugs. --- src/server/issue_request.c | 1 + src/server/svr_task.c | 2 +- src/server/svr_task.h | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/server/issue_request.c b/src/server/issue_request.c index b2b805b0ac..10b8a144f2 100644 --- a/src/server/issue_request.c +++ b/src/server/issue_request.c @@ -114,6 +114,7 @@ #include "svr_connect.h" /* svr_disconnect_sock */ #include "node_manager.h" /* tfind_addr */ #include "ji_mutex.h" +#include "svr_task.h" /* Global Data Items: */ diff --git a/src/server/svr_task.c b/src/server/svr_task.c index 7abc14f4ba..2e5fcb2cb1 100644 --- a/src/server/svr_task.c +++ b/src/server/svr_task.c @@ -148,7 +148,7 @@ struct work_task *set_task( enum work_type type, long event_id, /* I - based on type can be time of event */ - void (*func)(work_task *), + void (*func)(struct work_task *), void *parm, int get_lock) diff --git a/src/server/svr_task.h b/src/server/svr_task.h index 20d6c570c9..b944483cde 100644 --- a/src/server/svr_task.h +++ b/src/server/svr_task.h @@ -4,7 +4,7 @@ #include "work_task.h" /* work_type, work_task, all_tasks */ -struct work_task *set_task(enum work_type type, long event_id, void (*func)(work_task *), void *parm, int get_lock); +struct work_task *set_task(enum work_type type, long event_id, void (*func)(struct work_task *), void *parm, int get_lock); int task_is_in_threadpool(struct work_task *ptask); From 248256662c27e509808188349687c56d0bfea72d Mon Sep 17 00:00:00 2001 From: David Beer Date: Mon, 10 Dec 2012 14:25:53 -0700 Subject: [PATCH 10/20] Refactor req_register() - the function - a bit so that it can be unit tested. In conjunction, bring the unit test coverage up to 51.01% for that file. --- .gitignore | 91 ++ src/server/req_register.c | 970 ++++++++++-------- src/server/test/req_register/Makefile.am | 2 +- src/server/test/req_register/scaffolding.c | 201 +++- .../test/req_register/test_req_register.c | 800 ++++++++++++++- src/server/user_info.c | 2 +- 6 files changed, 1619 insertions(+), 447 deletions(-) diff --git a/.gitignore b/.gitignore index f6b0f95806..da3c7f0dfa 100644 --- a/.gitignore +++ b/.gitignore @@ -10,4 +10,95 @@ coverage_run.sh *_suite.log .deps .libs +*.m4 +autom4te.cache/ +buildutils/config.guess +buildutils/config.sub +buildutils/depcomp +buildutils/install-sh +buildutils/ltmain.sh +buildutils/missing +buildutils/modulefiles +buildutils/modulefiles.vers +buildutils/pbs_mkdirs +buildutils/self-extract-head-sh +buildutils/ylwrap +config.log +config.status +configure +contrib/blcr/checkpoint_script +contrib/blcr/restart_script +contrib/init.d/debian.pbs_mom +contrib/init.d/debian.pbs_sched +contrib/init.d/debian.pbs_server +contrib/init.d/debian.trqauthd +contrib/init.d/pbs_mom +contrib/init.d/pbs_sched +contrib/init.d/pbs_server +contrib/init.d/trqauthd +contrib/init.d/suse.pbs_mom +contrib/init.d/suse.pbs_sched +contrib/init.d/suse.pbs_server +contrib/init.d/suse.trqauthd +*.1 +*.3 +*.7 +*.8 +doc/soelim +libtool +pbs-config +src/cmds/nqs2pbs +src/cmds/pbs_track +src/cmds/pbsdsh +src/cmds/pbsnodes +src/cmds/qalter +src/cmds/qchkpt +src/cmds/qdel +src/cmds/qdisable +src/cmds/qenable +src/cmds/qgpumode +src/cmds/qgpureset +src/cmds/qhold +src/cmds/qmgr +src/cmds/qmove +src/cmds/qmsg +src/cmds/qorder +src/cmds/qrerun +src/cmds/qrls +src/cmds/qrun +src/cmds/qselect +src/cmds/qsig +src/cmds/qstart +src/cmds/qstat +src/cmds/qstop +src/cmds/qsub +src/cmds/qterm +src/daemon_client/trqauthd +src/drmaa/Doxyfile +src/include/pbs_config.h* +src/include/site_job_attr_def.h +src/include/site_job_attr_enum.h +src/include/site_qmgr_node_print.h +src/include/site_qmgr_que_print.h +src/include/site_qmgr_svr_print.h +src/include/site_que_attr_def.h +src/include/site_que_attr_enum.h +src/include/site_svr_attr_def.h +src/include/site_svr_attr_enum.h +src/include/stamp-h1 +src/momctl/momctl +src/resmom/pbs_demux +src/resmom/pbs_mom +src/scheduler.cc/pbs_sched +*.swp +src/server/pbs_server +src/tools/chk_tree +src/tools/hostn +src/tools/pbs_tclsh +src/tools/printjob +src/tools/printserverdb +src/tools/printtracking +src/tools/tracejob +tags +torque.spec diff --git a/src/server/req_register.c b/src/server/req_register.c index 26487d5df2..8cc62a216f 100644 --- a/src/server/req_register.c +++ b/src/server/req_register.c @@ -122,23 +122,23 @@ extern long calc_job_cost(job *); /* Local Private Functions */ void set_depend_hold(job *, pbs_attribute *); -static int register_sync(struct depend *, char *child, char *host, long); -static int register_dep(pbs_attribute *, struct batch_request *, int, int *); -static int unregister_dep(pbs_attribute *, struct batch_request *); -static int unregister_sync(pbs_attribute *, struct batch_request *); +int register_sync(struct depend *, char *child, char *host, long); +int register_dep(pbs_attribute *, struct batch_request *, int, int *); +int unregister_dep(pbs_attribute *, struct batch_request *); +int unregister_sync(pbs_attribute *, struct batch_request *); -static struct depend *find_depend(int type, pbs_attribute *pattr); +struct depend *find_depend(int type, pbs_attribute *pattr); -static struct depend *make_depend(int type, pbs_attribute *pattr); +struct depend *make_depend(int type, pbs_attribute *pattr); -static struct depend_job *find_dependjob(struct depend *, char *name); +struct depend_job *find_dependjob(struct depend *, char *name); -static struct depend_job *make_dependjob(struct depend *, char *jobid, char *host); -static void del_depend_job(struct depend_job *pdj); -static int build_depend(pbs_attribute *, char *); -static void clear_depend(struct depend *, int type, int exists); -static void del_depend(struct depend *); -static void release_cheapest(job *, struct depend *); +struct depend_job *make_dependjob(struct depend *, char *jobid, char *host); +void del_depend_job(struct depend_job *pdj); +int build_depend(pbs_attribute *, char *); +void clear_depend(struct depend *, int type, int exists); +void del_depend(struct depend *); +void release_cheapest(job *, struct depend *); int send_depend_req(job *, struct depend_job *pparent, int, int, int, void (*postfunc)(batch_request *)); /* External Global Data Items */ @@ -157,48 +157,51 @@ extern char *PJobState[]; extern int svr_chk_owner(struct batch_request *, job *); -/* - * req_register - process the Register Dependency Request + /* + * check_dependency_job() + * checks to make the sure the dependency request is legitimate * - * We have an interesting problem here in that the request may well - * orginate from ourself. In that case we doen't really reply. - * - * Note: It is possible, though it doesn't make sense, for a job - * to have a self-referencing depend. We reject these for the register - * and delete operations, but allow it for others in an attempt - * to be graceful. + * @parent req_register + * @param jobid - the id of the job + * @param job_ptr - the job + * @param preq - the request for the dependency */ - -int req_register( - - struct batch_request *preq) /* I */ + +int check_dependency_job( + + char *jobid, /* I */ + batch_request *preq, /* M */ + job **job_ptr) /* O */ { - int made; - pbs_attribute *pattr; + job *pjob; + char log_buf[LOCAL_LOG_BUF_SIZE + 1]; + int type; + int rc = PBSE_NONE; - struct depend *pdep; + if ((jobid == NULL) || + (preq == NULL) || + (job_ptr == NULL)) + return(PBSE_BAD_PARAMETER); - struct depend_job *pdj; - job *pjob; - char *ps; - int rc = PBSE_NONE; - int revtype; - int type; - char log_buf[LOCAL_LOG_BUF_SIZE + 1]; + *job_ptr = NULL; /* make sure request is from a server */ - if (!preq->rq_fromsvr) { req_reject(PBSE_IVALREQ, 0, preq, NULL, NULL); return(PBSE_IVALREQ); } + + if (LOGLEVEL >= 10) + { + snprintf(log_buf, sizeof(log_buf), "rq_parent: %s", jobid); + log_event(PBSEVENT_DEBUG, PBS_EVENTCLASS_QUEUE, __func__, log_buf); + } /* find the "parent" job specified in the request */ - - if ((pjob = svr_find_job(preq->rq_ind.rq_register.rq_parent, TRUE)) == NULL) + if ((pjob = svr_find_job(jobid, TRUE)) == NULL) { /* * job not found... if server is initializing, it may not @@ -210,11 +213,7 @@ int req_register( if (state != SV_STATE_INIT) { - log_event( - PBSEVENT_DEBUG, - PBS_EVENTCLASS_JOB, - preq->rq_ind.rq_register.rq_parent, - pbse_to_txt(PBSE_UNKJOBID)); + log_event(PBSEVENT_DEBUG, PBS_EVENTCLASS_JOB, jobid, pbse_to_txt(PBSE_UNKJOBID)); rc = PBSE_UNKJOBID; req_reject(rc, 0, preq, NULL, NULL); @@ -231,27 +230,15 @@ int req_register( type = preq->rq_ind.rq_register.rq_dependtype; if (((pjob->ji_qs.ji_state == JOB_STATE_COMPLETE) || - (pjob->ji_qs.ji_state == JOB_STATE_EXITING)) && - ((type == JOB_DEPEND_TYPE_AFTERSTART) || - (type == JOB_DEPEND_TYPE_AFTERANY) || - ((type == JOB_DEPEND_TYPE_AFTEROK) && (pjob->ji_qs.ji_un.ji_exect.ji_exitstat == 0)) || - ((type == JOB_DEPEND_TYPE_AFTERNOTOK) && (pjob->ji_qs.ji_un.ji_exect.ji_exitstat != 0)))) - { - if (LOGLEVEL >= 8) - { - sprintf(log_buf,"Dependency requested for %s job, parent job %s, child job %s", - PJobState[pjob->ji_qs.ji_state], - preq->rq_ind.rq_register.rq_parent, - preq->rq_ind.rq_register.rq_child); - - log_event(PBSEVENT_JOB,PBS_EVENTCLASS_JOB,pjob->ji_qs.ji_jobid,log_buf); - } - - log_event( - PBSEVENT_DEBUG, - PBS_EVENTCLASS_JOB, - preq->rq_ind.rq_register.rq_parent, - pbse_to_txt(PBSE_BADSTATE)); + (pjob->ji_qs.ji_state == JOB_STATE_EXITING)) && + ((type == JOB_DEPEND_TYPE_AFTERSTART) || + (type == JOB_DEPEND_TYPE_AFTERANY) || + ((type == JOB_DEPEND_TYPE_AFTEROK) && + (pjob->ji_qs.ji_un.ji_exect.ji_exitstat == 0)) || + ((type == JOB_DEPEND_TYPE_AFTERNOTOK) && + (pjob->ji_qs.ji_un.ji_exect.ji_exitstat != 0)))) + { + log_event(PBSEVENT_DEBUG, PBS_EVENTCLASS_JOB, jobid, pbse_to_txt(PBSE_BADSTATE)); rc = PBSE_BADSTATE; req_reject(rc, 0, preq, NULL, NULL); @@ -261,316 +248,532 @@ int req_register( return(rc); } - if (LOGLEVEL >= 8) - { - sprintf(log_buf,"Dependency requested parent job %s state (%s), child job %s", - preq->rq_ind.rq_register.rq_parent, - PJobState[pjob->ji_qs.ji_state], - preq->rq_ind.rq_register.rq_child); + *job_ptr = pjob; - log_event(PBSEVENT_JOB,PBS_EVENTCLASS_JOB,pjob->ji_qs.ji_jobid,log_buf); - } + return(PBSE_NONE); + } /* END check_dependency_job() */ - pattr = &pjob->ji_wattr[JOB_ATR_depend]; - pjob->ji_modified = 1; - /* more of the server:port fix kludge */ - if ((ps = strchr(preq->rq_ind.rq_register.rq_child, (int)'@'))) - { - snprintf(preq->rq_ind.rq_register.rq_svr, sizeof(preq->rq_ind.rq_register.rq_svr), "%s", ps + 1); +/* + * register_syncwith() + * registers the syncwith dependency type + * @parent register_dependency() + */ - *ps = '\0'; +int register_syncwith( + + batch_request *preq, + job *pjob) + + { + pbs_attribute *pattr = &pjob->ji_wattr[JOB_ATR_depend]; + int rc = PBSE_NONE; + struct depend *pdep = find_depend(JOB_DEPEND_TYPE_SYNCCT, pattr); + + if (pdep != NULL) + { + rc = register_sync( + pdep, + preq->rq_ind.rq_register.rq_child, + preq->rq_ind.rq_register.rq_svr, + preq->rq_ind.rq_register.rq_cost); + + if (pdep->dp_numreg > pdep->dp_numexp) + { + /* all registered - release first */ + + release_cheapest(pjob, pdep); + } } else { - /* We ignore what qsub sent us for the host. We need to use the - * server_name so we know we can connect to the active server. - * This is an high availability consideration */ - if (server_name != NULL) - strcpy(preq->rq_ind.rq_register.rq_svr, server_name); - else - strcpy(preq->rq_ind.rq_register.rq_svr, preq->rq_host); + rc = PBSE_NOSYNCMSTR; } - /* Register a dependency */ + return(rc); + } /* END register_syncwith() */ - switch (preq->rq_ind.rq_register.rq_op) - { - case JOB_DEPEND_OP_REGISTER: - if (!strcmp(preq->rq_ind.rq_register.rq_parent, - preq->rq_ind.rq_register.rq_child)) - { - rc = PBSE_IVALREQ; /* can't depend on self */ - break; - } +int register_before_dep( + + batch_request *preq, + job *pjob, + int type) + + { + int rc = PBSE_NONE; + struct depend *pdep = NULL; + pbs_attribute *pattr = &pjob->ji_wattr[JOB_ATR_depend]; + int revtype; + struct depend_job *pdj = NULL; + int made = FALSE; - switch (type) + /* + * Check job owner for permission, use the real + * job owner, not the sending server's name. + */ + strcpy(preq->rq_user, preq->rq_ind.rq_register.rq_owner); + + if (svr_chk_owner(preq, pjob)) + { + rc = PBSE_PERM; /* not same user */ + } + else + { + /* ok owner, see if job has "on" */ + pdep = find_depend(JOB_DEPEND_TYPE_ON, pattr); + + if (pdep == NULL) + { + /* on "on", see if child already registered */ + revtype = type ^(JOB_DEPEND_TYPE_BEFORESTART - JOB_DEPEND_TYPE_AFTERSTART); + + pdep = find_depend(revtype, pattr); + + if (pdep == NULL) { + /* no "on" and no prior - return error */ + printf("in the on code\n"); + + rc = PBSE_BADDEPEND; + } + else if ((pdj = find_dependjob(pdep, preq->rq_ind.rq_register.rq_child))) + { + /* has prior register, update it */ + if (server_name[0] != '\0') + snprintf(pdj->dc_svr, sizeof(pdj->dc_svr), "%s", server_name); + else + snprintf(pdj->dc_svr, sizeof(pdj->dc_svr), "%s", preq->rq_ind.rq_register.rq_svr); + } + } + else if ((rc = register_dep(pattr, preq, type, &made)) == PBSE_NONE) + { + if (made) + { + /* first time registered */ + if (--pdep->dp_numexp <= 0) + del_depend(pdep); + } + } + } - case JOB_DEPEND_TYPE_SYNCWITH: + return(rc); + } /* END register_before_dep() */ - pdep = find_depend(JOB_DEPEND_TYPE_SYNCCT, pattr); - if (pdep != NULL) - { - rc = register_sync( - pdep, - preq->rq_ind.rq_register.rq_child, - preq->rq_ind.rq_register.rq_svr, - preq->rq_ind.rq_register.rq_cost); - if (pdep->dp_numreg > pdep->dp_numexp) - { - /* all registered - release first */ +/* + * register_dependency() + * handles the registering of a dependency on a job + * @parent req_register() + */ + +int register_dependency( + + batch_request *preq, + job *pjob, + int type) - release_cheapest(pjob, pdep); - } - } - else - { - rc = PBSE_NOSYNCMSTR; - } + { + int rc = PBSE_NONE; + int made = FALSE; - break; + if (!strcmp(preq->rq_ind.rq_register.rq_parent, preq->rq_ind.rq_register.rq_child)) + return(PBSE_IVALREQ); - case JOB_DEPEND_TYPE_AFTERSTART: + switch (type) + { + + case JOB_DEPEND_TYPE_SYNCWITH: + + rc = register_syncwith(preq, pjob); + + break; + + case JOB_DEPEND_TYPE_AFTERSTART: + + case JOB_DEPEND_TYPE_AFTERANY: + + case JOB_DEPEND_TYPE_AFTEROK: + + case JOB_DEPEND_TYPE_AFTERNOTOK: + + rc = register_dep(&pjob->ji_wattr[JOB_ATR_depend], preq, type, &made); + + break; - case JOB_DEPEND_TYPE_AFTERANY: + case JOB_DEPEND_TYPE_BEFORESTART: + + case JOB_DEPEND_TYPE_BEFOREANY: + + case JOB_DEPEND_TYPE_BEFOREOK: + + case JOB_DEPEND_TYPE_BEFORENOTOK: - case JOB_DEPEND_TYPE_AFTEROK: + rc = register_before_dep(preq, pjob, type); - case JOB_DEPEND_TYPE_AFTERNOTOK: + break; + + default: - rc = register_dep(pattr, preq, type, &made); + rc = PBSE_IVALREQ; + + break; + } + + return(rc); + } /* END register_dependency() */ - break; - case JOB_DEPEND_TYPE_BEFORESTART: - case JOB_DEPEND_TYPE_BEFOREANY: - case JOB_DEPEND_TYPE_BEFOREOK: - case JOB_DEPEND_TYPE_BEFORENOTOK: +int release_before_dependency( - /* - * Check job owner for permission, use the real - * job owner, not the sending server's name. - */ + batch_request *preq, + job *pjob, + int type) + + { + int rc = PBSE_NONE; + pbs_attribute *pattr = &pjob->ji_wattr[JOB_ATR_depend]; + struct depend *pdep = NULL; + struct depend_job *pdj = NULL; + char log_buf[LOCAL_LOG_BUF_SIZE]; + /*char job_id[PBS_MAXSVRJOBID+1];*/ + + /* predecessor sent release-reduce "on", */ + /* see if this job can now run */ + + type ^= (JOB_DEPEND_TYPE_BEFORESTART - JOB_DEPEND_TYPE_AFTERSTART); + + if ((pdep = find_depend(type, pattr))) + { + if ((pdj = find_dependjob(pdep, preq->rq_ind.rq_register.rq_child))) + { + del_depend_job(pdj); + + sprintf(log_buf, msg_registerrel, preq->rq_ind.rq_register.rq_child); + log_event(PBSEVENT_JOB,PBS_EVENTCLASS_JOB,pjob->ji_qs.ji_jobid,log_buf); + + if (GET_NEXT(pdep->dp_jobs) == NULL) + { + /* no more dependencies of this type */ + del_depend(pdep); + + /*snprintf(job_id, sizeof(job_id), "%s", pjob->ji_qs.ji_jobid);*/ + /*unlock_ji_mutex(pjob, __func__, "1", LOGLEVEL);*/ + set_depend_hold(pjob, pattr); +/* pjob = svr_find_job(job_id, TRUE); + if (pjob == NULL) + rc = PBSE_JOBNOTFOUND;*/ + } + + return(rc); + } + } /* END if ((pdep = find_depend(type,pattr))) */ + + rc = PBSE_IVALREQ; + + return(rc); + } /* END release_before_dependency() */ - strcpy(preq->rq_user, preq->rq_ind.rq_register.rq_owner); - if (svr_chk_owner(preq, pjob)) - { - rc = PBSE_PERM; /* not same user */ - } - else - { - /* ok owner, see if job has "on" */ - pdep = find_depend(JOB_DEPEND_TYPE_ON, pattr); - if (pdep == NULL) - { - /* on "on", see if child already registered */ +int release_syncwith_dependency( + + batch_request *preq, + job *pjob) + + { + pbs_attribute *pattr = &pjob->ji_wattr[JOB_ATR_depend]; + struct depend *pdep = NULL; + int rc = PBSE_NONE; + char tmpcoststr[64]; + /*char job_id[PBS_MAXSVRJOBID+1];*/ + + pdep = find_depend(JOB_DEPEND_TYPE_SYNCCT, pattr); + + if (pdep == NULL) + pdep = find_depend(JOB_DEPEND_TYPE_SYNCWITH, pattr); + + if (pdep != NULL) + { + pdep->dp_released = 1; + +/* snprintf(job_id, sizeof(job_id), "%s", pjob->ji_qs.ji_jobid); + unlock_ji_mutex(pjob, __func__, "2", LOGLEVEL);*/ + set_depend_hold(pjob, pattr); +/* pjob = svr_find_job(job_id, TRUE); - revtype = type ^(JOB_DEPEND_TYPE_BEFORESTART - JOB_DEPEND_TYPE_AFTERSTART); + if (pjob == NULL) + { + rc = PBSE_JOBNOTFOUND; + } + else + {*/ + sprintf(tmpcoststr, "%ld", preq->rq_ind.rq_register.rq_cost); - pdep = find_depend(revtype, pattr); + if (pjob->ji_wattr[JOB_ATR_sched_hint].at_val.at_str != NULL) + free(pjob->ji_wattr[JOB_ATR_sched_hint].at_val.at_str); - if (pdep == NULL) - { - /* no "on" and no prior - return error */ + pjob->ji_wattr[JOB_ATR_sched_hint].at_val.at_str = strdup(tmpcoststr); + pjob->ji_wattr[JOB_ATR_sched_hint].at_flags |= ATR_VFLAG_SET; + /*}*/ + } + else + { + rc = PBSE_NOSYNCMSTR; + } - rc = PBSE_BADDEPEND; - } - else if ((pdj = find_dependjob(pdep, preq->rq_ind.rq_register.rq_child))) - { - /* has prior register, update it */ + return(rc); + } /* END release_syncwith_dependency() */ - if (server_name[0] != '\0') - snprintf(pdj->dc_svr, sizeof(pdj->dc_svr), "%s", server_name); - else - snprintf(pdj->dc_svr, sizeof(pdj->dc_svr), "%s", preq->rq_ind.rq_register.rq_svr); - } - } - else if ((rc = register_dep(pattr, preq, type, &made)) == 0) - { - if (made) - { - /* first time registered */ - if (--pdep->dp_numexp <= 0) - del_depend(pdep); - } - } - } - break; - default: +int release_dependency( - rc = PBSE_IVALREQ; + batch_request *preq, + job *pjob, + int type) - break; - } + { + int rc = PBSE_NONE; + switch (type) + { + + case JOB_DEPEND_TYPE_BEFORESTART: + + case JOB_DEPEND_TYPE_BEFOREANY: + + case JOB_DEPEND_TYPE_BEFOREOK: + + case JOB_DEPEND_TYPE_BEFORENOTOK: + + rc = release_before_dependency(preq, pjob, type); + break; + + case JOB_DEPEND_TYPE_SYNCWITH: + + rc = release_syncwith_dependency(preq, pjob); + + break; + } + + return(rc); + } /* END release_dependency() */ - case JOB_DEPEND_OP_RELEASE: - /* - * Release a dependency so job might run - */ - switch (type) - { - case JOB_DEPEND_TYPE_BEFORESTART: - case JOB_DEPEND_TYPE_BEFOREANY: +int ready_dependency( - case JOB_DEPEND_TYPE_BEFOREOK: + batch_request *preq, + job *pjob) - case JOB_DEPEND_TYPE_BEFORENOTOK: + { + int rc = PBSE_NONE; + pbs_attribute *pattr = &pjob->ji_wattr[JOB_ATR_depend]; + struct depend *pdep = NULL; + struct depend_job *pdj = NULL; - /* predecessor sent release-reduce "on", */ - /* see if this job can now run */ + if ((pdep = find_depend(JOB_DEPEND_TYPE_SYNCCT, pattr))) + { + /* mark sender as running */ + + pdj = (struct depend_job *)GET_NEXT(pdep->dp_jobs); + + while (pdj) + { + if (strcmp(pdj->dc_child, preq->rq_ind.rq_register.rq_child) == 0) + { + pdj->dc_state = JOB_DEPEND_OP_READY; + + break; + } + + pdj = (struct depend_job *)GET_NEXT(pdj->dc_link); + } + + release_cheapest(pjob, pdep); /* release next one */ + } + else + { + rc = PBSE_NOSYNCMSTR; + } - type ^= (JOB_DEPEND_TYPE_BEFORESTART - JOB_DEPEND_TYPE_AFTERSTART); + return(rc); + } /* END ready_dependency() */ - if ((pdep = find_depend(type, pattr))) - { - if ((pdj = find_dependjob(pdep, preq->rq_ind.rq_register.rq_child))) - { - del_depend_job(pdj); - sprintf(log_buf, msg_registerrel, preq->rq_ind.rq_register.rq_child); - log_event(PBSEVENT_JOB,PBS_EVENTCLASS_JOB,pjob->ji_qs.ji_jobid,log_buf); - if (GET_NEXT(pdep->dp_jobs) == 0) - { - /* no more dependencies of this type */ +int delete_dependency_job( + + batch_request *preq, + job **pjob_ptr) + + { + job *pjob = *pjob_ptr; + int rc = PBSE_NONE; + char log_buf[LOCAL_LOG_BUF_SIZE]; + + if (!strcmp(preq->rq_ind.rq_register.rq_parent, + preq->rq_ind.rq_register.rq_child)) + { + rc = PBSE_IVALREQ; /* prevent an infinite loop */ + } + else + { + sprintf(log_buf, msg_registerdel, preq->rq_ind.rq_register.rq_child); + log_event(PBSEVENT_JOB, PBS_EVENTCLASS_JOB, pjob->ji_qs.ji_jobid, log_buf); + + /* pjob freed and set to NULL */ + job_abt(pjob_ptr, log_buf); + } - del_depend(pdep); + return(rc); + } /* END delete_dependency_job() */ - set_depend_hold(pjob, pattr); - } - break; - } - } /* END if ((pdep = find_depend(type,pattr))) */ - rc = PBSE_IVALREQ; - break; +int unregister_dependency( + + batch_request *preq, + job *pjob, + int type) - case JOB_DEPEND_TYPE_SYNCWITH: + { + pbs_attribute *pattr = &pjob->ji_wattr[JOB_ATR_depend]; + int rc = PBSE_NONE; + /*char job_id[PBS_MAXSVRJOBID+1];*/ + + if (type == JOB_DEPEND_TYPE_SYNCWITH) + { + if (pjob->ji_qs.ji_state == JOB_STATE_RUNNING) + { + rc = PBSE_IVALREQ; + } + else + { + unregister_sync(pattr, preq); + } + } + else + { + unregister_dep(pattr, preq); + } + +/* snprintf(job_id, sizeof(job_id), "%s", pjob->ji_qs.ji_jobid); + unlock_ji_mutex(pjob, __func__, "3", LOGLEVEL);*/ + set_depend_hold(pjob, pattr); +/* pjob = svr_find_job(job_id, TRUE); + if (pjob == NULL) + rc = PBSE_JOBNOTFOUND;*/ - pdep = find_depend(JOB_DEPEND_TYPE_SYNCCT, pattr); + return(rc); + } /* END unregister_dependency() */ - if (pdep == NULL) - pdep = find_depend(JOB_DEPEND_TYPE_SYNCWITH, pattr); - if (pdep != NULL) - { - char tmpcoststr[64]; - pdep->dp_released = 1; - set_depend_hold(pjob, pattr); - sprintf(tmpcoststr, "%ld", preq->rq_ind.rq_register.rq_cost); - pjob->ji_wattr[JOB_ATR_sched_hint].at_val.at_str = - strdup(tmpcoststr); +/* + * req_register - process the Register Dependency Request + * + * We have an interesting problem here in that the request may well + * orginate from ourself. In that case we doen't really reply. + * + * Note: It is possible, though it doesn't make sense, for a job + * to have a self-referencing depend. We reject these for the register + * and delete operations, but allow it for others in an attempt + * to be graceful. + */ - pjob->ji_wattr[JOB_ATR_sched_hint].at_flags |= ATR_VFLAG_SET; - } - else - { - rc = PBSE_NOSYNCMSTR; - } +int req_register( + + batch_request *preq) /* I */ + + { + job *pjob = NULL; + char *ps; + int rc = PBSE_NONE; + int type = preq->rq_ind.rq_register.rq_dependtype; + char log_buf[LOCAL_LOG_BUF_SIZE + 1]; - break; - } + if ((rc = check_dependency_job(preq->rq_ind.rq_register.rq_parent, preq, &pjob)) != PBSE_NONE) + return(rc); - break; + if (LOGLEVEL >= 8) + { + sprintf(log_buf,"Dependency requested parent job %s state (%s), child job %s", + preq->rq_ind.rq_register.rq_parent, + PJobState[pjob->ji_qs.ji_state], + preq->rq_ind.rq_register.rq_child); - case JOB_DEPEND_OP_READY: + log_event(PBSEVENT_JOB,PBS_EVENTCLASS_JOB,pjob->ji_qs.ji_jobid,log_buf); + } + + pjob->ji_modified = 1; + + /* more of the server:port fix kludge */ + if ((ps = strchr(preq->rq_ind.rq_register.rq_child, (int)'@'))) + { + snprintf(preq->rq_ind.rq_register.rq_svr, sizeof(preq->rq_ind.rq_register.rq_svr), "%s", ps + 1); - if ((pdep = find_depend(JOB_DEPEND_TYPE_SYNCCT, pattr))) - { - /* mark sender as running */ + *ps = '\0'; + } + else + { + /* We ignore what qsub sent us for the host. We need to use the + * server_name so we know we can connect to the active server. + * This is an high availability consideration */ + if (server_name != NULL) + strcpy(preq->rq_ind.rq_register.rq_svr, server_name); + else + strcpy(preq->rq_ind.rq_register.rq_svr, preq->rq_host); + } + + /* Handle the dependency */ + switch (preq->rq_ind.rq_register.rq_op) + { + case JOB_DEPEND_OP_REGISTER: - pdj = (struct depend_job *)GET_NEXT(pdep->dp_jobs); + rc = register_dependency(preq, pjob, type); - while (pdj) - { - if (strcmp(pdj->dc_child, preq->rq_ind.rq_register.rq_child) == 0) - { - pdj->dc_state = JOB_DEPEND_OP_READY; + break; + + case JOB_DEPEND_OP_RELEASE: - break; - } + rc = release_dependency(preq, pjob, type); - pdj = (struct depend_job *)GET_NEXT(pdj->dc_link); - } + break; - release_cheapest(pjob, pdep); /* release next one */ - } - else - { - rc = PBSE_NOSYNCMSTR; - } + case JOB_DEPEND_OP_READY: + rc = ready_dependency(preq, pjob); + break; - + case JOB_DEPEND_OP_DELETE: - - if (!strcmp(preq->rq_ind.rq_register.rq_parent, - preq->rq_ind.rq_register.rq_child)) - { - rc = PBSE_IVALREQ; /* prevent an infinite loop */ - - break; - } - - sprintf(log_buf, msg_registerdel, preq->rq_ind.rq_register.rq_child); - - log_event(PBSEVENT_JOB,PBS_EVENTCLASS_JOB,pjob->ji_qs.ji_jobid,log_buf); - - job_abt(&pjob, log_buf); - - /* pjob freed and set to NULL */ - + + rc = delete_dependency_job(preq, &pjob); + break; - + case JOB_DEPEND_OP_UNREG: - if (type == JOB_DEPEND_TYPE_SYNCWITH) - { - if (pjob->ji_qs.ji_state == JOB_STATE_RUNNING) - { - rc = PBSE_IVALREQ; - } - else - { - unregister_sync(pattr, preq); - } - } - else - { - unregister_dep(pattr, preq); - } - - set_depend_hold(pjob, pattr); - - break; + rc = unregister_dependency(preq, pjob, type); + break; default: @@ -596,13 +799,10 @@ int req_register( } else { - if ((pjob != NULL) && (pjob->ji_modified != 0)) - { - + if ((pjob != NULL) && + (pjob->ji_modified != 0)) job_save(pjob, SAVEJOB_FULL, 0); - } - reply_ack(preq); } @@ -864,12 +1064,12 @@ void set_array_depend_holds( job_array *pa) { - int compareNumber; + int compareNumber; - job *pjob; - struct array_depend_job *pdj; + job *pjob; + struct array_depend_job *pdj; - struct array_depend *pdep = (struct array_depend *)GET_NEXT(pa->ai_qs.deps); + struct array_depend *pdep = (struct array_depend *)GET_NEXT(pa->ai_qs.deps); /* loop through dependencies to update holds */ while (pdep != NULL) @@ -961,7 +1161,7 @@ void set_array_depend_holds( /* release the array's hold - set_depend_hold * will clear holds if there are no other dependencies * logged in set_depend_hold */ - set_depend_hold(pjob,&pjob->ji_wattr[JOB_ATR_depend]); + set_depend_hold(pjob, &pjob->ji_wattr[JOB_ATR_depend]); } unlock_ji_mutex(pjob, __func__, "1", LOGLEVEL); @@ -1060,7 +1260,7 @@ void post_doq( * routine for the dependency pbs_attribute. */ -static void alter_unreg( +void alter_unreg( job *pjob, pbs_attribute *old, /* current job dependency attribure */ @@ -1172,8 +1372,8 @@ int depend_on_que( unlock_ji_mutex(pjob, __func__, "2", LOGLEVEL); set_depend_hold(pjob, pattr); - if ((pjob = svr_find_job(job_id, FALSE)) == NULL) - return PBSE_JOBNOTFOUND; +/* if ((pjob = svr_find_job(job_id, FALSE)) == NULL) + return PBSE_JOBNOTFOUND;*/ /* Check if there are dependencies that require registering */ @@ -1255,9 +1455,9 @@ void post_doe( pattr = &pjob->ji_wattr[JOB_ATR_depend]; pdep = find_depend(JOB_DEPEND_TYPE_BEFORESTART, pattr); - if(pdep != NULL) + if (pdep != NULL) { - if((pdj = find_dependjob(pdep, preq->rq_ind.rq_register.rq_parent)) != NULL) + if ((pdj = find_dependjob(pdep, preq->rq_ind.rq_register.rq_parent)) != NULL) del_depend_job(pdj); if (GET_NEXT(pdep->dp_jobs) == 0) @@ -1535,7 +1735,7 @@ int depend_on_term( * sync set. */ -static void release_cheapest( +void release_cheapest( job *pjob, struct depend *pdep) @@ -1604,16 +1804,15 @@ void set_depend_hold( pbs_attribute *pattr) { - int loop = 1; - int newstate; - int newsubst; - - struct depend *pdp = NULL; + int loop = 1; + int newstate; + int newsubst; + struct depend *pdp = NULL; struct depend_job *djob = NULL; - struct job *djp = NULL; - int substate = -1; + struct job *djp = NULL; + int substate = -1; if (pattr->at_flags & ATR_VFLAG_SET) pdp = (struct depend *)GET_NEXT(pattr->at_val.at_list); @@ -1647,7 +1846,7 @@ void set_depend_hold( case JOB_DEPEND_TYPE_AFTERANY: /* If the job we are depending on has already completed */ - /* Then don't set this job on Dependant Hold, just leave it as Queued */ + /* Then don't set this job on dependent Hold, just leave it as Queued */ djob = (struct depend_job *)GET_NEXT(pdp->dp_jobs); if (djob) @@ -1711,7 +1910,6 @@ void set_depend_hold( } svr_evaljobstate(pjob, &newstate, &newsubst, 0); - svr_setjobstate(pjob, newstate, newsubst, FALSE); } } @@ -1749,14 +1947,13 @@ void depend_clrrdy( job *pjob) { - - struct depend *pdp; - + struct depend *pdp; struct depend_job *pdjb; pdp = (struct depend *)GET_NEXT(pjob->ji_wattr[JOB_ATR_depend].at_val.at_list); - while ((pdp != NULL) && (pdp->dp_type == JOB_DEPEND_TYPE_SYNCCT)) + while ((pdp != NULL) && + (pdp->dp_type == JOB_DEPEND_TYPE_SYNCCT)) { pdjb = (struct depend_job *)GET_NEXT(pdp->dp_jobs); @@ -1781,13 +1978,12 @@ void depend_clrrdy( * find_depend - find a dependency struct of a certain type for a job */ -static struct depend *find_depend( +struct depend *find_depend( int type, pbs_attribute *pattr) { - struct depend *pdep = NULL; if (pattr->at_flags & ATR_VFLAG_SET) @@ -1814,14 +2010,13 @@ static struct depend *find_depend( * make_depend - allocate and attach a depend struct to the attribute */ -static struct depend *make_depend( +struct depend *make_depend( int type, pbs_attribute *pattr) { - - struct depend *pdep = (struct depend *)0; + struct depend *pdep = NULL; pdep = (struct depend *)calloc(1, sizeof(struct depend)); @@ -1843,15 +2038,14 @@ static struct depend *make_depend( * register_sync - a "child job" is registering sync with its "parent" */ -static int register_sync( +int register_sync( struct depend *pdep, - char *child, - char *host, - long cost) + char *child, + char *host, + long cost) { - struct depend_job *pdj; if ((pdj = find_dependjob(pdep, child))) @@ -1863,7 +2057,7 @@ static int register_sync( else strcpy(pdj->dc_svr, host); - return(0); + return(PBSE_NONE); } /* a new registration, create depend_job entry */ @@ -1878,13 +2072,12 @@ static int register_sync( pdj->dc_cost = cost; /* increment number registered */ - if (++pdep->dp_numreg > pdep->dp_numexp + 1) { return(PBSE_IVALREQ); /* too many registered */ } - return(0); + return(PBSE_NONE); } /* END register_sync() */ @@ -1899,7 +2092,7 @@ static int register_sync( * */ -static int register_dep( +int register_dep( pbs_attribute *pattr, struct batch_request *preq, @@ -1931,7 +2124,7 @@ static int register_dep( *made = 0; - return(0); + return(PBSE_NONE); } if ((pdj = make_dependjob( @@ -1943,10 +2136,9 @@ static int register_dep( } /* SUCCESS */ - *made = 1; - return(0); + return(PBSE_NONE); } /* END register_dep() */ @@ -1960,16 +2152,15 @@ static int register_dep( * @see register_dep() */ -static int unregister_dep( +int unregister_dep( pbs_attribute *pattr, struct batch_request *preq) { - int type; + int type; struct depend *pdp; - struct depend_job *pdjb; /* get mirror image of dependency type */ @@ -1977,8 +2168,8 @@ static int unregister_dep( type = preq->rq_ind.rq_register.rq_dependtype ^ (JOB_DEPEND_TYPE_BEFORESTART - JOB_DEPEND_TYPE_AFTERSTART); - if (((pdp = find_depend(type, pattr)) == 0) || - ((pdjb = find_dependjob(pdp, preq->rq_ind.rq_register.rq_child)) == 0)) + if (((pdp = find_depend(type, pattr)) == NULL) || + ((pdjb = find_dependjob(pdp, preq->rq_ind.rq_register.rq_child)) == NULL)) { return(PBSE_IVALREQ); } @@ -1996,7 +2187,7 @@ static int unregister_dep( * Results from a qalter call to remove existing dependencies */ -static int unregister_sync( +int unregister_sync( pbs_attribute *pattr, struct batch_request *preq) @@ -2027,7 +2218,7 @@ static int unregister_sync( } } - return(0); + return(PBSE_NONE); } /* END unregister_sync() */ @@ -2071,17 +2262,14 @@ struct depend_job *find_dependjob( * make_dependjob - add a depend_job structue */ -static struct depend_job *make_dependjob( +struct depend_job *make_dependjob( struct depend *pdep, char *jobid, char *host) { - - struct depend_job *pdj; - - pdj = (struct depend_job *)calloc(1, sizeof(struct depend_job)); + struct depend_job *pdj = (struct depend_job *)calloc(1, sizeof(struct depend_job)); if (pdj != NULL) { @@ -2377,7 +2565,7 @@ static void cpy_jobsvr( * depend jobs, and as the server:port separater. Ugh! */ -static void cat_jobsvr( +void cat_jobsvr( char **Dest, char *Src) @@ -2411,7 +2599,7 @@ static void cat_jobsvr( * a tight loop */ -static void fast_strcat( +void fast_strcat( char **Dest, char *Src) @@ -2438,20 +2626,18 @@ static void fast_strcat( /* - * dup_depend - duplicate a dependency (see set_depend()) + * dup_depend - duplicate a dependency pd and store it in pattr + * @see set_depend() - parent */ -static int dup_depend( +int dup_depend( pbs_attribute *pattr, struct depend *pd) { - struct depend *pnwd; - struct depend_job *poldj; - struct depend_job *pnwdj; int type; @@ -2481,7 +2667,7 @@ static int dup_depend( pnwdj->dc_cost = poldj->dc_cost; } - return(0); + return(PBSE_NONE); } /* END dup_depend() */ @@ -2507,21 +2693,17 @@ int encode_depend( int perm) /* only used for resources */ { - int ct = 0; - char cvtbuf[22]; - int numdep = 0; - - struct depend *nxdp; + int ct = 0; + char cvtbuf[22]; + int numdep = 0; + struct depend *nxdp; struct svrattrl *pal; - - struct depend *pdp; - + struct depend *pdp; struct depend_job *pdjb = NULL; - struct dependnames *pn; - char *BPtr = 0; + char *BPtr = 0; if (!attr) return (-1); @@ -2546,7 +2728,7 @@ int encode_depend( } else { - ct += 12; /* for longest type */ + ct += 20; /* for longest type */ pdjb = (struct depend_job *)GET_NEXT(nxdp->dp_jobs); while (pdjb) @@ -2601,14 +2783,13 @@ int encode_depend( cat_jobsvr(&BPtr,pdjb->dc_svr); } - - pdjb = (struct depend_job *)GET_NEXT(pdjb->dc_link); - } - + + pdjb = (struct depend_job *)GET_NEXT(pdjb->dc_link); + } } - + ++numdep; - } + } if (numdep) { @@ -2647,17 +2828,14 @@ int set_depend( enum batch_op op) { - struct depend *pdnew; - struct depend *pdold; - int rc; + int rc; assert(attr && new_attr); switch (op) { - case SET: /* @@ -2763,26 +2941,25 @@ void free_depend( * Return 0 if ok, otherwise non-zero error number */ -static int build_depend( +int build_depend( pbs_attribute *pattr, char *value) { + struct depend *have[JOB_DEPEND_NUMBER_TYPES]; + int i; + int numwds; - struct depend *have[JOB_DEPEND_NUMBER_TYPES]; - int i; - int numwds; - - struct depend *pd; + struct depend *pd; struct depend_job *pdjb; struct dependnames *pname; - char *pwhere; - char *valwd; - char *nxwrd; - int type; + char *pwhere; + char *valwd; + char *nxwrd; + int type; /* * Map first subword into dependency type. If there is just the type @@ -2791,9 +2968,9 @@ static int build_depend( */ if ((nxwrd = strchr(value, (int)':')) != NULL) - * nxwrd++ = '\0'; + *nxwrd++ = '\0'; - for (pname = dependnames;pname->type != -1;pname++) + for (pname = dependnames; pname->type != -1; pname++) { if (!strcmp(value, pname->name)) break; @@ -2807,7 +2984,6 @@ static int build_depend( type = pname->type; /* what types do we have already? */ - for (i = 0;i < JOB_DEPEND_NUMBER_TYPES;i++) have[i] = NULL; @@ -2840,7 +3016,7 @@ static int build_depend( case JOB_DEPEND_TYPE_SYNCCT: - if (have[JOB_DEPEND_TYPE_SYNCWITH] || + if (have[JOB_DEPEND_TYPE_SYNCWITH] || have[JOB_DEPEND_TYPE_SYNCCT]) { return(PBSE_BADATVAL); @@ -2894,12 +3070,10 @@ static int build_depend( while (nxwrd && (*nxwrd != '\0')) { - numwds++; /* number of arguments */ valwd = nxwrd; /* find end of next word delimited by a : but not a '\:' */ - while (((*nxwrd != ':') || (*(nxwrd - 1) == '\\')) && *nxwrd) nxwrd++; @@ -2907,13 +3081,11 @@ static int build_depend( *nxwrd++ = '\0'; /* now process word (argument) depending on "depend type" */ - if ((type == JOB_DEPEND_TYPE_ON) || (type == JOB_DEPEND_TYPE_SYNCCT)) { /* a single word argument, a count */ - if (numwds == 1) { pd->dp_numexp = strtol(valwd, &pwhere, 10); @@ -2921,21 +3093,18 @@ static int build_depend( if ((pd->dp_numexp < 1) || (pwhere && (*pwhere != '\0'))) { - return (PBSE_BADATVAL); + return(PBSE_BADATVAL); } } else { - return (PBSE_BADATVAL); + return(PBSE_BADATVAL); } } else /* all other dependency types */ { - - /* a set of job_id[\:port][@server[\:port]] */ - pdjb = (struct depend_job *)calloc(1, sizeof(*pdjb)); if (pdjb) @@ -2981,7 +3150,7 @@ static int build_depend( else { free(pdjb); - return (PBSE_BADATVAL); + return(PBSE_BADATVAL); } } @@ -2989,7 +3158,7 @@ static int build_depend( } else { - return (PBSE_SYSTEM); + return(PBSE_SYSTEM); } } @@ -3009,14 +3178,13 @@ static int build_depend( * If the "exist" flag is set, any depend_job sub-structures are freed. */ -static void clear_depend( +void clear_depend( struct depend *pd, int type, int exist) { - struct depend_job *pdj; if (exist) @@ -3049,7 +3217,7 @@ static void clear_depend( * del_depend - delete a single dependency set, including any depend_jobs */ -static void del_depend( +void del_depend( struct depend *pd) @@ -3076,7 +3244,7 @@ static void del_depend( * del_depend_job - delete a single depend_job structure */ -static void del_depend_job( +void del_depend_job( struct depend_job *pdj) diff --git a/src/server/test/req_register/Makefile.am b/src/server/test/req_register/Makefile.am index 5197966d7d..852084b68e 100644 --- a/src/server/test/req_register/Makefile.am +++ b/src/server/test/req_register/Makefile.am @@ -9,7 +9,7 @@ AM_LDFLAGS = @CHECK_LIBS@ ${lib_LTLIBRARIES} check_PROGRAMS = test_req_register libreq_register_la_SOURCES = scaffolding.c ${PROG_ROOT}/req_register.c -libreq_register_la_LDFLAGS = @CHECK_LIBS@ -shared -L../../../lib/test/.libs -lscaffolding_lib +libreq_register_la_LDFLAGS = @CHECK_LIBS@ $(AM_LIBS) -shared test_req_register_SOURCES = test_req_register.c diff --git a/src/server/test/req_register/scaffolding.c b/src/server/test/req_register/scaffolding.c index dec0e84bd6..c2f081ef9d 100644 --- a/src/server/test/req_register/scaffolding.c +++ b/src/server/test/req_register/scaffolding.c @@ -1,6 +1,7 @@ #include "license_pbs.h" /* See here for the software license */ #include #include /* fprintf */ +#include #include "batch_request.h" /* batch_request */ #include "pbs_job.h" /* job */ @@ -17,10 +18,11 @@ char server_name[PBS_MAXSERVERNAME + 1]; char *msg_err_malloc = "malloc failed"; const char *PJobState[] = {"hi", "hello"}; struct server server; -int LOGLEVEL = 0; +int LOGLEVEL = 10; char *msg_regrej = "Dependency request for job rejected by "; char *msg_registerrel = "Dependency on job %s released."; - +int i = 2; +int svr = 2; struct batch_request *alloc_br(int type) @@ -31,8 +33,7 @@ struct batch_request *alloc_br(int type) int job_save(job *pjob, int updatetype, int mom_port) { - fprintf(stderr, "The call to job_save to be mocked!!\n"); - exit(1); + return(0); } void svr_mailowner(job *pjob, int mailpoint, int force, char *text) @@ -43,26 +44,64 @@ void svr_mailowner(job *pjob, int mailpoint, int force, char *text) svrattrl *attrlist_create(char *aname, char *rname, int vsize) { - fprintf(stderr, "The call to attrlist_create to be mocked!!\n"); - exit(1); + svrattrl *pal; + size_t asz; + size_t rsz; + + asz = strlen(aname) + 1; /* pbs_attribute name,allow for null term */ + + if (rname == NULL) /* resource name only if type resource */ + rsz = 0; + else + rsz = strlen(rname) + 1; + + pal = calloc(1, sizeof(svrattrl) + asz + rsz + vsize); + + CLEAR_LINK(pal->al_link); /* clear link */ + + pal->al_atopl.next = 0; + pal->al_tsize = sizeof(svrattrl) + asz + rsz + vsize; /* set various string sizes */ + pal->al_nameln = asz; + pal->al_rescln = rsz; + pal->al_valln = vsize; + pal->al_flags = 0; + pal->al_op = SET; + + /* point ptrs to name, resc, and val strings to memory after svrattrl struct */ + + pal->al_name = (char *)pal + sizeof(svrattrl); + + pal->al_resc = NULL; + + pal->al_value = pal->al_name + asz + rsz; + + strcpy(pal->al_name, aname); /* copy name right after struct */ + + return(pal); } void reply_ack(struct batch_request *preq) { - fprintf(stderr, "The call to reply_ack to be mocked!!\n"); - exit(1); } void delete_link(struct list_link *old) { - fprintf(stderr, "The call to delete_link to be mocked!!\n"); - exit(1); + if ((old->ll_prior != (list_link *)0) && + (old->ll_prior != old) && (old->ll_prior->ll_next == old)) + (old->ll_prior)->ll_next = old->ll_next; + + if ((old->ll_next != (list_link *)0) && + (old->ll_next != old) && (old->ll_next->ll_prior == old)) + (old->ll_next)->ll_prior = old->ll_prior; + + old->ll_next = old; + + old->ll_prior = old; } long calc_job_cost(job *pjob) { - fprintf(stderr, "The call to calc_job_cost to be mocked!!\n"); - exit(1); + return(0); } job_array *get_array(char *id) @@ -71,28 +110,31 @@ job_array *get_array(char *id) exit(1); } -void req_reject(int code, int aux, struct batch_request *preq, char *HostName, char *Msg) - { - fprintf(stderr, "The call to req_reject to be mocked!!\n"); - exit(1); - } +void req_reject(int code, int aux, struct batch_request *preq, char *HostName, char *Msg) {} int svr_chk_owner(struct batch_request *preq, job *pjob) { - fprintf(stderr, "The call to svr_chk_owner to be mocked!!\n"); - exit(1); + return(0); } int job_abt(job **pjobp, char *text) { - fprintf(stderr, "The call to job_abt to be mocked!!\n"); - exit(1); + *pjobp = NULL; + return(0); } void *get_next(list_link pl, char *file, int line) { - fprintf(stderr, "The call to get_next to be mocked!!\n"); - exit(1); + if ((pl.ll_next == NULL) || + ((pl.ll_next == &pl) && (pl.ll_struct != NULL))) + { + fprintf(stderr, "Assertion failed, bad pointer in link: file \"%s\", line %d\n", + file, line); + + return(NULL); + } + + return(pl.ll_next->ll_struct); } void release_req(struct work_task *pwt) @@ -103,14 +145,25 @@ void release_req(struct work_task *pwt) char *pbse_to_txt(int err) { - fprintf(stderr, "The call to pbse_to_txt to be mocked!!\n"); - exit(1); + return(""); } void append_link(tlist_head *head, list_link *new_link, void *pobj) { - fprintf(stderr, "The call to append_link to be mocked!!\n"); - exit(1); + if (pobj != NULL) + { + new_link->ll_struct = pobj; + } + else + { + new_link->ll_struct = (void *)new_link; + } + + new_link->ll_prior = head->ll_prior; + + new_link->ll_next = head; + head->ll_prior = new_link; + new_link->ll_prior->ll_next = new_link; /* now visible to forward iteration */ } int issue_to_svr(char *servern, struct batch_request *preq, void (*replyfunc)(struct work_task *)) @@ -119,32 +172,105 @@ int issue_to_svr(char *servern, struct batch_request *preq, void (*replyfunc)(st exit(1); } -int svr_setjobstate(job *pjob, int newstate, int newsubstate, int has_queue_mute) +int svr_setjobstate(job *pjob, int newstate, int newsubstate, int has_queue_mutex) { - fprintf(stderr, "The call to svr_setjobstate to be mocked!!\n"); - exit(1); + pjob->ji_qs.ji_state = newstate; + pjob->ji_qs.ji_substate = newsubstate; + return(0); } job *svr_find_job(char *jobid, int get_subjob) { - fprintf(stderr, "The call to find_job to be mocked!!\n"); - exit(1); + job *pjob = calloc(1, sizeof(job)); + strcpy(pjob->ji_qs.ji_jobid, jobid); + CLEAR_HEAD(pjob->ji_wattr[JOB_ATR_depend].at_val.at_list); + + if (!strcmp(jobid, "1.napali")) + { + return(pjob); + } + else if (!strcmp(jobid, "2.napali")) + { + pjob->ji_qs.ji_state = JOB_STATE_COMPLETE; + return(pjob); + } + else + return(NULL); } void svr_evaljobstate(job *pjob, int *newstate, int *newsub, int forceeval) { - fprintf(stderr, "The call to svr_evaljobstate to be mocked!!\n"); - exit(1); + *newstate = 0; + *newsub = 0; } char *parse_comma_string(char *start, char **ptr) { - fprintf(stderr, "The call to parse_comma_string to be mocked!!\n"); - exit(1); + char *pc; /* if start is null, restart from here */ + + char *back; + char *rv; + + if ((ptr == NULL) || + ((*ptr == NULL) && (start == NULL))) + return(NULL); + + if (start != NULL) + pc = start; + else + pc = *ptr; + + if (*pc == '\0') + { + return(NULL); /* already at end, no strings */ + } + + /* skip over leading white space */ + + while ((*pc != '\n') && isspace((int)*pc) && *pc) + pc++; + + rv = pc; /* the start point which will be returned */ + + /* go find comma or end of line */ + + while (*pc) + { + if (*pc == '\\') + { + if (*++pc == '\0') + break; + } + else if ((*pc == ',') || (*pc == '\n')) + { + break; + } + + ++pc; + } + + back = pc; + + while (isspace((int)*--back)) /* strip trailing spaces */ + *back = '\0'; + + if (*pc != '\0') + *pc++ = '\0'; /* if not end, terminate this and adv past */ + + *ptr = pc; + + return(rv); } int get_svr_attr_l(int index, long *l) { + if (svr == 1) + *l = SV_STATE_INIT; + else if (svr == 10) + *l = 0; + else + *l = SV_STATE_RUN; + return(0); } @@ -185,3 +311,6 @@ int unlock_ai_mutex(job_array *pa, const char *id, char *msg, int logging) { return(0); } + +void log_event(int eventtype, int objclass, const char *objname, char *text) {} +void log_err(int errnum, const char *routine, char *text) {} diff --git a/src/server/test/req_register/test_req_register.c b/src/server/test/req_register/test_req_register.c index 5a89977b1c..a88d816fb9 100644 --- a/src/server/test/req_register/test_req_register.c +++ b/src/server/test/req_register/test_req_register.c @@ -1,32 +1,816 @@ #include "license_pbs.h" /* See here for the software license */ -#include "req_register.h" -#include "test_req_register.h" #include #include + +#include "req_register.h" +#include "test_req_register.h" #include "pbs_error.h" -START_TEST(test_one) +#include "pbs_job.h" +#include "batch_request.h" +#include "attribute.h" + + +int check_dependency_job(char *jobid, batch_request *preq, job **job_ptr); +void clear_depend(struct depend *pd, int type, int exist); +struct depend *find_depend(int type, pbs_attribute *pattr); +struct depend *make_depend(int type, pbs_attribute *pattr); +struct depend_job *make_dependjob(struct depend *pdep, char *jobid, char *host); +struct depend_job *find_dependjob(struct depend *pdep, char *name); +int register_sync(struct depend *pdep, char *child, char *host, long cost); +int register_dep(pbs_attribute *pattr, batch_request *preq, int type, int *made); +int unregister_dep(pbs_attribute *pattr, batch_request *preq); +void del_depend(struct depend *pd); +int comp_depend(pbs_attribute *a1, pbs_attribute *a2); +void free_depend(pbs_attribute *pattr); +int build_depend(pbs_attribute *pattr, char *value); +void fast_strcat(char **Dest, char *Src); +int dup_depend(pbs_attribute *pattr, struct depend *pd); +void cat_jobsvr(char **Dest, char *Src); +int decode_depend(pbs_attribute *pattr, char *name, char *rescn, char *val, int perm); +int encode_depend(pbs_attribute *pattr, tlist_head *phead, char *atname, char *rsname, int mode, int perm); +int set_depend(pbs_attribute *attr, pbs_attribute *new_attr, enum batch_op op); +int unregister_sync(pbs_attribute *attr, batch_request *preq); +int register_before_dep(batch_request *preq, job *pjob, int type); +int register_dependency(batch_request *preq, job *pjob, int type); +int release_before_dependency(batch_request *preq, job *pjob, int type); +int release_syncwith_dependency(batch_request *preq, job *pjob); +void set_depend_hold(job *pjob, pbs_attribute *pattr); +int delete_dependency_job(batch_request *preq, job **pjob_ptr); +int req_register(batch_request *preq); + +extern char server_name[]; +extern int i; +extern int svr; + +char *job1 = "1.napali"; +char *job2 = "2.napali"; +char *host = "napali"; + + +void initialize_depend_attr( + + pbs_attribute *pattr) + + { + memset(pattr, 0, sizeof(pbs_attribute)); + CLEAR_HEAD(pattr->at_val.at_list); + } /* END initialize_depend_attr() */ + + + +START_TEST(check_dependency_job_test) + { + job *pjob = NULL; + batch_request preq; + char *jobid = strdup("1.napali"); + + memset(&preq, 0, sizeof(preq)); + + fail_unless(check_dependency_job(NULL, NULL, NULL) == PBSE_BAD_PARAMETER, "passed bad params?"); + fail_unless(check_dependency_job(jobid, &preq, &pjob) == PBSE_IVALREQ, "accepted non-server request?"); + + preq.rq_fromsvr = 1; + fail_unless(check_dependency_job(jobid, &preq, &pjob) == PBSE_NONE, "error?"); + fail_unless(pjob != NULL, "didn't get a valid job?"); + + fail_unless(check_dependency_job("bob", &preq, &pjob) == PBSE_UNKJOBID, "found unknown?"); + fail_unless(pjob == NULL, "didn't set job to NULL"); + + svr = 1; + fail_unless(check_dependency_job("bob", &preq, &pjob) == PBSE_JOBNOTFOUND, "wrong rc"); + fail_unless(pjob == NULL, "didn't set job to NULL"); + svr = 2; + + fail_unless(check_dependency_job("2.napali", &preq, &pjob) == PBSE_BADSTATE, "wrong rc"); + } +END_TEST + + + + +START_TEST(find_depend_test) + { + pbs_attribute pattr; + struct depend *pdep; + + initialize_depend_attr(&pattr); + pdep = make_depend(1, &pattr); + pdep = make_depend(2, &pattr); + pdep = make_depend(3, &pattr); + + pdep = find_depend(1, &pattr); + fail_unless(pdep != NULL, "couldn't find 1"); + fail_unless(pdep->dp_type == 1, "bad type returned"); + + pdep = find_depend(2, &pattr); + fail_unless(pdep != NULL, "couldn't find 2"); + fail_unless(pdep->dp_type == 2, "bad type returned"); + + pdep = find_depend(3, &pattr); + fail_unless(pdep != NULL, "couldn't find 3"); + fail_unless(pdep->dp_type == 3, "bad type returned"); + + pdep = find_depend(0, &pattr); + fail_unless(pdep == NULL, "found non-existent thing"); + } +END_TEST + + + +START_TEST(clear_depend_test) + { + struct depend pd; + + i = 1; + clear_depend(&pd, 0, 0); + + fail_unless(pd.dp_type == 0, "type not set"); + fail_unless(pd.dp_numexp == 0, "attr not set correctly"); + fail_unless(pd.dp_numreg == 0, "attr not set correctly"); + fail_unless(pd.dp_released == 0, "attr not set correctly"); + + i = 1; + memset(&pd, 0, sizeof(pd)); + CLEAR_HEAD(pd.dp_jobs); + + make_dependjob(&pd, job1, host); + make_dependjob(&pd, job2, host); + clear_depend(&pd, 0, 1); + fail_unless(pd.dp_type == 0, "type not set"); + fail_unless(pd.dp_numexp == 0, "attr not set correctly"); + fail_unless(pd.dp_numreg == 0, "attr not set correctly"); + fail_unless(pd.dp_released == 0, "attr not set correctly"); + } +END_TEST + + + + +START_TEST(make_depend_test) + { + pbs_attribute pattr; + struct depend *pdep; + + memset(&pattr, 0, sizeof(pattr)); + CLEAR_HEAD(pattr.at_val.at_list); + + pdep = make_depend(1, &pattr); + fail_unless((pattr.at_flags & ATR_VFLAG_SET) != 0, "didn't set attribute"); + fail_unless(pdep->dp_type == 1, "type not set"); + + pdep = make_depend(2, &pattr); + fail_unless(pdep->dp_type == 2, "type not set"); + } +END_TEST + + + + +START_TEST(find_dependjob_test) + { + struct depend pdep; + struct depend_job *d1; + struct depend_job *d2; + + memset(&pdep, 0, sizeof(pdep)); + CLEAR_HEAD(pdep.dp_jobs); + + fail_unless((d1 = make_dependjob(&pdep, job1, host)) != NULL, "didn't create dep 1"); + fail_unless((d2 = make_dependjob(&pdep, job2, host)) != NULL, "didn't create dep 2"); + fail_unless(d1 == find_dependjob(&pdep, job1), "didn't find job1"); + fail_unless(d2 == find_dependjob(&pdep, job2), "didn't find job2"); + fail_unless(find_dependjob(&pdep, "bob") == NULL, "found bob?"); + + svr = 10; /* will make display server suffix false, see scaffolding */ + fail_unless(d1 == find_dependjob(&pdep, "1"), "didn't find job1 without suffix"); + fail_unless(d2 == find_dependjob(&pdep, "2"), "didn't find job2 without suffix"); + } +END_TEST + + + + +START_TEST(make_dependjob_test) + { + struct depend pdep; + struct depend_job *d1; + struct depend_job *d2; + + memset(&pdep, 0, sizeof(pdep)); + CLEAR_HEAD(pdep.dp_jobs); + + fail_unless((d1 = make_dependjob(&pdep, job1, host)) != NULL, "didn't create dep 1"); + fail_unless((d2 = make_dependjob(&pdep, job2, host)) != NULL, "didn't create dep 2"); + fail_unless(d1->dc_cost == 0, "bad cost"); + fail_unless(d1->dc_state == 0, "bad state"); + fail_unless(strcmp(d1->dc_child, job1) == 0, "bad job id1"); + fail_unless(strcmp(d2->dc_child, job2) == 0, "bad job id2"); + } +END_TEST + + + + +START_TEST(register_sync_test) + { + struct depend pdep; + + memset(&pdep, 0, sizeof(pdep)); + CLEAR_HEAD(pdep.dp_jobs); + + fail_unless(register_sync(&pdep, job1, host, 1) == PBSE_NONE, "didn't register"); + fail_unless(register_sync(&pdep, job1, host, 1) == PBSE_NONE, "second register"); + pdep.dp_numexp = -10; + fail_unless(register_sync(&pdep, job2, host, 1) == PBSE_IVALREQ, "too many registered"); + + } +END_TEST + + + + +START_TEST(register_dep_test) + { + pbs_attribute pattr; + batch_request preq; + int made = 0; + + initialize_depend_attr(&pattr); + memset(&preq, 0, sizeof(preq)); + strcpy(preq.rq_ind.rq_register.rq_svr, host); + strcpy(preq.rq_ind.rq_register.rq_child, job1); + + strcpy(server_name, host); + + fail_unless(register_dep(&pattr, &preq, 1, &made) == PBSE_NONE, "didn't register"); + fail_unless(register_dep(&pattr, &preq, 1, &made) == PBSE_NONE, "didn't register"); + } +END_TEST + + + + +START_TEST(unregister_dep_test) + { + pbs_attribute pattr; + struct depend *pdep; + batch_request preq; + + memset(&preq, 0, sizeof(preq)); + strcpy(preq.rq_ind.rq_register.rq_svr, host); + strcpy(preq.rq_ind.rq_register.rq_child, job1); + preq.rq_ind.rq_register.rq_dependtype = 1; + + initialize_depend_attr(&pattr); + + fail_unless(unregister_dep(&pattr, &preq) == PBSE_IVALREQ, "didn't error on non-existent dep"); + + pdep = make_depend(5, &pattr); + make_dependjob(pdep, job1, host); + + fail_unless(unregister_dep(&pattr, &preq) == PBSE_NONE, "didn't unregister"); + } +END_TEST + + + + +START_TEST(del_depend_test) + { + struct depend *pdep = calloc(1, sizeof(struct depend)); + + CLEAR_HEAD(pdep->dp_jobs); + CLEAR_HEAD(pdep->dp_link); + + make_dependjob(pdep, job1, host); + make_dependjob(pdep, job2, host); + + del_depend(pdep); + } +END_TEST + + + + +START_TEST(comp_depend_test) + { + fail_unless(comp_depend(NULL, NULL) == -1, "update the unit test"); + } +END_TEST + + + + +START_TEST(free_depend_test) + { + pbs_attribute pattr; + struct depend *pdep; + + initialize_depend_attr(&pattr); + pdep = make_depend(5, &pattr); + make_dependjob(pdep, job1, host); + pdep = make_depend(6, &pattr); + make_dependjob(pdep, job2, host); + + free_depend(&pattr); + fail_unless((pattr.at_flags & ATR_VFLAG_SET) == 0, "didn't free?"); + } +END_TEST + + + + +START_TEST(build_depend_test) + { + pbs_attribute pattr; + + initialize_depend_attr(&pattr); + + fail_unless(build_depend(&pattr, strdup("afterok:1.napali")) == 0, "didn't build"); + fail_unless(build_depend(&pattr, strdup("bob:1.napali")) == PBSE_BADATVAL, "bad dependency didn't fail"); + fail_unless(build_depend(&pattr, strdup("syncwith:1.napali")) == PBSE_BADATVAL, "bad combo not rejected"); + fail_unless(build_depend(&pattr, strdup("on:1.napali")) == PBSE_BADATVAL, "bad combo 2 not rejected"); + + strcpy(server_name, host); + initialize_depend_attr(&pattr); + fail_unless(build_depend(&pattr, strdup("on:6")) == PBSE_NONE, "on build"); + + initialize_depend_attr(&pattr); + fail_unless(build_depend(&pattr, strdup("beforeok:2.napali@bob")) == PBSE_NONE, "@server"); + fail_unless(build_depend(&pattr, strdup("afterokarray:10[].napali")) == PBSE_BADATVAL, "array combo didn't fail"); + } +END_TEST + + + + +START_TEST(dup_depend_test) + { + struct depend pdep; + pbs_attribute pattr; + + initialize_depend_attr(&pattr); + memset(&pdep, 0, sizeof(pdep)); + CLEAR_HEAD(pdep.dp_jobs); + + make_dependjob(&pdep, job1, host); + make_dependjob(&pdep, job2, host); + fail_unless(dup_depend(&pattr, &pdep) == PBSE_NONE, "didn't work"); + } +END_TEST + + + + +START_TEST(fast_strcat_test) + { + char buf[100]; + char *b = buf; + + memset(buf, 0, sizeof(buf)); + fast_strcat(NULL, "a"); + fast_strcat(&b, "1"); + fail_unless(strcmp(buf, "1") == 0, "fail 1"); + fast_strcat(&b, "2"); + fail_unless(strcmp(buf, "12") == 0, "fail 2"); + fast_strcat(&b, "34"); + fail_unless(strcmp(buf, "1234") == 0, "fail 3"); + } +END_TEST + + + + +START_TEST(cat_jobsvr_test) + { + char buf[100]; + char *b = buf; + + memset(buf, 0, sizeof(buf)); + cat_jobsvr(NULL, "a"); + cat_jobsvr(&b, "bobby:14003"); + fail_unless(strcmp(buf, "bobby\\:14003") == 0, "fail"); + } +END_TEST + + + + +START_TEST(decode_depend_test) + { + pbs_attribute pattr; + + initialize_depend_attr(&pattr); + + fail_unless(decode_depend(&pattr, NULL, NULL, NULL, 0) == 0, "null failed"); + fail_unless(decode_depend(&pattr, NULL, NULL, "", 0) == 0, "empty failed"); + fail_unless(decode_depend(&pattr, NULL, NULL, strdup("afterok:1.napali,beforeany:2.napali"), 0) == 0, "empty failed"); + fail_unless(decode_depend(&pattr, NULL, NULL, strdup("bart"), 0) != PBSE_NONE, "bad worked?"); + } +END_TEST + + + + +START_TEST(encode_depend_test) + { + pbs_attribute pattr; + struct depend *pdep; + tlist_head phead; + + initialize_depend_attr(&pattr); + CLEAR_HEAD(phead); + + fail_unless(encode_depend(NULL, NULL, NULL, NULL, 0, 0) == -1, "null"); + fail_unless(encode_depend(&pattr, NULL, NULL, NULL, 0, 0) == 0, "empty"); + + pdep = make_depend(5, &pattr); + make_dependjob(pdep, job1, host); + pdep = make_depend(6, &pattr); + make_dependjob(pdep, job2, host); + + fail_unless(encode_depend(&pattr, &phead, "depend", NULL, 0, 0) == 1, "encoding"); + } +END_TEST + + + + +START_TEST(set_depend_test) + { + pbs_attribute pattr; + pbs_attribute pa2; + struct depend *pdep; + tlist_head phead; + + initialize_depend_attr(&pattr); + initialize_depend_attr(&pa2); + CLEAR_HEAD(phead); + + pdep = make_depend(5, &pattr); + make_dependjob(pdep, job1, host); + pdep = make_depend(6, &pattr); + make_dependjob(pdep, job2, host); + + fail_unless(set_depend(&pa2, &pattr, INCR) == PBSE_IVALREQ, "INCR worked?"); + fail_unless(set_depend(&pa2, &pattr, SET) == PBSE_NONE, "fail set?"); + } +END_TEST + + + + +START_TEST(unregister_sync_test) + { + pbs_attribute pattr; + struct depend *pdep; + batch_request preq; + + initialize_depend_attr(&pattr); + memset(&preq, 0, sizeof(preq)); + + pdep = make_depend(JOB_DEPEND_TYPE_SYNCCT, &pattr); + make_dependjob(pdep, job1, host); + make_dependjob(pdep, job2, host); + pdep->dp_released = 1; + + fail_unless(unregister_sync(&pattr, &preq) == PBSE_IVALREQ, "bad name worked?"); + strcpy(preq.rq_ind.rq_register.rq_child, job1); + fail_unless(unregister_sync(&pattr, &preq) == PBSE_NONE, "success"); + } +END_TEST + + + + +START_TEST(depend_clrrdy_test) + { + pbs_attribute *pattr; + job pjob; + struct depend *pdep; + + memset(&pjob, 0, sizeof(pjob)); + pattr = &pjob.ji_wattr[JOB_ATR_depend]; + initialize_depend_attr(pattr); + pdep = make_depend(JOB_DEPEND_TYPE_SYNCCT, pattr); + make_dependjob(pdep, job1, host); + depend_clrrdy(&pjob); + } +END_TEST + + + + +START_TEST(register_before_dep_test) + { + batch_request preq; + job pjob; + pbs_attribute *pattr; + struct depend *pdep; + int rc = 0; + char buf[1000]; + + memset(&preq, 0, sizeof(preq)); + memset(&pjob, 0, sizeof(pjob)); + + strcpy(preq.rq_ind.rq_register.rq_owner, "dbeer"); + strcpy(preq.rq_ind.rq_register.rq_child, job1); + strcpy(preq.rq_ind.rq_register.rq_svr, host); + + pattr = &pjob.ji_wattr[JOB_ATR_depend]; + initialize_depend_attr(pattr); + pdep = make_depend(1, pattr); + make_dependjob(pdep, job1, host); + rc = register_dependency(&preq, &pjob, JOB_DEPEND_TYPE_BEFOREOK); + snprintf(buf, sizeof(buf), "rc = %d", rc); + fail_unless(rc == PBSE_NONE, "first, rc = %d", rc); + + pattr = &pjob.ji_wattr[JOB_ATR_depend]; + initialize_depend_attr(pattr); + pdep = make_depend(JOB_DEPEND_TYPE_ON, pattr); + make_dependjob(pdep, job1, host); + fail_unless(register_before_dep(&preq, &pjob, 1) == PBSE_NONE, "second"); + } +END_TEST + + + + +START_TEST(register_dependency_test) { + batch_request preq; + job pjob; + pbs_attribute *pattr; + + memset(&preq, 0, sizeof(preq)); + memset(&pjob, 0, sizeof(pjob)); + strcpy(preq.rq_ind.rq_register.rq_owner, "dbeer"); + strcpy(preq.rq_ind.rq_register.rq_child, job1); + strcpy(preq.rq_ind.rq_register.rq_svr, host); + strcpy(preq.rq_ind.rq_register.rq_parent, job1); + fail_unless(register_dependency(&preq, &pjob, 1) == PBSE_IVALREQ); + strcpy(preq.rq_ind.rq_register.rq_parent, job2); + fail_unless(register_dependency(&preq, &pjob, -1) == PBSE_IVALREQ); + + pattr = &pjob.ji_wattr[JOB_ATR_depend]; + initialize_depend_attr(pattr); + + fail_unless(register_dependency(&preq, &pjob, JOB_DEPEND_TYPE_AFTERSTART) == PBSE_NONE); + } +END_TEST + + + + +START_TEST(release_before_dependency_test) + { + batch_request preq; + job pjob; + pbs_attribute *pattr; + struct depend *pdep; + int rc = 0; + + memset(&preq, 0, sizeof(preq)); + memset(&pjob, 0, sizeof(pjob)); + + strcpy(preq.rq_ind.rq_register.rq_owner, "dbeer"); + strcpy(preq.rq_ind.rq_register.rq_child, job1); + strcpy(preq.rq_ind.rq_register.rq_svr, host); + + pattr = &pjob.ji_wattr[JOB_ATR_depend]; + initialize_depend_attr(pattr); + pdep = make_depend(1, pattr); + make_dependjob(pdep, job1, host); + rc = register_dependency(&preq, &pjob, JOB_DEPEND_TYPE_BEFOREOK); + + fail_unless(release_before_dependency(&preq, &pjob, JOB_DEPEND_TYPE_BEFOREOK) == PBSE_NONE); + fail_unless(release_before_dependency(&preq, &pjob, JOB_DEPEND_TYPE_BEFOREOK) == PBSE_IVALREQ); } END_TEST -START_TEST(test_two) + + + +START_TEST(release_syncwith_dependency_test) { + pbs_attribute *pattr; + job pjob; + struct depend *pdep; + batch_request preq; + memset(&preq, 0, sizeof(preq)); + memset(&pjob, 0, sizeof(pjob)); + pattr = &pjob.ji_wattr[JOB_ATR_depend]; + initialize_depend_attr(pattr); + fail_unless(release_syncwith_dependency(&preq, &pjob) == PBSE_NOSYNCMSTR); + + pdep = make_depend(JOB_DEPEND_TYPE_SYNCWITH, pattr); + make_dependjob(pdep, job1, host); + pdep->dp_released = 0; + + fail_unless(release_syncwith_dependency(&preq, &pjob) == PBSE_NONE); } END_TEST + + + +START_TEST(set_depend_hold_test) + { + pbs_attribute *pattr; + job pjob; + job pjob2; + struct depend *pdep; + + memset(&pjob, 0, sizeof(pjob)); + pattr = &pjob.ji_wattr[JOB_ATR_depend]; + initialize_depend_attr(pattr); + pdep = make_depend(JOB_DEPEND_TYPE_AFTERNOTOK, pattr); + make_dependjob(pdep, job2, host); + + set_depend_hold(&pjob, pattr); + fail_unless((pjob.ji_wattr[JOB_ATR_hold].at_flags & ATR_VFLAG_SET) != 0); + fail_unless(pjob.ji_qs.ji_state == JOB_STATE_HELD); + + memset(&pjob2, 0, sizeof(pjob2)); + pjob2.ji_qs.ji_substate = JOB_SUBSTATE_DEPNHOLD; + pattr = &pjob2.ji_wattr[JOB_ATR_depend]; + initialize_depend_attr(pattr); + pdep = make_depend(JOB_DEPEND_TYPE_AFTEROK, pattr); + make_dependjob(pdep, job2, host); + + set_depend_hold(&pjob2, pattr); + fail_unless((pjob2.ji_wattr[JOB_ATR_hold].at_flags & ATR_VFLAG_SET) == 0); + fail_unless(pjob2.ji_qs.ji_state != JOB_STATE_HELD); + } +END_TEST + + + + +START_TEST(delete_dependency_job_test) + { + job *pjob; + batch_request preq; + + memset(&preq, 0, sizeof(preq)); + strcpy(preq.rq_ind.rq_register.rq_parent, job1); + strcpy(preq.rq_ind.rq_register.rq_child, job1); + + fail_unless(delete_dependency_job(&preq, &pjob) == PBSE_IVALREQ); + strcpy(preq.rq_ind.rq_register.rq_child, job2); + fail_unless(delete_dependency_job(&preq, &pjob) == PBSE_NONE); + fail_unless(pjob == NULL); + } +END_TEST + + + + +START_TEST(req_register_test) + { + batch_request *preq = calloc(1, sizeof(batch_request)); + + strcpy(preq->rq_ind.rq_register.rq_parent, job1); + preq->rq_fromsvr = 1; + preq->rq_ind.rq_register.rq_dependtype = JOB_DEPEND_TYPE_AFTEROK; + + preq->rq_ind.rq_register.rq_op = -10; + fail_unless(req_register(preq) == PBSE_IVALREQ); + + preq->rq_ind.rq_register.rq_op = JOB_DEPEND_OP_REGISTER; + fail_unless(req_register(preq) == PBSE_NONE); + + preq->rq_ind.rq_register.rq_op = JOB_DEPEND_OP_RELEASE; + fail_unless(req_register(preq) == PBSE_NONE); + + preq->rq_ind.rq_register.rq_op = JOB_DEPEND_OP_DELETE; + fail_unless(req_register(preq) == PBSE_NONE); + + preq->rq_ind.rq_register.rq_op = JOB_DEPEND_OP_UNREG; + fail_unless(req_register(preq) == PBSE_NONE); + } +END_TEST + + + + Suite *req_register_suite(void) { Suite *s = suite_create("req_register_suite methods"); - TCase *tc_core = tcase_create("test_one"); - tcase_add_test(tc_core, test_one); + TCase *tc_core = tcase_create("check_dependency_job_test"); + tcase_add_test(tc_core, check_dependency_job_test); + suite_add_tcase(s, tc_core); + + tc_core = tcase_create("find_depend_test"); + tcase_add_test(tc_core, find_depend_test); + suite_add_tcase(s, tc_core); + + tc_core = tcase_create("clear_depend_test"); + tcase_add_test(tc_core, clear_depend_test); + suite_add_tcase(s, tc_core); + + tc_core = tcase_create("make_depend_test"); + tcase_add_test(tc_core, make_depend_test); + suite_add_tcase(s, tc_core); + + tc_core = tcase_create("register_sync_test"); + tcase_add_test(tc_core, register_sync_test); + suite_add_tcase(s, tc_core); + + tc_core = tcase_create("find_dependjob_test"); + tcase_add_test(tc_core, find_dependjob_test); + suite_add_tcase(s, tc_core); + + tc_core = tcase_create("make_dependjob_test"); + tcase_add_test(tc_core, make_dependjob_test); + suite_add_tcase(s, tc_core); + + tc_core = tcase_create("register_dep_test"); + tcase_add_test(tc_core, register_dep_test); + suite_add_tcase(s, tc_core); + + tc_core = tcase_create("unregister_dep_test"); + tcase_add_test(tc_core, unregister_dep_test); + suite_add_tcase(s, tc_core); + + tc_core = tcase_create("del_depend_test"); + tcase_add_test(tc_core, del_depend_test); + suite_add_tcase(s, tc_core); + + tc_core = tcase_create("comp_depend_test"); + tcase_add_test(tc_core, comp_depend_test); + suite_add_tcase(s, tc_core); + + tc_core = tcase_create("free_depend_test"); + tcase_add_test(tc_core, free_depend_test); + suite_add_tcase(s, tc_core); + + tc_core = tcase_create("build_depend_test"); + tcase_add_test(tc_core, build_depend_test); + suite_add_tcase(s, tc_core); + + tc_core = tcase_create("dup_depend_test"); + tcase_add_test(tc_core, dup_depend_test); + suite_add_tcase(s, tc_core); + + tc_core = tcase_create("fast_strcat_test"); + tcase_add_test(tc_core, fast_strcat_test); + suite_add_tcase(s, tc_core); + + tc_core = tcase_create("cat_jobsvr_test"); + tcase_add_test(tc_core, cat_jobsvr_test); + suite_add_tcase(s, tc_core); + + tc_core = tcase_create("decode_depend_test"); + tcase_add_test(tc_core, decode_depend_test); + suite_add_tcase(s, tc_core); + + tc_core = tcase_create("encode_depend_test"); + tcase_add_test(tc_core, encode_depend_test); + suite_add_tcase(s, tc_core); + + tc_core = tcase_create("set_depend_test"); + tcase_add_test(tc_core, set_depend_test); + suite_add_tcase(s, tc_core); + + tc_core = tcase_create("unregister_sync_test"); + tcase_add_test(tc_core, unregister_sync_test); + suite_add_tcase(s, tc_core); + + tc_core = tcase_create("depend_clrrdy_test"); + tcase_add_test(tc_core, depend_clrrdy_test); + suite_add_tcase(s, tc_core); + + tc_core = tcase_create("register_before_dep_test"); + tcase_add_test(tc_core, register_before_dep_test); + suite_add_tcase(s, tc_core); + + tc_core = tcase_create("register_dependency_test"); + tcase_add_test(tc_core, register_dependency_test); + suite_add_tcase(s, tc_core); + + tc_core = tcase_create("release_before_dependency_test"); + tcase_add_test(tc_core, release_before_dependency_test); + suite_add_tcase(s, tc_core); + + tc_core = tcase_create("release_syncwith_dependency_test"); + tcase_add_test(tc_core, release_syncwith_dependency_test); + suite_add_tcase(s, tc_core); + + tc_core = tcase_create("set_depend_hold_test"); + tcase_add_test(tc_core, set_depend_hold_test); + suite_add_tcase(s, tc_core); + + tc_core = tcase_create("delete_dependency_job_test"); + tcase_add_test(tc_core, delete_dependency_job_test); suite_add_tcase(s, tc_core); - tc_core = tcase_create("test_two"); - tcase_add_test(tc_core, test_two); + tc_core = tcase_create("req_register_test"); + tcase_add_test(tc_core, req_register_test); suite_add_tcase(s, tc_core); return s; diff --git a/src/server/user_info.c b/src/server/user_info.c index d591869236..f3b3a2e133 100644 --- a/src/server/user_info.c +++ b/src/server/user_info.c @@ -162,7 +162,7 @@ int can_queue_new_job( num_to_add = count_jobs_submitted(pjob); num_queued = get_num_queued(&users, user_name); - if (num_queued + num_to_add > max_queuable) + if (num_queued + num_to_add > (unsigned int)max_queuable) can_queue_another = FALSE; } From e4b80ac2db258890c05ce6b77b48f68f26405723 Mon Sep 17 00:00:00 2001 From: David Beer Date: Mon, 10 Dec 2012 14:53:43 -0700 Subject: [PATCH 11/20] Add stub to svr_jobfunc's scaffolding. --- src/server/test/svr_jobfunc/scaffolding.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/server/test/svr_jobfunc/scaffolding.c b/src/server/test/svr_jobfunc/scaffolding.c index 9608ee7ed3..b3dc107d38 100644 --- a/src/server/test/svr_jobfunc/scaffolding.c +++ b/src/server/test/svr_jobfunc/scaffolding.c @@ -301,3 +301,12 @@ int decrement_queued_jobs( { return(0); } + +int get_jobs_index( + + struct all_jobs *aj, + job *pjob) + + { + return(0); + } From 1edeecd6662d886c8346dd78fddabf7a583ecd9b Mon Sep 17 00:00:00 2001 From: Daniel Hardman Date: Mon, 10 Dec 2012 14:53:59 -0700 Subject: [PATCH 12/20] start checking return value of getpeername more carefully --- src/resmom/mom_comm.c | 13 +++++++++++-- src/resmom/mom_server.c | 17 ++++++++++++----- 2 files changed, 23 insertions(+), 7 deletions(-) diff --git a/src/resmom/mom_comm.c b/src/resmom/mom_comm.c index f6c1b340ce..9cb111ee1a 100644 --- a/src/resmom/mom_comm.c +++ b/src/resmom/mom_comm.c @@ -1432,7 +1432,11 @@ int check_ms( hnodent *np; unsigned long ipaddr_ms; - getpeername(chan->sock,&s_addr,&len); + if (getpeername(chan->sock,&s_addr,&len) != 0) + { + log_err(errno, __func__, "Calling getpeername() gave error."); + return(TRUE); + } addr = (struct sockaddr_in *)&s_addr; ipaddr_connect = ntohl(addr->sin_addr.s_addr); @@ -4603,7 +4607,12 @@ void im_request( } /* check that machine is known */ - getpeername(chan->sock,&stack_addr,&addr_len); + if (getpeername(chan->sock,&stack_addr,&addr_len) != 0) + { + log_err(errno, __func__, "Calling getpeername() gave error."); + goto im_req_finish; + } + addr = (struct sockaddr_in *)&stack_addr; ipaddr = ntohl(addr->sin_addr.s_addr); diff --git a/src/resmom/mom_server.c b/src/resmom/mom_server.c index e426791766..fcb2bf3edd 100644 --- a/src/resmom/mom_server.c +++ b/src/resmom/mom_server.c @@ -1800,12 +1800,19 @@ void mom_server_update_receive_time( time_now = time(NULL); getpeername(stream,&addr,&len); - ipaddr = ntohl(((struct sockaddr_in *)&addr)->sin_addr.s_addr); - - if ((pms = mom_server_find_by_ip(ipaddr)) != NULL) + if (getpeername(stream,&addr,&len) != 0) { - pms->MOMLastRecvFromServerTime = time_now; - strcpy(pms->MOMLastRecvFromServerCmd, command_name); + log_err(errno, __func__, "Calling getpeername() gave error."); + } + else + { + ipaddr = ntohl(((struct sockaddr_in *)&addr)->sin_addr.s_addr); + + if ((pms = mom_server_find_by_ip(ipaddr)) != NULL) + { + pms->MOMLastRecvFromServerTime = time_now; + strcpy(pms->MOMLastRecvFromServerCmd, command_name); + } } } /* END mom_server_update_receive_time() */ From f18190f668148d1e27c053cbbd4bb85f3640ab61 Mon Sep 17 00:00:00 2001 From: David Beer Date: Mon, 10 Dec 2012 14:58:23 -0700 Subject: [PATCH 13/20] Remove some files that shouldn't be part of the source tree. --- src/include/pbs_config.h | 630 ----------------------------- src/include/site_job_attr_def.h | 111 ----- src/include/site_job_attr_enum.h | 98 ----- src/include/site_qmgr_node_print.h | 91 ----- src/include/site_qmgr_que_print.h | 91 ----- src/include/site_qmgr_svr_print.h | 90 ----- src/include/site_que_attr_def.h | 102 ----- src/include/site_que_attr_enum.h | 92 ----- src/include/site_svr_attr_def.h | 102 ----- src/include/site_svr_attr_enum.h | 92 ----- 10 files changed, 1499 deletions(-) delete mode 100644 src/include/pbs_config.h delete mode 100644 src/include/site_job_attr_def.h delete mode 100644 src/include/site_job_attr_enum.h delete mode 100644 src/include/site_qmgr_node_print.h delete mode 100644 src/include/site_qmgr_que_print.h delete mode 100644 src/include/site_qmgr_svr_print.h delete mode 100644 src/include/site_que_attr_def.h delete mode 100644 src/include/site_que_attr_enum.h delete mode 100644 src/include/site_svr_attr_def.h delete mode 100644 src/include/site_svr_attr_enum.h diff --git a/src/include/pbs_config.h b/src/include/pbs_config.h deleted file mode 100644 index 91e49ba7a5..0000000000 --- a/src/include/pbs_config.h +++ /dev/null @@ -1,630 +0,0 @@ -/* src/include/pbs_config.h. Generated from pbs_config.h.in by configure. */ -/* src/include/pbs_config.h.in. Generated from configure.ac by autoheader. */ - -#ifndef _PBS_CONFIG_H_ -#define _PBS_CONFIG_H_ - -/* Define to add x attributes to accounting log */ -/* #undef ATTR_X_ACCT */ - -/* turns on the compilation of AUTORUN_JOBS code */ -/* #undef AUTORUN_JOBS */ - -/* 1234 = LIL_ENDIAN, 4321 = BIGENDIAN */ -/* #undef BYTEORDER */ - -/* turns on the compilation of DEBUG code */ -/* #undef DEBUG */ - -/* Alternate directory for MOM logs */ -/* #undef DEFAULT_MOMLOGDIR */ - -/* Alternate suffix for MOM logs */ -/* #undef DEFAULT_MOMLOGSUFFIX */ - -/* Define to disable daemons */ -/* #undef DISABLE_DAEMONS */ - -/* Define to enable BLCR support */ -/* #undef ENABLE_BLCR */ - -/* Define to enable Cray's CPA support */ -/* #undef ENABLE_CPA */ - -/* Define to enable Cray's CSA support */ -/* #undef ENABLE_CSA */ - -/* Define to enable unix domain sockets */ -/* #undef ENABLE_UNIX_SOCKETS */ - -/* are FD_SET and friends defined in sys/select.h */ -#define FD_SET_IN_SYS_SELECT_H 1 - -/* Define to the type of elements in the array set by `getgroups'. Usually - this is either `int' or `gid_t'. */ -#define GETGROUPS_T gid_t - -/* Define to 1 if you have the header file. */ -#define HAVE_ARPA_INET_H 1 - -/* Define to 1 if you have the `asprintf' function. */ -/* #undef HAVE_ASPRINTF */ - -/* Define to 1 if you have the `atexit' function. */ -#define HAVE_ATEXIT 1 - -/* Define to 1 if you have the `bindresvport' function. */ -#define HAVE_BINDRESVPORT 1 - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_BITMASK_H */ - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_CPALIB_H */ - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_CPUSET_H */ - -/* Define to 1 if you have the declaration of `strerror_r', and to 0 if you - don't. */ -/* #undef HAVE_DECL_STRERROR_R */ - -/* Define to 1 if you have the header file, and it defines `DIR'. - */ -#define HAVE_DIRENT_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_DLFCN_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_ERR_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_FCNTL_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_FLOAT_H 1 - -/* Define to 1 if you have the `fstat' function. */ -/* #undef HAVE_FSTAT */ - -/* Define to 1 if you have the `getaddrinfo' function. */ -#define HAVE_GETADDRINFO 1 - -/* Define to 1 if you have the `getcwd' function. */ -/* #undef HAVE_GETCWD */ - -/* Define to 1 if your system has a working `getgroups' function. */ -#define HAVE_GETGROUPS 1 - -/* Define to 1 if you have the `gettimeofday' function. */ -#define HAVE_GETTIMEOFDAY 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_INTTYPES_H 1 - -/* Define to 1 if you have the `cpuset' library (-lcpuset). */ -/* #undef HAVE_LIBCPUSET */ - -/* Define to 1 if you have the `crypto' library (-lcrypto). */ -#define HAVE_LIBCRYPTO 1 - -/* Define to 1 if you have the `elf' library (-lelf). */ -/* #undef HAVE_LIBELF */ - -/* Define to 1 if you have the `hwloc' library (-lhwloc). */ -/* #undef HAVE_LIBHWLOC */ - -/* Define to 1 if you have the `kvm' library (-lkvm). */ -/* #undef HAVE_LIBKVM */ - -/* Define to 1 if you have the `memacct' library (-lmemacct). */ -/* #undef HAVE_LIBMEMACCT */ - -/* Define to 1 if you have the `nsl' library (-lnsl). */ -/* #undef HAVE_LIBNSL */ - -/* Define to 1 if you have the `resolv' library (-lresolv). */ -/* #undef HAVE_LIBRESOLV */ - -/* Define to 1 if you have the `socket' library (-lsocket). */ -/* #undef HAVE_LIBSOCKET */ - -/* Define to 1 if you have the `ssl' library (-lssl). */ -#define HAVE_LIBSSL 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_LIMITS_H 1 - -/* Define if lseek64() is available */ -#define HAVE_LSEEK64 1 - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_MACH_SHARED_REGION_H */ - -/* Define to 1 if you have the header file. */ -#define HAVE_MALLOC_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_MEMORY_H 1 - -/* Define to 1 if you have the `mkstemp' function. */ -/* #undef HAVE_MKSTEMP */ - -/* Define to 1 if you have the header file, and it defines `DIR'. */ -/* #undef HAVE_NDIR_H */ - -/* Define to 1 if you have the header file. */ -#define HAVE_NETDB_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_NETINET_IN_H 1 - -/* Define to 1 if you have the `on_exit' function. */ -/* #undef HAVE_ON_EXIT */ - -/* Define if open64() is available */ -#define HAVE_OPEN64 1 - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_PAM_PAM_MODULES_H */ - -/* Define to 1 if you have the `poll' function. */ -#define HAVE_POLL 1 - -/* Define if you have POSIX threads libraries and header files. */ -/* #undef HAVE_PTHREAD */ - -/* include readline support */ -/* #undef HAVE_READLINE */ - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_READLINE_READLINE_H */ - -/* Define to 1 if you have the `rresvport' function. */ -#define HAVE_RRESVPORT 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_SECURITY_PAM_APPL_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_SECURITY_PAM_MODULES_H 1 - -/* Define to 1 if you have the `setegid' function. */ -#define HAVE_SETEGID 1 - -/* Define to 1 if you have the `seteuid' function. */ -#define HAVE_SETEUID 1 - -/* Define to 1 if you have the `setresgid' function. */ -/* #undef HAVE_SETRESGID */ - -/* Define to 1 if you have the `setresuid' function. */ -/* #undef HAVE_SETRESUID */ - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_SOURCE_COIPIPELINE_SOURCE_H */ - -/* Define if stat64() is available */ -#define HAVE_STAT64 1 - -/* Define to 1 if stdbool.h conforms to C99. */ -/* #undef HAVE_STDBOOL_H */ - -/* Define to 1 if you have the header file. */ -#define HAVE_STDDEF_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_STDINT_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_STDLIB_H 1 - -/* Define to 1 if you have the `strchr' function. */ -/* #undef HAVE_STRCHR */ - -/* Define to 1 if you have the `strdup' function. */ -/* #undef HAVE_STRDUP */ - -/* Define to 1 if you have the `strerror' function. */ -/* #undef HAVE_STRERROR */ - -/* Define to 1 if you have the `strerror_r' function. */ -/* #undef HAVE_STRERROR_R */ - -/* Define to 1 if you have the `strftime' function. */ -/* #undef HAVE_STRFTIME */ - -/* Define to 1 if you have the header file. */ -#define HAVE_STRINGS_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_STRING_H 1 - -/* Define to 1 if you have the `strlcpy' function. */ -/* #undef HAVE_STRLCPY */ - -/* Define if struct stat64 is available */ -#define HAVE_STRUCT_STAT64 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_SYSLOG_H 1 - -/* Define to 1 if you have the header file, and it defines `DIR'. - */ -/* #undef HAVE_SYS_DIR_H */ - -/* Define to 1 if you have the header file. */ -#define HAVE_SYS_FILE_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_SYS_IOCTL_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_SYS_MOUNT_H 1 - -/* Define to 1 if you have the header file, and it defines `DIR'. - */ -/* #undef HAVE_SYS_NDIR_H */ - -/* Define to 1 if you have the header file. */ -#define HAVE_SYS_PARAM_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_SYS_POLL_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_SYS_SOCKET_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_SYS_STATFS_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_SYS_STATVFS_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_SYS_STAT_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_SYS_TIME_H 1 - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_SYS_TTY_H */ - -/* Define to 1 if you have the header file. */ -#define HAVE_SYS_TYPES_H 1 - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_SYS_UCRED_H */ - -/* Define to 1 if you have the header file. */ -#define HAVE_SYS_UIO_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_SYS_UN_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_SYS_VFS_H 1 - -/* Define to 1 if you have that is POSIX.1 compatible. */ -#define HAVE_SYS_WAIT_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_TERMIOS_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_UNISTD_H 1 - -/* Define to 1 if you have the `vasprintf' function. */ -/* #undef HAVE_VASPRINTF */ - -/* Define to 1 if you have the va_copy function. */ -/* #undef HAVE_VA_COPY */ - -/* Define to 1 if you have the `wordexp' function. */ -#define HAVE_WORDEXP 1 - -/* Define to 1 if the system has the type `_Bool'. */ -/* #undef HAVE__BOOL */ - -/* Define to 1 if you have the __va_copy function. */ -/* #undef HAVE___VA_COPY */ - -/* is the global int h_errno declared in netdb.h */ -/* #undef H_ERRNO_DECLARED */ - -/* defined if this is an SP2 */ -#define IBM_SP2 0 - -/* Define if open64, stat64, and friends work */ -#define LARGEFILE_WORKS 1 - -/* Define to the sub-directory in which libtool stores uninstalled libraries. - */ -#define LT_OBJDIR ".libs/" - -/* the machine specific resc_def_* file name */ -#define MACH_RESC_DEFS "resc_def_linux.c" - -/* Define to enable MIC support */ -/* #undef MIC */ - -/* Define to error if spool is full on MOM */ -#define MOMCHECKLOCALSPOOL 1 - -/* whether checkpointing is supported */ -#define MOM_CHECKPOINT 0 - -/* force creation of nodefile */ -#define MOM_FORCENODEFILE 0 - -#ifndef NEED_BLOCKING_CONNECTIONS -#define write(a,b,c) write_nonblocking_socket(a,b,c) -#define read(a,b,c) read_nonblocking_socket(a,b,c) -#endif - -/* use nodemask-based scheduling on O2k */ -/* #undef NODEMASK */ - -/* Define to disable mlockall */ -/* #undef NOPOSIXMEMLOCK */ - -/* Define to disable privileged ports */ -/* #undef NOPRIVPORTS */ - -/* directly use homedirs instead of $TORQUEHOME/spool */ -#define NO_SPOOL_OUTPUT 0 - -/* Define if ntohl() is declared in arpa/inet.h */ -/* #undef NTOHL_NEEDS_ARPA_INET_H */ - -/* Define to enable Nvidia gpu support */ -/* #undef NVIDIA_GPUS */ - -/* Define to enable Nvidia NVML api support */ -/* #undef NVML_API */ - -/* Name of package */ -#define PACKAGE "torque" - -/* Define to the address where bug reports for this package should be sent. */ -#define PACKAGE_BUGREPORT "torqueusers@supercluster.org" - -/* Define to the full name of this package. */ -#define PACKAGE_NAME "torque" - -/* Define to the full name and version of this package. */ -#define PACKAGE_STRING "torque 4.2.0" - -/* Define to the one symbol short name of this package. */ -#define PACKAGE_TARNAME "torque" - -/* Define to the home page for this package. */ -#define PACKAGE_URL "" - -/* Define to the version of this package. */ -#define PACKAGE_VERSION "4.2.0" - -/* Define to the build date */ -#define PBS_BUILD_DATE "Sat Dec 8 06:46:21 MST 2012" - -/* Define to the build directory */ -#define PBS_BUILD_DIR "/sdb/dev/torque/actorque/torque.new" - -/* Define to the build hostname */ -#define PBS_BUILD_HOST "kmn" - -/* Define to the building username */ -#define PBS_BUILD_USER "knielson" - -/* Define to the install directory */ -#define PBS_CFLAGS "-g -W -Wall -Wno-unused-parameter -Wno-long-long -pedantic -Werror -D_LARGEFILE64_SOURCE -I/opt/intel/mic/coi/include" - -/* Define to the install directory */ -#define PBS_CONFIG_ARGS " '--with-debug' '--enable-gcc-warnings' '--with-server-home=/sdb/torque'" - -/* Define to the name of the default PBS server */ -#define PBS_DEFAULT_SERVER "kmn" - -/* Define to the install directory */ -#define PBS_INSTALL_DIR "/usr/local" - -/* the PBS style machine type name */ -#define PBS_MACH "linux" - -/* Define to the source directory */ -#define PBS_SOURCE_DIR "/sdb/dev/torque/actorque/torque.new" - -/* Define to enable Linux 2.6 cpusets */ -/* #undef PENABLE_LINUX26_CPUSETS */ - -/* use pemask-based scheduling on Cray T3e */ -/* #undef PE_MASK */ - -/* Select which daemons plock themselves, a bit pattern */ -#define PLOCK_DAEMONS 0 - -/* Define to necessary symbol if this constant uses a non-standard name on - your system. */ -/* #undef PTHREAD_CREATE_JOINABLE */ - -/* Define if you are on a solaris box */ -/* #undef PUSH_STREAM */ - -/* Define to the path of the qstat init file */ -#define QSTATRC_PATH "/sdb/torque/qstatrc" - -/* turns on the QSUB_KEEP_NO_OVERRIDE flag */ -/* #undef QSUB_KEEP_NO_OVERRIDE */ - -/* turns on the compilation of QUICKCOMMIT code */ -/* #undef QUICKCOMMIT */ - -/* turns on the compilation of RESOURCEMAXDEFAULT code */ -/* #undef RESOURCEMAXDEFAULT */ - -/* set the type of scheduler to use */ -#define SCHD_TYPE "cc" - -/* full pathname of sendmail */ -#define SENDMAIL_CMD "sendmail" - -/* Directory for Server checkpoint files */ -/* #undef SERVER_CHKPTDIR */ - -/* Define to set the controlling tty */ -/* #undef SETCONTROLLINGTTY */ - -/* set whether job scripts use a pipe */ -#define SHELL_INVOKE 1 - -/* job script name passed as the shell's arg */ -#define SHELL_USE_ARGV 0 - -/* The size of `double', as computed by sizeof. */ -#define SIZEOF_DOUBLE 8 - -/* The size of `float', as computed by sizeof. */ -#define SIZEOF_FLOAT 4 - -/* The size of `int', as computed by sizeof. */ -#define SIZEOF_INT 4 - -/* The size of `long', as computed by sizeof. */ -#define SIZEOF_LONG 8 - -/* The size of `long double', as computed by sizeof. */ -#define SIZEOF_LONG_DOUBLE 16 - -/* The size of `short', as computed by sizeof. */ -#define SIZEOF_SHORT 2 - -/* The size of `signed char', as computed by sizeof. */ -#define SIZEOF_SIGNED_CHAR 1 - -/* The size of `unsigned', as computed by sizeof. */ -#define SIZEOF_UNSIGNED 4 - -/* The size of `unsigned char', as computed by sizeof. */ -#define SIZEOF_UNSIGNED_CHAR 1 - -/* The size of `unsigned int', as computed by sizeof. */ -#define SIZEOF_UNSIGNED_INT 4 - -/* The size of `unsigned long', as computed by sizeof. */ -#define SIZEOF_UNSIGNED_LONG 8 - -/* The size of `unsigned short', as computed by sizeof. */ -#define SIZEOF_UNSIGNED_SHORT 2 - -/* include support for SRFS on Cray */ -#define SRFS 0 - -/* Define to 1 if you have the ANSI C header files. */ -#define STDC_HEADERS 1 - -/* Define to 1 if strerror_r returns char *. */ -/* #undef STRERROR_R_CHAR_P */ - -/* repository svn version */ -#define SVN_VERSION "unknown" - -/* Define to enable syslog */ -#define SYSLOG 1 - -/* Define if PBS should use Tcl in its tools */ -#define TCL 0 - -/* Define if PBS should use TclX in its tools */ -#define TCLX 0 - -/* the seperator for Tcl attribute parsing */ -#define TCL_ATRSEP "." - -/* Define if PBS should build qstat with Tcl */ -/* #undef TCL_QSTAT */ - -/* Define to set a max retry limit */ -#define TCP_RETRY_LIMIT 0 - -/* Define to prevent sync writes */ -#define TDISABLEFILESYNC 1 - -/* Define if PBS should use Tk in its tools */ -#define TK 0 - -/* Define if PBS should use Tkx in its tools */ -#define TKX 0 - -/* override the default domain for outgoing mail messages */ -/* #undef TMAILDOMAIN */ - -/* The pathname of the Cray temporary directory for mom */ -#define TMP_DIR "/tmp" - -/* Define if building on unsupported OS */ -/* #undef UNSUPPORTED_MACH */ - -/* Define to enable libjob job_create support */ -/* #undef USEJOBCREATE */ - -/* Define to enable libcpuset support */ -/* #undef USELIBCPUSET */ - -/* Define to enable libmemacct support */ -/* #undef USELIBMEMACCT */ - -/* Define on ancient linux distros */ -/* #undef USEOLDTTY */ - -/* Version number of package */ -#define VERSION "4.2.0" - -/* whether byteorder is bigendian */ -/* #undef WORDS_BIGENDIAN */ - -/* Define to the path of xauth */ -#define XAUTH_PATH "/usr/bin/xauth" - -/* Define to 1 if `lex' declares `yytext' as a `char *' by default, not a - `char[]'. */ -#define YYTEXT_POINTER 1 - -/* Define _GNU_SOURCE for portability */ -#define _GNU_SOURCE 1 - -/* Define to 1 if type `char' is unsigned and you are not using gcc. */ -#ifndef __CHAR_UNSIGNED__ -/* # undef __CHAR_UNSIGNED__ */ -#endif - -/* Define to `int' if doesn't define. */ -/* #undef gid_t */ - -/* type to use for 2nd arg of pam_get_user */ -#define pam_get_user_2nd_arg_t const char - -/* Define to `unsigned int' if does not define. */ -/* #undef size_t */ - -/* type to use in place of socklen_t if not defined */ -#define torque_socklen_t socklen_t - -/* Define to `int' if doesn't define. */ -/* #undef uid_t */ - - -#ifndef HAVE_VA_COPY -# define va_copy(a,b) __va_copy(a,b) -#endif - - - -#ifndef __GNUC__ -# define __attribute__ /* nothing */ -#endif - - - -#endif /* _PBS_CONFIG_H_ */ - diff --git a/src/include/site_job_attr_def.h b/src/include/site_job_attr_def.h deleted file mode 100644 index 4d7fa262b1..0000000000 --- a/src/include/site_job_attr_def.h +++ /dev/null @@ -1,111 +0,0 @@ -/* -* OpenPBS (Portable Batch System) v2.3 Software License -* -* Copyright (c) 1999-2000 Veridian Information Solutions, Inc. -* All rights reserved. -* -* --------------------------------------------------------------------------- -* For a license to use or redistribute the OpenPBS software under conditions -* other than those described below, or to purchase support for this software, -* please contact Veridian Systems, PBS Products Department ("Licensor") at: -* -* www.OpenPBS.org +1 650 967-4675 sales@OpenPBS.org -* 877 902-4PBS (US toll-free) -* --------------------------------------------------------------------------- -* -* This license covers use of the OpenPBS v2.3 software (the "Software") at -* your site or location, and, for certain users, redistribution of the -* Software to other sites and locations. Use and redistribution of -* OpenPBS v2.3 in source and binary forms, with or without modification, -* are permitted provided that all of the following conditions are met. -* After December 31, 2001, only conditions 3-6 must be met: -* -* 1. Commercial and/or non-commercial use of the Software is permitted -* provided a current software registration is on file at www.OpenPBS.org. -* If use of this software contributes to a publication, product, or -* service, proper attribution must be given; see www.OpenPBS.org/credit.html -* -* 2. Redistribution in any form is only permitted for non-commercial, -* non-profit purposes. There can be no charge for the Software or any -* software incorporating the Software. Further, there can be no -* expectation of revenue generated as a consequence of redistributing -* the Software. -* -* 3. Any Redistribution of source code must retain the above copyright notice -* and the acknowledgment contained in paragraph 6, this list of conditions -* and the disclaimer contained in paragraph 7. -* -* 4. Any Redistribution in binary form must reproduce the above copyright -* notice and the acknowledgment contained in paragraph 6, this list of -* conditions and the disclaimer contained in paragraph 7 in the -* documentation and/or other materials provided with the distribution. -* -* 5. Redistributions in any form must be accompanied by information on how to -* obtain complete source code for the OpenPBS software and any -* modifications and/or additions to the OpenPBS software. The source code -* must either be included in the distribution or be available for no more -* than the cost of distribution plus a nominal fee, and all modifications -* and additions to the Software must be freely redistributable by any party -* (including Licensor) without restriction. -* -* 6. All advertising materials mentioning features or use of the Software must -* display the following acknowledgment: -* -* "This product includes software developed by NASA Ames Research Center, -* Lawrence Livermore National Laboratory, and Veridian Information -* Solutions, Inc. -* Visit www.OpenPBS.org for OpenPBS software support, -* products, and information." -* -* 7. DISCLAIMER OF WARRANTY -* -* THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. ANY EXPRESS -* OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES -* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT -* ARE EXPRESSLY DISCLAIMED. -* -* IN NO EVENT SHALL VERIDIAN CORPORATION, ITS AFFILIATED COMPANIES, OR THE -* U.S. GOVERNMENT OR ANY OF ITS AGENCIES BE LIABLE FOR ANY DIRECT OR INDIRECT, -* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, -* OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, -* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -* -* This license will be governed by the laws of the Commonwealth of Virginia, -* without reference to its choice of law rules. -*/ - -/* - * Place holder for site supplied additions to the array of - * site job attribute definitions, see server/job_attr_def.c - * - * Array elements must be of the form: - * { "name", - * decode_Func, - * encode_Func, - * set_Func, - * comp_Func, - * free_Func, - * action_routine, - * permissions, - * ATR_TYPE_*, - * PARENT_TYPE_JOB - * }, - * - * Matching entry must be added in site_job_attr_enum.h - */ - -{ "x", - decode_str, - encode_str, - set_str, - comp_str, - free_str, - NULL_FUNC, - READ_WRITE, - ATR_TYPE_STR, - PARENT_TYPE_JOB - }, - diff --git a/src/include/site_job_attr_enum.h b/src/include/site_job_attr_enum.h deleted file mode 100644 index 151a3f4246..0000000000 --- a/src/include/site_job_attr_enum.h +++ /dev/null @@ -1,98 +0,0 @@ -#ifndef _SITE_JOB_ATTR_ENUM_HT -#define _SITE_JOB_ATTR_ENUM_HT -/* -* OpenPBS (Portable Batch System) v2.3 Software License -* -* Copyright (c) 1999-2000 Veridian Information Solutions, Inc. -* All rights reserved. -* -* --------------------------------------------------------------------------- -* For a license to use or redistribute the OpenPBS software under conditions -* other than those described below, or to purchase support for this software, -* please contact Veridian Systems, PBS Products Department ("Licensor") at: -* -* www.OpenPBS.org +1 650 967-4675 sales@OpenPBS.org -* 877 902-4PBS (US toll-free) -* --------------------------------------------------------------------------- -* -* This license covers use of the OpenPBS v2.3 software (the "Software") at -* your site or location, and, for certain users, redistribution of the -* Software to other sites and locations. Use and redistribution of -* OpenPBS v2.3 in source and binary forms, with or without modification, -* are permitted provided that all of the following conditions are met. -* After December 31, 2001, only conditions 3-6 must be met: -* -* 1. Commercial and/or non-commercial use of the Software is permitted -* provided a current software registration is on file at www.OpenPBS.org. -* If use of this software contributes to a publication, product, or -* service, proper attribution must be given; see www.OpenPBS.org/credit.html -* -* 2. Redistribution in any form is only permitted for non-commercial, -* non-profit purposes. There can be no charge for the Software or any -* software incorporating the Software. Further, there can be no -* expectation of revenue generated as a consequence of redistributing -* the Software. -* -* 3. Any Redistribution of source code must retain the above copyright notice -* and the acknowledgment contained in paragraph 6, this list of conditions -* and the disclaimer contained in paragraph 7. -* -* 4. Any Redistribution in binary form must reproduce the above copyright -* notice and the acknowledgment contained in paragraph 6, this list of -* conditions and the disclaimer contained in paragraph 7 in the -* documentation and/or other materials provided with the distribution. -* -* 5. Redistributions in any form must be accompanied by information on how to -* obtain complete source code for the OpenPBS software and any -* modifications and/or additions to the OpenPBS software. The source code -* must either be included in the distribution or be available for no more -* than the cost of distribution plus a nominal fee, and all modifications -* and additions to the Software must be freely redistributable by any party -* (including Licensor) without restriction. -* -* 6. All advertising materials mentioning features or use of the Software must -* display the following acknowledgment: -* -* "This product includes software developed by NASA Ames Research Center, -* Lawrence Livermore National Laboratory, and Veridian Information -* Solutions, Inc. -* Visit www.OpenPBS.org for OpenPBS software support, -* products, and information." -* -* 7. DISCLAIMER OF WARRANTY -* -* THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. ANY EXPRESS -* OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES -* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT -* ARE EXPRESSLY DISCLAIMED. -* -* IN NO EVENT SHALL VERIDIAN CORPORATION, ITS AFFILIATED COMPANIES, OR THE -* U.S. GOVERNMENT OR ANY OF ITS AGENCIES BE LIABLE FOR ANY DIRECT OR INDIRECT, -* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, -* OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, -* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -* -* This license will be governed by the laws of the Commonwealth of Virginia, -* without reference to its choice of law rules. -*/ - -/* - * @(#) $Id$ - */ - -/* - * Place holder for site supplied additions to the job's enumerated - * list of attributes, see pbs_job.h. - * - * List should be of the form: - * JOB_SITE_ATR_name, - * - * Matching entry must be added in site_job_attr_def.h - */ - -JOB_SITE_ATR_x, - -#endif /* _SITE_JOB_ATTR_ENUM_HT */ diff --git a/src/include/site_qmgr_node_print.h b/src/include/site_qmgr_node_print.h deleted file mode 100644 index 9d2544c03c..0000000000 --- a/src/include/site_qmgr_node_print.h +++ /dev/null @@ -1,91 +0,0 @@ -/* -* OpenPBS (Portable Batch System) v2.3 Software License -* -* Copyright (c) 1999-2000 Veridian Information Solutions, Inc. -* All rights reserved. -* -* --------------------------------------------------------------------------- -* For a license to use or redistribute the OpenPBS software under conditions -* other than those described below, or to purchase support for this software, -* please contact Veridian Systems, PBS Products Department ("Licensor") at: -* -* www.OpenPBS.org +1 650 967-4675 sales@OpenPBS.org -* 877 902-4PBS (US toll-free) -* --------------------------------------------------------------------------- -* -* This license covers use of the OpenPBS v2.3 software (the "Software") at -* your site or location, and, for certain users, redistribution of the -* Software to other sites and locations. Use and redistribution of -* OpenPBS v2.3 in source and binary forms, with or without modification, -* are permitted provided that all of the following conditions are met. -* After December 31, 2001, only conditions 3-6 must be met: -* -* 1. Commercial and/or non-commercial use of the Software is permitted -* provided a current software registration is on file at www.OpenPBS.org. -* If use of this software contributes to a publication, product, or -* service, proper attribution must be given; see www.OpenPBS.org/credit.html -* -* 2. Redistribution in any form is only permitted for non-commercial, -* non-profit purposes. There can be no charge for the Software or any -* software incorporating the Software. Further, there can be no -* expectation of revenue generated as a consequence of redistributing -* the Software. -* -* 3. Any Redistribution of source code must retain the above copyright notice -* and the acknowledgment contained in paragraph 6, this list of conditions -* and the disclaimer contained in paragraph 7. -* -* 4. Any Redistribution in binary form must reproduce the above copyright -* notice and the acknowledgment contained in paragraph 6, this list of -* conditions and the disclaimer contained in paragraph 7 in the -* documentation and/or other materials provided with the distribution. -* -* 5. Redistributions in any form must be accompanied by information on how to -* obtain complete source code for the OpenPBS software and any -* modifications and/or additions to the OpenPBS software. The source code -* must either be included in the distribution or be available for no more -* than the cost of distribution plus a nominal fee, and all modifications -* and additions to the Software must be freely redistributable by any party -* (including Licensor) without restriction. -* -* 6. All advertising materials mentioning features or use of the Software must -* display the following acknowledgment: -* -* "This product includes software developed by NASA Ames Research Center, -* Lawrence Livermore National Laboratory, and Veridian Information -* Solutions, Inc. -* Visit www.OpenPBS.org for OpenPBS software support, -* products, and information." -* -* 7. DISCLAIMER OF WARRANTY -* -* THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. ANY EXPRESS -* OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES -* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT -* ARE EXPRESSLY DISCLAIMED. -* -* IN NO EVENT SHALL VERIDIAN CORPORATION, ITS AFFILIATED COMPANIES, OR THE -* U.S. GOVERNMENT OR ANY OF ITS AGENCIES BE LIABLE FOR ANY DIRECT OR INDIRECT, -* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, -* OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, -* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -* -* This license will be governed by the laws of the Commonwealth of Virginia, -* without reference to its choice of law rules. -*/ - -/* - * @(#) $Id$ - */ - -/* - * list of site defined queue attribute names which qmgr should - * include in its "print node" output - * - * format is (do include the quote marks): - * "attribute_name", - */ - diff --git a/src/include/site_qmgr_que_print.h b/src/include/site_qmgr_que_print.h deleted file mode 100644 index 0dc8e2c0e5..0000000000 --- a/src/include/site_qmgr_que_print.h +++ /dev/null @@ -1,91 +0,0 @@ -/* -* OpenPBS (Portable Batch System) v2.3 Software License -* -* Copyright (c) 1999-2000 Veridian Information Solutions, Inc. -* All rights reserved. -* -* --------------------------------------------------------------------------- -* For a license to use or redistribute the OpenPBS software under conditions -* other than those described below, or to purchase support for this software, -* please contact Veridian Systems, PBS Products Department ("Licensor") at: -* -* www.OpenPBS.org +1 650 967-4675 sales@OpenPBS.org -* 877 902-4PBS (US toll-free) -* --------------------------------------------------------------------------- -* -* This license covers use of the OpenPBS v2.3 software (the "Software") at -* your site or location, and, for certain users, redistribution of the -* Software to other sites and locations. Use and redistribution of -* OpenPBS v2.3 in source and binary forms, with or without modification, -* are permitted provided that all of the following conditions are met. -* After December 31, 2001, only conditions 3-6 must be met: -* -* 1. Commercial and/or non-commercial use of the Software is permitted -* provided a current software registration is on file at www.OpenPBS.org. -* If use of this software contributes to a publication, product, or -* service, proper attribution must be given; see www.OpenPBS.org/credit.html -* -* 2. Redistribution in any form is only permitted for non-commercial, -* non-profit purposes. There can be no charge for the Software or any -* software incorporating the Software. Further, there can be no -* expectation of revenue generated as a consequence of redistributing -* the Software. -* -* 3. Any Redistribution of source code must retain the above copyright notice -* and the acknowledgment contained in paragraph 6, this list of conditions -* and the disclaimer contained in paragraph 7. -* -* 4. Any Redistribution in binary form must reproduce the above copyright -* notice and the acknowledgment contained in paragraph 6, this list of -* conditions and the disclaimer contained in paragraph 7 in the -* documentation and/or other materials provided with the distribution. -* -* 5. Redistributions in any form must be accompanied by information on how to -* obtain complete source code for the OpenPBS software and any -* modifications and/or additions to the OpenPBS software. The source code -* must either be included in the distribution or be available for no more -* than the cost of distribution plus a nominal fee, and all modifications -* and additions to the Software must be freely redistributable by any party -* (including Licensor) without restriction. -* -* 6. All advertising materials mentioning features or use of the Software must -* display the following acknowledgment: -* -* "This product includes software developed by NASA Ames Research Center, -* Lawrence Livermore National Laboratory, and Veridian Information -* Solutions, Inc. -* Visit www.OpenPBS.org for OpenPBS software support, -* products, and information." -* -* 7. DISCLAIMER OF WARRANTY -* -* THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. ANY EXPRESS -* OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES -* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT -* ARE EXPRESSLY DISCLAIMED. -* -* IN NO EVENT SHALL VERIDIAN CORPORATION, ITS AFFILIATED COMPANIES, OR THE -* U.S. GOVERNMENT OR ANY OF ITS AGENCIES BE LIABLE FOR ANY DIRECT OR INDIRECT, -* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, -* OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, -* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -* -* This license will be governed by the laws of the Commonwealth of Virginia, -* without reference to its choice of law rules. -*/ - -/* - * @(#) $Id$ - */ - -/* - * list of site defined queue attribute names which qmgr should - * include in its "print queue" output - * - * format is (do include the quote marks): - * "attribute_name", - */ - diff --git a/src/include/site_qmgr_svr_print.h b/src/include/site_qmgr_svr_print.h deleted file mode 100644 index 8d0e16d176..0000000000 --- a/src/include/site_qmgr_svr_print.h +++ /dev/null @@ -1,90 +0,0 @@ -/* -* OpenPBS (Portable Batch System) v2.3 Software License -* -* Copyright (c) 1999-2000 Veridian Information Solutions, Inc. -* All rights reserved. -* -* --------------------------------------------------------------------------- -* For a license to use or redistribute the OpenPBS software under conditions -* other than those described below, or to purchase support for this software, -* please contact Veridian Systems, PBS Products Department ("Licensor") at: -* -* www.OpenPBS.org +1 650 967-4675 sales@OpenPBS.org -* 877 902-4PBS (US toll-free) -* --------------------------------------------------------------------------- -* -* This license covers use of the OpenPBS v2.3 software (the "Software") at -* your site or location, and, for certain users, redistribution of the -* Software to other sites and locations. Use and redistribution of -* OpenPBS v2.3 in source and binary forms, with or without modification, -* are permitted provided that all of the following conditions are met. -* After December 31, 2001, only conditions 3-6 must be met: -* -* 1. Commercial and/or non-commercial use of the Software is permitted -* provided a current software registration is on file at www.OpenPBS.org. -* If use of this software contributes to a publication, product, or -* service, proper attribution must be given; see www.OpenPBS.org/credit.html -* -* 2. Redistribution in any form is only permitted for non-commercial, -* non-profit purposes. There can be no charge for the Software or any -* software incorporating the Software. Further, there can be no -* expectation of revenue generated as a consequence of redistributing -* the Software. -* -* 3. Any Redistribution of source code must retain the above copyright notice -* and the acknowledgment contained in paragraph 6, this list of conditions -* and the disclaimer contained in paragraph 7. -* -* 4. Any Redistribution in binary form must reproduce the above copyright -* notice and the acknowledgment contained in paragraph 6, this list of -* conditions and the disclaimer contained in paragraph 7 in the -* documentation and/or other materials provided with the distribution. -* -* 5. Redistributions in any form must be accompanied by information on how to -* obtain complete source code for the OpenPBS software and any -* modifications and/or additions to the OpenPBS software. The source code -* must either be included in the distribution or be available for no more -* than the cost of distribution plus a nominal fee, and all modifications -* and additions to the Software must be freely redistributable by any party -* (including Licensor) without restriction. -* -* 6. All advertising materials mentioning features or use of the Software must -* display the following acknowledgment: -* -* "This product includes software developed by NASA Ames Research Center, -* Lawrence Livermore National Laboratory, and Veridian Information -* Solutions, Inc. -* Visit www.OpenPBS.org for OpenPBS software support, -* products, and information." -* -* 7. DISCLAIMER OF WARRANTY -* -* THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. ANY EXPRESS -* OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES -* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT -* ARE EXPRESSLY DISCLAIMED. -* -* IN NO EVENT SHALL VERIDIAN CORPORATION, ITS AFFILIATED COMPANIES, OR THE -* U.S. GOVERNMENT OR ANY OF ITS AGENCIES BE LIABLE FOR ANY DIRECT OR INDIRECT, -* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, -* OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, -* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -* -* This license will be governed by the laws of the Commonwealth of Virginia, -* without reference to its choice of law rules. -*/ - -/* - * @(#) $Id$ - */ - -/* - * list of site defined server attribute names which qmgr should - * include in its "print server" output - * - * format is (do include the quote marks): - * "attribute_name", - */ diff --git a/src/include/site_que_attr_def.h b/src/include/site_que_attr_def.h deleted file mode 100644 index 3e134f4f60..0000000000 --- a/src/include/site_que_attr_def.h +++ /dev/null @@ -1,102 +0,0 @@ -/* -* OpenPBS (Portable Batch System) v2.3 Software License -* -* Copyright (c) 1999-2000 Veridian Information Solutions, Inc. -* All rights reserved. -* -* --------------------------------------------------------------------------- -* For a license to use or redistribute the OpenPBS software under conditions -* other than those described below, or to purchase support for this software, -* please contact Veridian Systems, PBS Products Department ("Licensor") at: -* -* www.OpenPBS.org +1 650 967-4675 sales@OpenPBS.org -* 877 902-4PBS (US toll-free) -* --------------------------------------------------------------------------- -* -* This license covers use of the OpenPBS v2.3 software (the "Software") at -* your site or location, and, for certain users, redistribution of the -* Software to other sites and locations. Use and redistribution of -* OpenPBS v2.3 in source and binary forms, with or without modification, -* are permitted provided that all of the following conditions are met. -* After December 31, 2001, only conditions 3-6 must be met: -* -* 1. Commercial and/or non-commercial use of the Software is permitted -* provided a current software registration is on file at www.OpenPBS.org. -* If use of this software contributes to a publication, product, or -* service, proper attribution must be given; see www.OpenPBS.org/credit.html -* -* 2. Redistribution in any form is only permitted for non-commercial, -* non-profit purposes. There can be no charge for the Software or any -* software incorporating the Software. Further, there can be no -* expectation of revenue generated as a consequence of redistributing -* the Software. -* -* 3. Any Redistribution of source code must retain the above copyright notice -* and the acknowledgment contained in paragraph 6, this list of conditions -* and the disclaimer contained in paragraph 7. -* -* 4. Any Redistribution in binary form must reproduce the above copyright -* notice and the acknowledgment contained in paragraph 6, this list of -* conditions and the disclaimer contained in paragraph 7 in the -* documentation and/or other materials provided with the distribution. -* -* 5. Redistributions in any form must be accompanied by information on how to -* obtain complete source code for the OpenPBS software and any -* modifications and/or additions to the OpenPBS software. The source code -* must either be included in the distribution or be available for no more -* than the cost of distribution plus a nominal fee, and all modifications -* and additions to the Software must be freely redistributable by any party -* (including Licensor) without restriction. -* -* 6. All advertising materials mentioning features or use of the Software must -* display the following acknowledgment: -* -* "This product includes software developed by NASA Ames Research Center, -* Lawrence Livermore National Laboratory, and Veridian Information -* Solutions, Inc. -* Visit www.OpenPBS.org for OpenPBS software support, -* products, and information." -* -* 7. DISCLAIMER OF WARRANTY -* -* THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. ANY EXPRESS -* OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES -* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT -* ARE EXPRESSLY DISCLAIMED. -* -* IN NO EVENT SHALL VERIDIAN CORPORATION, ITS AFFILIATED COMPANIES, OR THE -* U.S. GOVERNMENT OR ANY OF ITS AGENCIES BE LIABLE FOR ANY DIRECT OR INDIRECT, -* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, -* OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, -* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -* -* This license will be governed by the laws of the Commonwealth of Virginia, -* without reference to its choice of law rules. -*/ - -/* - * @(#) $Id$ - */ - -/* - * Place holder for site supplied additions to the array of - * site queue attribute definitions, see server/queue_attr_def.c - * - * Array elements must be of the form: - * { "name", - * decode_Func, - * encode_Func, - * set_Func, - * comp_Func, - * free_Func, - * action_routine, - * permissions, - * ATR_TYPE_*, - * PARENT_TYPE_QUE_[ALL|EXC|RTE] - * }, - * - * Matching entry must be added in site_que_attr_enum.h - */ diff --git a/src/include/site_que_attr_enum.h b/src/include/site_que_attr_enum.h deleted file mode 100644 index 7d76242d00..0000000000 --- a/src/include/site_que_attr_enum.h +++ /dev/null @@ -1,92 +0,0 @@ -/* -* OpenPBS (Portable Batch System) v2.3 Software License -* -* Copyright (c) 1999-2000 Veridian Information Solutions, Inc. -* All rights reserved. -* -* --------------------------------------------------------------------------- -* For a license to use or redistribute the OpenPBS software under conditions -* other than those described below, or to purchase support for this software, -* please contact Veridian Systems, PBS Products Department ("Licensor") at: -* -* www.OpenPBS.org +1 650 967-4675 sales@OpenPBS.org -* 877 902-4PBS (US toll-free) -* --------------------------------------------------------------------------- -* -* This license covers use of the OpenPBS v2.3 software (the "Software") at -* your site or location, and, for certain users, redistribution of the -* Software to other sites and locations. Use and redistribution of -* OpenPBS v2.3 in source and binary forms, with or without modification, -* are permitted provided that all of the following conditions are met. -* After December 31, 2001, only conditions 3-6 must be met: -* -* 1. Commercial and/or non-commercial use of the Software is permitted -* provided a current software registration is on file at www.OpenPBS.org. -* If use of this software contributes to a publication, product, or -* service, proper attribution must be given; see www.OpenPBS.org/credit.html -* -* 2. Redistribution in any form is only permitted for non-commercial, -* non-profit purposes. There can be no charge for the Software or any -* software incorporating the Software. Further, there can be no -* expectation of revenue generated as a consequence of redistributing -* the Software. -* -* 3. Any Redistribution of source code must retain the above copyright notice -* and the acknowledgment contained in paragraph 6, this list of conditions -* and the disclaimer contained in paragraph 7. -* -* 4. Any Redistribution in binary form must reproduce the above copyright -* notice and the acknowledgment contained in paragraph 6, this list of -* conditions and the disclaimer contained in paragraph 7 in the -* documentation and/or other materials provided with the distribution. -* -* 5. Redistributions in any form must be accompanied by information on how to -* obtain complete source code for the OpenPBS software and any -* modifications and/or additions to the OpenPBS software. The source code -* must either be included in the distribution or be available for no more -* than the cost of distribution plus a nominal fee, and all modifications -* and additions to the Software must be freely redistributable by any party -* (including Licensor) without restriction. -* -* 6. All advertising materials mentioning features or use of the Software must -* display the following acknowledgment: -* -* "This product includes software developed by NASA Ames Research Center, -* Lawrence Livermore National Laboratory, and Veridian Information -* Solutions, Inc. -* Visit www.OpenPBS.org for OpenPBS software support, -* products, and information." -* -* 7. DISCLAIMER OF WARRANTY -* -* THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. ANY EXPRESS -* OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES -* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT -* ARE EXPRESSLY DISCLAIMED. -* -* IN NO EVENT SHALL VERIDIAN CORPORATION, ITS AFFILIATED COMPANIES, OR THE -* U.S. GOVERNMENT OR ANY OF ITS AGENCIES BE LIABLE FOR ANY DIRECT OR INDIRECT, -* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, -* OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, -* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -* -* This license will be governed by the laws of the Commonwealth of Virginia, -* without reference to its choice of law rules. -*/ - -/* - * @(#) $Id$ - */ - -/* - * Place holder for site supplied additions to the queue's enumerated - * list of attributes, see queue.h. - * - * List should be of the form: - * Q_SITE_ATR_name, - * - * Matching entry must be added in site_que_attr_def.h - */ diff --git a/src/include/site_svr_attr_def.h b/src/include/site_svr_attr_def.h deleted file mode 100644 index f51b6c467d..0000000000 --- a/src/include/site_svr_attr_def.h +++ /dev/null @@ -1,102 +0,0 @@ -/* -* OpenPBS (Portable Batch System) v2.3 Software License -* -* Copyright (c) 1999-2000 Veridian Information Solutions, Inc. -* All rights reserved. -* -* --------------------------------------------------------------------------- -* For a license to use or redistribute the OpenPBS software under conditions -* other than those described below, or to purchase support for this software, -* please contact Veridian Systems, PBS Products Department ("Licensor") at: -* -* www.OpenPBS.org +1 650 967-4675 sales@OpenPBS.org -* 877 902-4PBS (US toll-free) -* --------------------------------------------------------------------------- -* -* This license covers use of the OpenPBS v2.3 software (the "Software") at -* your site or location, and, for certain users, redistribution of the -* Software to other sites and locations. Use and redistribution of -* OpenPBS v2.3 in source and binary forms, with or without modification, -* are permitted provided that all of the following conditions are met. -* After December 31, 2001, only conditions 3-6 must be met: -* -* 1. Commercial and/or non-commercial use of the Software is permitted -* provided a current software registration is on file at www.OpenPBS.org. -* If use of this software contributes to a publication, product, or -* service, proper attribution must be given; see www.OpenPBS.org/credit.html -* -* 2. Redistribution in any form is only permitted for non-commercial, -* non-profit purposes. There can be no charge for the Software or any -* software incorporating the Software. Further, there can be no -* expectation of revenue generated as a consequence of redistributing -* the Software. -* -* 3. Any Redistribution of source code must retain the above copyright notice -* and the acknowledgment contained in paragraph 6, this list of conditions -* and the disclaimer contained in paragraph 7. -* -* 4. Any Redistribution in binary form must reproduce the above copyright -* notice and the acknowledgment contained in paragraph 6, this list of -* conditions and the disclaimer contained in paragraph 7 in the -* documentation and/or other materials provided with the distribution. -* -* 5. Redistributions in any form must be accompanied by information on how to -* obtain complete source code for the OpenPBS software and any -* modifications and/or additions to the OpenPBS software. The source code -* must either be included in the distribution or be available for no more -* than the cost of distribution plus a nominal fee, and all modifications -* and additions to the Software must be freely redistributable by any party -* (including Licensor) without restriction. -* -* 6. All advertising materials mentioning features or use of the Software must -* display the following acknowledgment: -* -* "This product includes software developed by NASA Ames Research Center, -* Lawrence Livermore National Laboratory, and Veridian Information -* Solutions, Inc. -* Visit www.OpenPBS.org for OpenPBS software support, -* products, and information." -* -* 7. DISCLAIMER OF WARRANTY -* -* THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. ANY EXPRESS -* OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES -* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT -* ARE EXPRESSLY DISCLAIMED. -* -* IN NO EVENT SHALL VERIDIAN CORPORATION, ITS AFFILIATED COMPANIES, OR THE -* U.S. GOVERNMENT OR ANY OF ITS AGENCIES BE LIABLE FOR ANY DIRECT OR INDIRECT, -* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, -* OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, -* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -* -* This license will be governed by the laws of the Commonwealth of Virginia, -* without reference to its choice of law rules. -*/ - -/* - * @(#) $Id$ - */ - -/* - * Place holder for site supplied additions to the array of site - * server attribute definitions, see server/svr_attr_def.c - * - * Array elements must be of the form: - * { "name", - * decode_Func, - * encode_Func, - * set_Func, - * comp_Func, - * free_Func, - * action_routine, - * permissions, - * ATR_TYPE_*, - * PARENT_TYPE_SERVER - * }, - * - * Matching entry must be added in site_sv_attr_enum.h - */ diff --git a/src/include/site_svr_attr_enum.h b/src/include/site_svr_attr_enum.h deleted file mode 100644 index 5a263d4a20..0000000000 --- a/src/include/site_svr_attr_enum.h +++ /dev/null @@ -1,92 +0,0 @@ -/* -* OpenPBS (Portable Batch System) v2.3 Software License -* -* Copyright (c) 1999-2000 Veridian Information Solutions, Inc. -* All rights reserved. -* -* --------------------------------------------------------------------------- -* For a license to use or redistribute the OpenPBS software under conditions -* other than those described below, or to purchase support for this software, -* please contact Veridian Systems, PBS Products Department ("Licensor") at: -* -* www.OpenPBS.org +1 650 967-4675 sales@OpenPBS.org -* 877 902-4PBS (US toll-free) -* --------------------------------------------------------------------------- -* -* This license covers use of the OpenPBS v2.3 software (the "Software") at -* your site or location, and, for certain users, redistribution of the -* Software to other sites and locations. Use and redistribution of -* OpenPBS v2.3 in source and binary forms, with or without modification, -* are permitted provided that all of the following conditions are met. -* After December 31, 2001, only conditions 3-6 must be met: -* -* 1. Commercial and/or non-commercial use of the Software is permitted -* provided a current software registration is on file at www.OpenPBS.org. -* If use of this software contributes to a publication, product, or -* service, proper attribution must be given; see www.OpenPBS.org/credit.html -* -* 2. Redistribution in any form is only permitted for non-commercial, -* non-profit purposes. There can be no charge for the Software or any -* software incorporating the Software. Further, there can be no -* expectation of revenue generated as a consequence of redistributing -* the Software. -* -* 3. Any Redistribution of source code must retain the above copyright notice -* and the acknowledgment contained in paragraph 6, this list of conditions -* and the disclaimer contained in paragraph 7. -* -* 4. Any Redistribution in binary form must reproduce the above copyright -* notice and the acknowledgment contained in paragraph 6, this list of -* conditions and the disclaimer contained in paragraph 7 in the -* documentation and/or other materials provided with the distribution. -* -* 5. Redistributions in any form must be accompanied by information on how to -* obtain complete source code for the OpenPBS software and any -* modifications and/or additions to the OpenPBS software. The source code -* must either be included in the distribution or be available for no more -* than the cost of distribution plus a nominal fee, and all modifications -* and additions to the Software must be freely redistributable by any party -* (including Licensor) without restriction. -* -* 6. All advertising materials mentioning features or use of the Software must -* display the following acknowledgment: -* -* "This product includes software developed by NASA Ames Research Center, -* Lawrence Livermore National Laboratory, and Veridian Information -* Solutions, Inc. -* Visit www.OpenPBS.org for OpenPBS software support, -* products, and information." -* -* 7. DISCLAIMER OF WARRANTY -* -* THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. ANY EXPRESS -* OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES -* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT -* ARE EXPRESSLY DISCLAIMED. -* -* IN NO EVENT SHALL VERIDIAN CORPORATION, ITS AFFILIATED COMPANIES, OR THE -* U.S. GOVERNMENT OR ANY OF ITS AGENCIES BE LIABLE FOR ANY DIRECT OR INDIRECT, -* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, -* OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, -* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -* -* This license will be governed by the laws of the Commonwealth of Virginia, -* without reference to its choice of law rules. -*/ - -/* - * @(#) $Id$ - */ - -/* - * Place holder for site supplied additions to the server's enumerated - * list of attributes, see server.h. - * - * List should be of the form: - * SVR_SITE_ATR_name, - * - * Matching entry must be added in site_sv_attr_def.h - */ From ed065a8ac1b256ea2c01b35275f94ebb3d3c9d4b Mon Sep 17 00:00:00 2001 From: Daniel Hardman Date: Mon, 10 Dec 2012 15:26:50 -0700 Subject: [PATCH 14/20] fix unchecked return value from diswst --- src/resmom/mom_comm.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/resmom/mom_comm.c b/src/resmom/mom_comm.c index 9cb111ee1a..1a5eb76085 100644 --- a/src/resmom/mom_comm.c +++ b/src/resmom/mom_comm.c @@ -4198,8 +4198,10 @@ int handle_im_get_resc_response( tm_reply(ptask->ti_chan, TM_OKAY, event); diswst(ptask->ti_chan, info); - - DIS_tcp_wflush(ptask->ti_chan); + if ((ret = diswst(ptask->ti_chan, info)) == DIS_SUCCESS) + { + DIS_tcp_wflush(ptask->ti_chan); + } } free(info); From 4dbb7a2e7a12556bfa9d21a5142153909795f717 Mon Sep 17 00:00:00 2001 From: Daniel Hardman Date: Mon, 10 Dec 2012 15:45:54 -0700 Subject: [PATCH 15/20] use return values from chmod and chown better --- src/resmom/checkpoint.c | 2 +- src/resmom/start_exec.c | 12 ++++++++++-- src/server/pbsd_init.c | 5 ++++- 3 files changed, 15 insertions(+), 4 deletions(-) diff --git a/src/resmom/checkpoint.c b/src/resmom/checkpoint.c index f1c6c5edb3..240b42d812 100644 --- a/src/resmom/checkpoint.c +++ b/src/resmom/checkpoint.c @@ -258,7 +258,7 @@ int mom_checkpoint_init(void) if ((stat(path_checkpoint, &sb) == 0) && ((sb.st_mode & 01777) != 01777)) { - chmod(path_checkpoint, 01777); + (void)chmod(path_checkpoint, 01777); } } diff --git a/src/resmom/start_exec.c b/src/resmom/start_exec.c index 1f469adedf..762440340a 100644 --- a/src/resmom/start_exec.c +++ b/src/resmom/start_exec.c @@ -3286,10 +3286,14 @@ void setup_interactive_job( shutdown(*qsub_sock_ptr, 2); /* change pty back to available after job is done */ - chmod((char *)TJE->ptc_name, 0666); + if (chmod((char *)TJE->ptc_name, 0666) != 0) + { + log_err(errno, __func__, "can't chmod 0666 to change pty back to available"); + } if (chown(TJE->ptc_name, 0, 0) == -1) { + log_err(errno, __func__, "can't chown pty"); } exit(0); @@ -3301,10 +3305,14 @@ void setup_interactive_job( log_err(errno, __func__, (char *)"cannot fork nanny"); /* change pty back to available */ - chmod(TJE->ptc_name, 0666); + if (chmod(TJE->ptc_name, 0666) != 0) + { + log_err(errno, __func__, "can't chmod 0666 to change pty back to available"); + } if (chown(TJE->ptc_name, 0, 0) == -1) { + log_err(errno, __func__, "can't chown ptc"); } starter_return(TJE->upfds, TJE->downfds, JOB_EXEC_RETRY, sjr); diff --git a/src/server/pbsd_init.c b/src/server/pbsd_init.c index 229351c8e0..28a3e0714d 100644 --- a/src/server/pbsd_init.c +++ b/src/server/pbsd_init.c @@ -1181,7 +1181,10 @@ int initialize_paths() if ((statbuf.st_mode && 01777) != 01777) { - chmod(path_checkpoint, 01777); + if (chmod(path_checkpoint, 01777) != 0) + { + log_err(errno, __func__, "can't chmod 01777 checkpoint"); + } } #endif From 543dad342705290d74a87fefc9a11f490f4bea87 Mon Sep 17 00:00:00 2001 From: Daniel Hardman Date: Mon, 10 Dec 2012 15:50:13 -0700 Subject: [PATCH 16/20] use return value from getpeername better --- src/resmom/mom_server.c | 1 - 1 file changed, 1 deletion(-) diff --git a/src/resmom/mom_server.c b/src/resmom/mom_server.c index fcb2bf3edd..dc18565515 100644 --- a/src/resmom/mom_server.c +++ b/src/resmom/mom_server.c @@ -1799,7 +1799,6 @@ void mom_server_update_receive_time( time_now = time(NULL); - getpeername(stream,&addr,&len); if (getpeername(stream,&addr,&len) != 0) { log_err(errno, __func__, "Calling getpeername() gave error."); From 97b85b79700bbdd3be6a3cd5ab99b7853fff30b5 Mon Sep 17 00:00:00 2001 From: Daniel Hardman Date: Mon, 10 Dec 2012 15:55:19 -0700 Subject: [PATCH 17/20] use return value of getaddrinfo more intelligently --- src/server/pbsd_init.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/src/server/pbsd_init.c b/src/server/pbsd_init.c index 28a3e0714d..66e2448abd 100644 --- a/src/server/pbsd_init.c +++ b/src/server/pbsd_init.c @@ -561,13 +561,20 @@ void check_if_in_nodes_file( if ((sai = get_cached_addrinfo(hostname)) == NULL) { - getaddrinfo(hostname, NULL, NULL, &addr_info); - sai = (struct sockaddr_in *)addr_info->ai_addr; - ipaddr = ntohl(sai->sin_addr.s_addr); + if (getaddrinfo(hostname, NULL, NULL, &addr_info) == 0) + { + sai = (struct sockaddr_in *)addr_info->ai_addr; + ipaddr = ntohl(sai->sin_addr.s_addr); - insert_addr_name_info(hostname, addr_info->ai_canonname, sai); + insert_addr_name_info(hostname, addr_info->ai_canonname, sai); - freeaddrinfo(addr_info); + freeaddrinfo(addr_info); + } + else + { + log_err(errno, __func__, "getaddrinfo failed"); + return; + } } else ipaddr = ntohl(sai->sin_addr.s_addr); From 6d4adc8728ce72a8fc60f85d6ed3c24fe9902c4a Mon Sep 17 00:00:00 2001 From: David Beer Date: Mon, 10 Dec 2012 17:19:59 -0700 Subject: [PATCH 18/20] Add the files generated by running the unit test framework to .gitignore. --- .gitignore | 340 ++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 339 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index da3c7f0dfa..2f73b3c6f3 100644 --- a/.gitignore +++ b/.gitignore @@ -101,4 +101,342 @@ src/tools/printtracking src/tools/tracejob tags torque.spec - +src/cmds/test/MXML/test_MXML +src/cmds/test/common_cmds/test_common_cmds +src/cmds/test/pbs_track/test_pbs_track +src/cmds/test/pbsdsh/test_pbsdsh +src/cmds/test/pbsnodes/test_pbsnodes +src/cmds/test/pbspd/test_pbspd +src/cmds/test/pbspoe/test_pbspoe +src/cmds/test/qalter/test_qalter +src/cmds/test/qchkpt/test_qchkpt +src/cmds/test/qdel/test_qdel +src/cmds/test/qdisable/test_qdisable +src/cmds/test/qenable/test_qenable +src/cmds/test/qgpumode/test_qgpumode +src/cmds/test/qgpureset/test_qgpureset +src/cmds/test/qhold/test_qhold +src/cmds/test/qmgr/test_qmgr +src/cmds/test/qmove/test_qmove +src/cmds/test/qmsg/test_qmsg +src/cmds/test/qorder/test_qorder +src/cmds/test/qrerun/test_qrerun +src/cmds/test/qrls/test_qrls +src/cmds/test/qrun/test_qrun +src/cmds/test/qselect/test_qselect +src/cmds/test/qsig/test_qsig +src/cmds/test/qstart/test_qstart +src/cmds/test/qstat/test_qstat +src/cmds/test/qstop/test_qstop +src/cmds/test/qsub_functions/build_test_files.sh +src/cmds/test/qsub_functions/test_x11_get_proto +src/cmds/test/qterm/test_qterm +src/daemon_client/test/trq_auth_daemon/test_trq_auth_daemon +src/lib/Libattr/test/attr_atomic/test_attr_atomic +src/lib/Libattr/test/attr_fn_acl/test_attr_fn_acl +src/lib/Libattr/test/attr_fn_arst/test_attr_fn_arst +src/lib/Libattr/test/attr_fn_b/test_attr_fn_b +src/lib/Libattr/test/attr_fn_c/test_attr_fn_c +src/lib/Libattr/test/attr_fn_hold/test_attr_fn_hold +src/lib/Libattr/test/attr_fn_intr/test_attr_fn_intr +src/lib/Libattr/test/attr_fn_l/test_attr_fn_l +src/lib/Libattr/test/attr_fn_ll/test_attr_fn_ll +src/lib/Libattr/test/attr_fn_resc/test_attr_fn_resc +src/lib/Libattr/test/attr_fn_size/test_attr_fn_size +src/lib/Libattr/test/attr_fn_str/test_attr_fn_str +src/lib/Libattr/test/attr_fn_time/test_attr_fn_time +src/lib/Libattr/test/attr_fn_tokens/test_attr_fn_tokens +src/lib/Libattr/test/attr_fn_tv/test_attr_fn_tv +src/lib/Libattr/test/attr_fn_unkn/test_attr_fn_unkn +src/lib/Libattr/test/attr_func/test_attr_func +src/lib/Libattr/test/attr_node_func/test_attr_node_func +src/lib/Libcmds/test/add_verify_resources/test_add_verify_resources +src/lib/Libcmds/test/ck_job_name/test_ck_job_name +src/lib/Libcmds/test/cnt2server/test_cnt2server +src/lib/Libcmds/test/cvtdate/test_cvtdate +src/lib/Libcmds/test/get_server/test_get_server +src/lib/Libcmds/test/locate_job/test_locate_job +src/lib/Libcmds/test/parse_at/test_parse_at +src/lib/Libcmds/test/parse_depend/test_parse_depend +src/lib/Libcmds/test/parse_destid/test_parse_destid +src/lib/Libcmds/test/parse_equal/test_parse_equal +src/lib/Libcmds/test/parse_jobid/test_parse_jobid +src/lib/Libcmds/test/parse_stage/test_parse_stage +src/lib/Libcmds/test/prepare_path/test_prepare_path +src/lib/Libcmds/test/prt_job_err/test_prt_job_err +src/lib/Libcmds/test/set_attr/test_set_attr +src/lib/Libcmds/test/set_resource/test_set_resource +src/lib/Libcsv/test/csv/test_csv +src/lib/Libdis/test/discui_/test_discui_ +src/lib/Libdis/test/discul_/test_discul_ +src/lib/Libdis/test/disi10d_/test_disi10d_ +src/lib/Libdis/test/disi10l_/test_disi10l_ +src/lib/Libdis/test/disiui_/test_disiui_ +src/lib/Libdis/test/disp10d_/test_disp10d_ +src/lib/Libdis/test/disp10l_/test_disp10l_ +src/lib/Libdis/test/disrcs/test_disrcs +src/lib/Libdis/test/disrd/test_disrd +src/lib/Libdis/test/disrf/test_disrf +src/lib/Libdis/test/disrfcs/test_disrfcs +src/lib/Libdis/test/disrfst/test_disrfst +src/lib/Libdis/test/disrl/test_disrl +src/lib/Libdis/test/disrl_/test_disrl_ +src/lib/Libdis/test/disrsc/test_disrsc +src/lib/Libdis/test/disrsi/test_disrsi +src/lib/Libdis/test/disrsi_/test_disrsi_ +src/lib/Libdis/test/disrsl/test_disrsl +src/lib/Libdis/test/disrsl_/test_disrsl_ +src/lib/Libdis/test/disrss/test_disrss +src/lib/Libdis/test/disrst/test_disrst +src/lib/Libdis/test/disruc/test_disruc +src/lib/Libdis/test/disrui/test_disrui +src/lib/Libdis/test/disrul/test_disrul +src/lib/Libdis/test/disrus/test_disrus +src/lib/Libdis/test/diswcs/test_diswcs +src/lib/Libdis/test/diswf/test_diswf +src/lib/Libdis/test/diswl_/test_diswl_ +src/lib/Libdis/test/diswsi/test_diswsi +src/lib/Libdis/test/diswsl/test_diswsl +src/lib/Libdis/test/diswui/test_diswui +src/lib/Libdis/test/diswui_/test_diswui_ +src/lib/Libdis/test/diswul/test_diswul +src/lib/Libifl/test/PBSD_gpuctrl2/test_PBSD_gpuctrl2 +src/lib/Libifl/test/PBSD_manage2/test_PBSD_manage2 +src/lib/Libifl/test/PBSD_manager_caps/test_PBSD_manager_caps +src/lib/Libifl/test/PBSD_msg2/test_PBSD_msg2 +src/lib/Libifl/test/PBSD_rdrpy/test_PBSD_rdrpy +src/lib/Libifl/test/PBSD_sig2/test_PBSD_sig2 +src/lib/Libifl/test/PBSD_status/test_PBSD_status +src/lib/Libifl/test/PBSD_status2/test_PBSD_status2 +src/lib/Libifl/test/PBSD_submit_caps/test_PBSD_submit_caps +src/lib/Libifl/test/PBS_attr/test_PBS_attr +src/lib/Libifl/test/dec_Authen/test_dec_Authen +src/lib/Libifl/test/dec_CpyFil/test_dec_CpyFil +src/lib/Libifl/test/dec_Gpu/test_dec_Gpu +src/lib/Libifl/test/dec_JobCred/test_dec_JobCred +src/lib/Libifl/test/dec_JobFile/test_dec_JobFile +src/lib/Libifl/test/dec_JobId/test_dec_JobId +src/lib/Libifl/test/dec_JobObit/test_dec_JobObit +src/lib/Libifl/test/dec_Manage/test_dec_Manage +src/lib/Libifl/test/dec_MoveJob/test_dec_MoveJob +src/lib/Libifl/test/dec_MsgJob/test_dec_MsgJob +src/lib/Libifl/test/dec_QueueJob/test_dec_QueueJob +src/lib/Libifl/test/dec_Reg/test_dec_Reg +src/lib/Libifl/test/dec_ReqExt/test_dec_ReqExt +src/lib/Libifl/test/dec_ReqHdr/test_dec_ReqHdr +src/lib/Libifl/test/dec_Resc/test_dec_Resc +src/lib/Libifl/test/dec_ReturnFile/test_dec_ReturnFile +src/lib/Libifl/test/dec_RunJob/test_dec_RunJob +src/lib/Libifl/test/dec_Shut/test_dec_Shut +src/lib/Libifl/test/dec_Sig/test_dec_Sig +src/lib/Libifl/test/dec_Status/test_dec_Status +src/lib/Libifl/test/dec_Track/test_dec_Track +src/lib/Libifl/test/dec_attrl/test_dec_attrl +src/lib/Libifl/test/dec_attropl/test_dec_attropl +src/lib/Libifl/test/dec_rpyc/test_dec_rpyc +src/lib/Libifl/test/dec_rpys/test_dec_rpys +src/lib/Libifl/test/dec_svrattrl/test_dec_svrattrl +src/lib/Libifl/test/enc_CpyFil/test_enc_CpyFil +src/lib/Libifl/test/enc_Gpu/test_enc_Gpu +src/lib/Libifl/test/enc_JobCred/test_enc_JobCred +src/lib/Libifl/test/enc_JobFile/test_enc_JobFile +src/lib/Libifl/test/enc_JobId/test_enc_JobId +src/lib/Libifl/test/enc_JobObit/test_enc_JobObit +src/lib/Libifl/test/enc_Manage/test_enc_Manage +src/lib/Libifl/test/enc_MoveJob/test_enc_MoveJob +src/lib/Libifl/test/enc_MsgJob/test_enc_MsgJob +src/lib/Libifl/test/enc_QueueJob/test_enc_QueueJob +src/lib/Libifl/test/enc_QueueJob_hash/test_enc_QueueJob_hash +src/lib/Libifl/test/enc_Reg/test_enc_Reg +src/lib/Libifl/test/enc_ReqExt/test_enc_ReqExt +src/lib/Libifl/test/enc_ReqHdr/test_enc_ReqHdr +src/lib/Libifl/test/enc_ReturnFile/test_enc_ReturnFile +src/lib/Libifl/test/enc_RunJob/test_enc_RunJob +src/lib/Libifl/test/enc_Shut/test_enc_Shut +src/lib/Libifl/test/enc_Sig/test_enc_Sig +src/lib/Libifl/test/enc_Status/test_enc_Status +src/lib/Libifl/test/enc_Track/test_enc_Track +src/lib/Libifl/test/enc_attrl/test_enc_attrl +src/lib/Libifl/test/enc_attropl/test_enc_attropl +src/lib/Libifl/test/enc_attropl_hash/test_enc_attropl_hash +src/lib/Libifl/test/enc_reply/test_enc_reply +src/lib/Libifl/test/enc_svrattrl/test_enc_svrattrl +src/lib/Libifl/test/get_svrport/test_get_svrport +src/lib/Libifl/test/list_link/test_list_link +src/lib/Libifl/test/nonblock/test_nonblock +src/lib/Libifl/test/pbsD_alterjo/test_pbsD_alterjo +src/lib/Libifl/test/pbsD_asyrun/test_pbsD_asyrun +src/lib/Libifl/test/pbsD_chkptjob/test_pbsD_chkptjob +src/lib/Libifl/test/pbsD_connect/test_pbsD_connect +src/lib/Libifl/test/pbsD_deljob/test_pbsD_deljob +src/lib/Libifl/test/pbsD_gpuctrl/test_pbsD_gpuctrl +src/lib/Libifl/test/pbsD_holdjob/test_pbsD_holdjob +src/lib/Libifl/test/pbsD_locjob/test_pbsD_locjob +src/lib/Libifl/test/pbsD_manager/test_pbsD_manager +src/lib/Libifl/test/pbsD_movejob/test_pbsD_movejob +src/lib/Libifl/test/pbsD_msgjob/test_pbsD_msgjob +src/lib/Libifl/test/pbsD_orderjo/test_pbsD_orderjo +src/lib/Libifl/test/pbsD_rerunjo/test_pbsD_rerunjo +src/lib/Libifl/test/pbsD_resc/test_pbsD_resc +src/lib/Libifl/test/pbsD_rlsjob/test_pbsD_rlsjob +src/lib/Libifl/test/pbsD_runjob/test_pbsD_runjob +src/lib/Libifl/test/pbsD_selectj/test_pbsD_selectj +src/lib/Libifl/test/pbsD_sigjob/test_pbsD_sigjob +src/lib/Libifl/test/pbsD_stagein/test_pbsD_stagein +src/lib/Libifl/test/pbsD_statjob/test_pbsD_statjob +src/lib/Libifl/test/pbsD_statnode/test_pbsD_statnode +src/lib/Libifl/test/pbsD_statque/test_pbsD_statque +src/lib/Libifl/test/pbsD_statsrv/test_pbsD_statsrv +src/lib/Libifl/test/pbsD_submit/test_pbsD_submit +src/lib/Libifl/test/pbsD_submit_hash/test_pbsD_submit_hash +src/lib/Libifl/test/pbsD_termin/test_pbsD_termin +src/lib/Libifl/test/pbs_geterrmg/test_pbs_geterrmg +src/lib/Libifl/test/pbs_statfree/test_pbs_statfree +src/lib/Libifl/test/tcp_dis/test_tcp_dis +src/lib/Libifl/test/tm/test_tm +src/lib/Libifl/test/torquecfg/test_torquecfg +src/lib/Libifl/test/trq_auth/test_trq_auth +src/lib/Liblog/test/chk_file_sec/test_chk_file_sec +src/lib/Liblog/test/log_event/test_log_event +src/lib/Liblog/test/pbs_log/test_pbs_log +src/lib/Liblog/test/pbs_messages/test_pbs_messages +src/lib/Liblog/test/setup_env/test_setup_env +src/lib/Libnet/test/conn_table/test_conn_table +src/lib/Libnet/test/get_hostaddr/test_get_hostaddr +src/lib/Libnet/test/get_hostname/test_get_hostname +src/lib/Libnet/test/md5/test_md5 +src/lib/Libnet/test/net_client/test_net_client +src/lib/Libnet/test/net_common/test_net_common +src/lib/Libnet/test/net_server/test_net_server +src/lib/Libnet/test/net_set_clse/test_net_set_clse +src/lib/Libnet/test/port_forwarding/test_port_forwarding +src/lib/Libnet/test/rm/test_rm +src/lib/Libnet/test/server_core/test_server_core +src/lib/Libsite/test/site_allow_u/test_site_allow_u +src/lib/Libsite/test/site_alt_rte/test_site_alt_rte +src/lib/Libsite/test/site_check_u/test_site_check_u +src/lib/Libsite/test/site_map_usr/test_site_map_usr +src/lib/Libsite/test/site_mom_chu/test_site_mom_chu +src/lib/Libsite/test/site_mom_ckp/test_site_mom_ckp +src/lib/Libsite/test/site_mom_jst/test_site_mom_jst +src/lib/Libutils/test/u_MXML/test_u_MXML +src/lib/Libutils/test/u_dynamic_string/test_u_dynamic_string +src/lib/Libutils/test/u_groups/test_u_groups +src/lib/Libutils/test/u_hash_map_structs/ct_u_hash_map_structs +src/lib/Libutils/test/u_hash_table/test_u_hash_table +src/lib/Libutils/test/u_lock_ctl/test_u_lock_ctl +src/lib/Libutils/test/u_memmgr/test_u_memmgr +src/lib/Libutils/test/u_mom_hierarchy/test_u_mom_hierarchy +src/lib/Libutils/test/u_mu/test_u_mu +src/lib/Libutils/test/u_resizable_array/test_u_resizable_array +src/lib/Libutils/test/u_threadpool/test_u_threadpool +src/lib/Libutils/test/u_tree/test_u_tree +src/lib/Libutils/test/u_users/test_u_users +src/lib/Libutils/test/u_xml/test_u_xml +src/momctl/test/momctl/test_momctl +src/resmom/linux/test/mom_mach/test_mom_mach +src/resmom/linux/test/mom_start/test_mom_start +src/resmom/linux/test/pe_input/test_pe_input +src/resmom/test/alps_reservations/test_alps_reservations +src/resmom/test/catch_child/1.sysname.ac.JB +src/resmom/test/catch_child/2.sysname.ac.JB +src/resmom/test/catch_child/3.sysname.ac.JB +src/resmom/test/catch_child/build_test_files.sh +src/resmom/test/catch_child/test_catch_child +src/resmom/test/catch_child/test_exit_mom_job +src/resmom/test/catch_child/test_get_node +src/resmom/test/catch_child/test_init_abort_jobs +src/resmom/test/catch_child/test_mom_deljob +src/resmom/test/catch_child/test_obit_reply +src/resmom/test/catch_child/test_post_epilogue +src/resmom/test/catch_child/test_preobit_reply +src/resmom/test/catch_child/test_scan_for_exiting +src/resmom/test/checkpoint/test_checkpoint +src/resmom/test/generate_alps_status/test_generate_alps_status +src/resmom/test/mom_comm/test_mom_comm +src/resmom/test/mom_inter/test_mom_inter +src/resmom/test/mom_job_func/test_mom_job_func +src/resmom/test/mom_main/test_mom_main +src/resmom/test/mom_process_request/test_mom_process_request +src/resmom/test/mom_req_quejob/test_mom_req_quejob +src/resmom/test/mom_server/test_mom_server +src/resmom/test/pbs_demux/test_pbs_demux +src/resmom/test/prolog/test_prolog +src/resmom/test/release_reservation/test_release_reservation +src/resmom/test/requests/test_requests +src/resmom/test/start_exec/test_start_exec +src/resmom/test/tmsock_recov/test_tmsock_recov +src/server/test/accounting/test_accounting +src/server/test/array_func/test_array_func +src/server/test/array_upgrade/test_array_upgrade +src/server/test/attr_recov/test_attr_recov +src/server/test/batch_request/test_batch_request +src/server/test/dis_read/test_dis_read +src/server/test/display_alps_status/test_display_alps_status +src/server/test/exiting_jobs/test_exiting_jobs +src/server/test/geteusernam/test_geteusernam +src/server/test/issue_request/test_issue_request +src/server/test/job_container/test_job_container +src/server/test/job_func/test_job_func +src/server/test/job_func/test_record_jobinfo +src/server/test/job_qs_upgrade/test_job_qs_upgrade +src/server/test/job_recov/test_job_recov +src/server/test/job_recycler/test_job_recycler +src/server/test/job_route/test_job_route +src/server/test/login_nodes/test_login_nodes +src/server/test/node_func/test_node_func +src/server/test/node_manager/test_node_manager +src/server/test/pbsd_init/test_pbsd_init +src/server/test/pbsd_main/test_pbsd_main +src/server/test/process_alps_status/test_process_alps_status +src/server/test/process_mom_update/test_process_mom_update +src/server/test/process_request/test_process_request +src/server/test/queue_func/test_queue_func +src/server/test/queue_recov/test_queue_recov +src/server/test/receive_mom_communication/test_receive_mom_communication +src/server/test/reply_send/test_reply_send +src/server/test/req_delete/test_req_delete +src/server/test/req_deletearray/test_req_deletearray +src/server/test/req_getcred/test_req_getcred +src/server/test/req_gpuctrl/test_req_gpuctrl +src/server/test/req_holdarray/test_req_holdarray +src/server/test/req_holdjob/test_req_holdjob +src/server/test/req_jobobit/test_req_jobobit +src/server/test/req_locate/test_req_locate +src/server/test/req_manager/test_req_manager +src/server/test/req_message/test_req_message +src/server/test/req_modify/test_req_modify +src/server/test/req_movejob/test_req_movejob +src/server/test/req_quejob/test_req_quejob +src/server/test/req_register/test_req_register +src/server/test/req_rerun/test_req_rerun +src/server/test/req_rescq/test_req_rescq +src/server/test/req_runjob/test_req_runjob +src/server/test/req_select/test_req_select +src/server/test/req_shutdown/test_req_shutdown +src/server/test/req_signal/test_req_signal +src/server/test/req_stat/test_req_stat +src/server/test/req_tokens/test_req_tokens +src/server/test/req_track/test_req_track +src/server/test/resc_def_all/test_resc_def_all +src/server/test/run_sched/test_run_sched +src/server/test/stat_job/test_stat_job +src/server/test/svr_chk_owner/test_svr_chk_owner +src/server/test/svr_connect/test_svr_connect +src/server/test/svr_format_job/test_svr_format_job +src/server/test/svr_func/test_svr_func +src/server/test/svr_jobfunc/test_svr_jobfunc +src/server/test/svr_mail/test_svr_mail +src/server/test/svr_movejob/test_svr_movejob +src/server/test/svr_recov/test_svr_recov +src/server/test/svr_resccost/test_svr_resccost +src/server/test/svr_task/test_svr_task +src/server/test/track_alps_reservations/test_track_alps_reservations +src/server/test/user_info/test_user_info +src/tools/test/chk_tree/test_chk_tree +src/tools/test/hostn/test_hostn +src/tools/test/pbsTclInit/test_pbsTclInit +src/tools/test/printjob/test_printjob +src/tools/test/printserverdb/test_printserverdb +src/tools/test/printtracking/test_printtracking +src/tools/test/tracejob/test_tracejob From 0e55dbc2080b0c2dfca671a52ae15a0d15b9ba47 Mon Sep 17 00:00:00 2001 From: Ken Nielson Date: Mon, 10 Dec 2012 17:20:14 -0700 Subject: [PATCH 19/20] modified function signatures to use const char * for the log function calls. --- src/include/log.h | 8 ++++---- src/lib/Liblog/pbs_log.c | 6 +++--- src/lib/Liblog/setup_env.c | 2 +- src/lib/Liblog/setup_env.h | 2 +- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/include/log.h b/src/include/log.h index c1868eecda..871b9c4b29 100644 --- a/src/include/log.h +++ b/src/include/log.h @@ -161,12 +161,12 @@ extern int chk_file_sec_stderr; /* extern void log_close (int); */ /* extern void job_log_close (int); */ -void log_err (int, const char *, char *); -void log_ext (int, const char *,char *,int); -void log_event (int, int, const char *, char *); +void log_err (int, const char *, const char *); +void log_ext (int, const char *, const char *,int); +void log_event (int, int, const char *, const char *); /* extern int log_open (char *, char *); */ /* extern int job_log_open (char *, char *); */ -void log_record (int, int, const char *, char *); +void log_record (int, int, const char *, const char *); /* extern void log_roll (int); */ /* extern long log_size (void); */ /* extern long job_log_size (void); */ diff --git a/src/lib/Liblog/pbs_log.c b/src/lib/Liblog/pbs_log.c index 5c9213efb8..99cbc7c5a7 100644 --- a/src/lib/Liblog/pbs_log.c +++ b/src/lib/Liblog/pbs_log.c @@ -497,7 +497,7 @@ void log_err( int errnum, /* I (errno or PBSErrno) */ const char *routine, /* I */ - char *text) /* I */ + const char *text) /* I */ { log_ext(errnum,routine,text,LOG_ERR); @@ -525,7 +525,7 @@ void log_ext( int errnum, /* I (errno or PBSErrno) */ const char *routine, /* I */ - char *text, /* I */ + const char *text, /* I */ int severity) /* I */ { @@ -756,7 +756,7 @@ void log_record( int eventtype, /* I */ int objclass, /* I */ const char *objname, /* I */ - char *text) /* I */ + const char *text) /* I */ { int tryagain = 2; diff --git a/src/lib/Liblog/setup_env.c b/src/lib/Liblog/setup_env.c index ba1ab7fd07..fd6884637f 100644 --- a/src/lib/Liblog/setup_env.c +++ b/src/lib/Liblog/setup_env.c @@ -106,7 +106,7 @@ extern char **environ; int setup_env( - char *filen) + const char *filen) { char buf[256]; diff --git a/src/lib/Liblog/setup_env.h b/src/lib/Liblog/setup_env.h index 414df0367f..da4e970df5 100644 --- a/src/lib/Liblog/setup_env.h +++ b/src/lib/Liblog/setup_env.h @@ -1,4 +1,4 @@ #include "license_pbs.h" /* See here for the software license */ -int setup_env(char *filen); +int setup_env(const char *filen); From 758c0036ee0bf8a8e15132fc5faa8077c919fb50 Mon Sep 17 00:00:00 2001 From: Ken Nielson Date: Mon, 10 Dec 2012 17:50:02 -0700 Subject: [PATCH 20/20] fixed type cast problem --- src/lib/Liblog/pbs_log.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib/Liblog/pbs_log.c b/src/lib/Liblog/pbs_log.c index 99cbc7c5a7..e737d87919 100644 --- a/src/lib/Liblog/pbs_log.c +++ b/src/lib/Liblog/pbs_log.c @@ -811,7 +811,7 @@ void log_record( * Looking for the newline characters and splitting the output message * on them. Sequence "\r\n" is mapped to the single newline. */ - start = text; + start = (char *)text; while (1) {