diff --git a/acinclude.m4 b/acinclude.m4 index 4d65675b5b..b00267fd06 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -184,7 +184,7 @@ AC_CHECK_MEMBER(struct stat64.st_mode, #include ]) AC_MSG_CHECKING([if largefile compiles (looking at you, OSX)]) -AC_COMPILE_IFELSE([ +AC_COMPILE_IFELSE([AC_LANG_SOURCE([ #include #include #include @@ -197,7 +197,7 @@ int main(void) { ],[ AC_MSG_RESULT([yes]) AC_DEFINE([LARGEFILE_WORKS],1,[Define if open64, stat64, and friends work]) - ],[AC_MSG_RESULT([no])]) + ],[AC_MSG_RESULT([no])])]) ]) diff --git a/doc/soelim.c b/doc/soelim.c index 4baf7cba2e..6fa15d229c 100644 --- a/doc/soelim.c +++ b/doc/soelim.c @@ -146,8 +146,7 @@ main(int argc, char *argv[]) return (0); } -int dofile(filein) -FILE *filein; +int dofile(FILE *filein) { char buf[256]; int dirindex; diff --git a/src/cmds/MXML.c b/src/cmds/MXML.c index cf79670898..e591db24c5 100644 --- a/src/cmds/MXML.c +++ b/src/cmds/MXML.c @@ -115,7 +115,7 @@ int MXMLSetChild( int MXMLCreateE( mxml_t **E, /* O */ - char *Name) /* I (optional) */ + const char *Name) /* I (optional) */ { /* NOTE: should 'Name' be mandatory? */ @@ -457,7 +457,7 @@ int MXMLAppendAttr( len = strlen(E->AVal[ATok]) + strlen(AVal) + 2; - tmpAVal = realloc(E->AVal[ATok], len); + tmpAVal = (char *)realloc(E->AVal[ATok], len); if (tmpAVal == NULL) { @@ -527,7 +527,7 @@ int MXMLSetVal( ptr = (char *)V; Vlen = strlen(ptr); - outbuf = calloc(buf_size, (sizeof(char))); + outbuf = (char *)calloc(buf_size, (sizeof(char))); if (outbuf == NULL) { @@ -751,7 +751,7 @@ int MXMLToXString( { NewSize = MMAX_BUFFER; - if ((*Buf = calloc(1, NewSize)) == NULL) + if ((*Buf = (char *)calloc(1, NewSize)) == NULL) { /* cannot allocate buffer */ diff --git a/src/cmds/MXML.h b/src/cmds/MXML.h index 78fa4a0252..552160345e 100644 --- a/src/cmds/MXML.h +++ b/src/cmds/MXML.h @@ -6,7 +6,7 @@ int MXMLExtractE(mxml_t *E, mxml_t *C, mxml_t **CP); int MXMLSetChild(mxml_t *E, char *CName, mxml_t **CE); -int MXMLCreateE(mxml_t **E, char *Name); +int MXMLCreateE(mxml_t **E, const char *Name); int MXMLDestroyE(mxml_t **EP); diff --git a/src/cmds/common_cmds.c b/src/cmds/common_cmds.c index b3e48a1e74..b357a06777 100644 --- a/src/cmds/common_cmds.c +++ b/src/cmds/common_cmds.c @@ -189,7 +189,7 @@ void calloc_or_fail( memmgr **mm, /* memory manager */ char **dest, int alloc_size, - char *err_msg) + const char *err_msg) { *dest = (char *)memmgr_calloc(mm, 1, alloc_size); diff --git a/src/cmds/common_cmds.h b/src/cmds/common_cmds.h index e0eb4af017..0ae22b5473 100644 --- a/src/cmds/common_cmds.h +++ b/src/cmds/common_cmds.h @@ -90,7 +90,7 @@ int parse_env_line(memmgr **mm, char *one_var, char **name, char **value); void set_env_opts(memmgr **mm, job_data **env_attr, char **envp); -void calloc_or_fail(memmgr **mm, char **dest, int alloc_size, char *err_msg); +void calloc_or_fail(memmgr **mm, char **dest, int alloc_size, const char *err_msg); int parse_variable_list(memmgr **mm, job_data **dest_hash, job_data *user_env, int var_type, int op_type, char *the_list); diff --git a/src/cmds/pbsdsh.c b/src/cmds/pbsdsh.c index d4bfe29044..c5d4969992 100644 --- a/src/cmds/pbsdsh.c +++ b/src/cmds/pbsdsh.c @@ -40,7 +40,7 @@ extern int event_count; struct tm_errcode { int trc_code; - char *trc_name; + const char *trc_name; } tm_errcode[] = { @@ -69,7 +69,7 @@ fd_set permrfsd; int grabstdio = 0; -char *get_ecname( +const char *get_ecname( int rc) @@ -283,7 +283,7 @@ getstdout(void) { if (FD_ISSET(i, &rfsd)) { - if ((bytes = read(i, &buf, 1023)) > 0) + if ((bytes = read_ac_socket(i, &buf, 1023)) > 0) { buf[bytes] = '\0'; fprintf(stdout, "%s", buf); @@ -504,9 +504,9 @@ char *gethostnames( char *hoststart; int rc, tm_errno, i, j; - allnodes = calloc(numnodes, PBS_MAXNODENAME + 1 + sizeof(char)); - rescinfo = calloc(numnodes, RESCSTRLEN + 1 + sizeof(char)); - rescevent = calloc(numnodes, sizeof(tm_event_t)); + allnodes = (char *)calloc(numnodes, PBS_MAXNODENAME + 1 + sizeof(char)); + rescinfo = (char *)calloc(numnodes, RESCSTRLEN + 1 + sizeof(char)); + rescevent = (tm_event_t*)calloc(numnodes, sizeof(tm_event_t)); if (!allnodes || !rescinfo || !rescevent) { @@ -711,7 +711,7 @@ int main( int posixly_correct_set_by_caller = 0; char *envstr; - id = calloc(60, sizeof(char)); + id = (char *)calloc(60, sizeof(char)); if (id == NULL) { @@ -830,7 +830,7 @@ int main( #ifdef __GNUC__ if (!posixly_correct_set_by_caller) { - putenv("POSIXLY_CORRECT"); + putenv((char *)"POSIXLY_CORRECT"); free(envstr); } @@ -991,7 +991,7 @@ int main( stop = numnodes; } - if ((ioenv = calloc(2, sizeof(char **))) == NULL) + if ((ioenv = (char **)calloc(2, sizeof(char **))) == NULL) { /* FAILURE - cannot alloc memory */ @@ -1005,7 +1005,7 @@ int main( { stdoutfd = build_listener(&stdoutport); - if ((*ioenv = calloc(50, sizeof(char *))) == NULL) + if ((*ioenv = (char *)calloc(50, sizeof(char *))) == NULL) { /* FAILURE - cannot alloc memory */ diff --git a/src/cmds/pbsnodes.c b/src/cmds/pbsnodes.c index 2f64018bf9..5ed5a002e2 100644 --- a/src/cmds/pbsnodes.c +++ b/src/cmds/pbsnodes.c @@ -157,7 +157,7 @@ static int set_note( int rc; int local_errno = 0; - new_attr.name = ATTR_NODE_note; + new_attr.name = (char *)ATTR_NODE_note; new_attr.resource = NULL; new_attr.value = msg; new_attr.op = SET; @@ -234,7 +234,7 @@ static char *get_nstate( } } - return(""); + return((char *)""); } @@ -265,10 +265,10 @@ static char *get_note( static int marknode( int con, - char *name, - char *state1, + const char *name, + const char *state1, enum batch_op op1, - char *state2, + const char *state2, enum batch_op op2) { @@ -278,9 +278,9 @@ static int marknode( int rc; int local_errno = 0; - new_attr[0].name = ATTR_NODE_state; + new_attr[0].name = (char *)ATTR_NODE_state; new_attr[0].resource = NULL; - new_attr[0].value = state1; + new_attr[0].value = (char *)state1; new_attr[0].op = op1; if (state2 == NULL) @@ -291,9 +291,9 @@ static int marknode( { new_attr[0].next = &new_attr[1]; new_attr[1].next = NULL; - new_attr[1].name = ATTR_NODE_state; + new_attr[1].name = (char *)ATTR_NODE_state; new_attr[1].resource = NULL; - new_attr[1].value = state2; + new_attr[1].value = (char *)state2; new_attr[1].op = op2; } @@ -301,7 +301,7 @@ static int marknode( con, MGR_CMD_SET, MGR_OBJ_NODE, - name, + (char *)name, new_attr, NULL, &local_errno); @@ -796,7 +796,7 @@ int main( { if (!strcasecmp(NState[lindex], argv[optind])) { - ListType = lindex; + ListType = (enum NStateEnum)lindex; optind++; @@ -814,7 +814,7 @@ int main( } else { - nodeargs = calloc(2, sizeof(char **)); + nodeargs = (char **)calloc(2, sizeof(char **)); nodeargs[0] = strdup(""); nodeargs[1] = '\0'; } diff --git a/src/cmds/pbspoe.c b/src/cmds/pbspoe.c index 87e5939c90..aa1ca1293a 100644 --- a/src/cmds/pbspoe.c +++ b/src/cmds/pbspoe.c @@ -34,7 +34,7 @@ #define XPDBX_PATH "/usr/lpp/ppe.poe/bin/xpdbx" #define INTERACTIVE_FILE "/usr/local/pbs/etc/interactive" -void set_if_undefined(char *name, char *val); +void set_if_undefined(const char *name, const char *val); void check_environment(); int is_pbs_job(); char **pbs_setup(char *command, int argc, char **argv); @@ -68,7 +68,7 @@ is_pbs_job(void) return(1); } -void set_if_undefined(char *name, char *val) +void set_if_undefined(const char *name, const char *val) { char *ret; int result; @@ -76,7 +76,7 @@ void set_if_undefined(char *name, char *val) if (ret != NULL) return; - result = putenv(val); + result = putenv((char *)val); if (result != 0) { @@ -272,7 +272,7 @@ char **pbs_setup( /* make an argument list */ - newargs = calloc((argc + 8), sizeof(char *)); + newargs = (char **)calloc((argc + 8), sizeof(char *)); if (newargs == NULL) { @@ -351,7 +351,7 @@ char **pbs_setup( if (ocmdfile == 0) { - newargs[j++] = PBSPD; + newargs[j++] = (char *)PBSPD; newargs[j++] = pbsjobkey; } @@ -422,7 +422,7 @@ char **pbs_setup( exit(1); } - newargs[j++] = "-cmdfile"; + newargs[j++] = (char *)"-cmdfile"; newargs[j++] = ncmdfname; @@ -432,7 +432,7 @@ char **pbs_setup( { fprintf(stderr, "%s: Warning, (number of host nodes) < (number of procs)\n\t-- assigning multiple processes per node\n\t-- not using high-performance switch mode\n", mcn); - putenv("MP_EUILIB=ip"); + putenv((char *)"MP_EUILIB=ip"); sprintf(hostfile, "/tmp/pbsHtemp.%s", getenv("PBS_JOBID")); @@ -526,7 +526,7 @@ char **pbs_setup( free(hfile_mem); - newargs[j++] = "-hostfile"; + newargs[j++] = (char *)"-hostfile"; newargs[j++] = hostfile; @@ -644,15 +644,15 @@ char *get_real_command( else command_name = argv0; - if (!strcmp(command_name, "poe")) return(POE_PATH); + if (!strcmp(command_name, (char *)"poe")) return(POE_PATH); - if (!strcmp(command_name, "pbspoe")) return(POE_PATH); + if (!strcmp(command_name, (char *)"pbspoe")) return(POE_PATH); - if (!strcmp(command_name, "pdbx")) return(PDBX_PATH); + if (!strcmp(command_name, (char *)"pdbx")) return(PDBX_PATH); - if (!strcmp(command_name, "xpdbx")) return XPDBX_PATH; + if (!strcmp(command_name, (char *)"xpdbx")) return XPDBX_PATH; - if (!strcmp(command_name, "newpoe")) return(POE_PATH); + if (!strcmp(command_name, (char *)"newpoe")) return(POE_PATH); fprintf(stderr, "\"%s\" unknown to the PBS front end.\n", argv0); diff --git a/src/cmds/qalter.c b/src/cmds/qalter.c index 45bbf24dbb..640a91dd50 100644 --- a/src/cmds/qalter.c +++ b/src/cmds/qalter.c @@ -528,7 +528,7 @@ int main( if (strcmp(keyword, ATTR_depend) == 0) { int rtn = 0; - pdepend = calloc(1, PBS_DEPEND_LEN); + pdepend = (char *)calloc(1, PBS_DEPEND_LEN); if ((pdepend == NULL) || (rtn = parse_depend_list(valuewd,pdepend,PBS_DEPEND_LEN))) @@ -684,7 +684,7 @@ int main( if ((stat != 0) && (any_failed != PBSE_UNKJOBID)) { - prt_job_err("qalter", connect, job_id_out); + prt_job_err((char *)"qalter", connect, job_id_out); } else if ((stat != 0) && (any_failed != PBSE_UNKJOBID) && @@ -701,7 +701,7 @@ int main( goto cnt; } - prt_job_err("qalter", connect, job_id_out); + prt_job_err((char *)"qalter", connect, job_id_out); } /* END else if (stat && ...) */ pbs_disconnect(connect); diff --git a/src/cmds/qdel.c b/src/cmds/qdel.c index b0f5da69ba..2f1428e9bd 100644 --- a/src/cmds/qdel.c +++ b/src/cmds/qdel.c @@ -204,7 +204,7 @@ int main( for (;optind < argc;optind++) { int connect; - int stat = 0; + int stat; /* check to see if user specified 'all' to delete all jobs */ @@ -247,7 +247,7 @@ int main( if (stat && (any_failed != PBSE_UNKJOBID)) { - prt_job_err("qdel", connect, job_id_out); + prt_job_err((char *)"qdel", connect, job_id_out); } else if (stat && (any_failed != PBSE_UNKJOBID) && @@ -264,7 +264,7 @@ int main( goto cnt; } - prt_job_err("qdel", connect, job_id_out); + prt_job_err((char *)"qdel", connect, job_id_out); } pbs_disconnect(connect); diff --git a/src/cmds/qmgr.c b/src/cmds/qmgr.c index ed7125b76b..6546940aa3 100644 --- a/src/cmds/qmgr.c +++ b/src/cmds/qmgr.c @@ -2017,52 +2017,52 @@ int get_request( int is_attr( int object, - char *name, + const char *name, int attr_type) { - static char *svr_public_attrs[] = + static const char *svr_public_attrs[] = { #include "qmgr_svr_public.h" #include "site_qmgr_svr_print.h" NULL }; - static char *svr_readonly_attrs[] = + static const char *svr_readonly_attrs[] = { #include "qmgr_svr_readonly.h" NULL }; - static char *que_public_attrs[] = + static const char *que_public_attrs[] = { #include "qmgr_que_public.h" #include "site_qmgr_que_print.h" NULL }; - static char *que_readonly_attrs[] = + static const char *que_readonly_attrs[] = { #include "qmgr_que_readonly.h" NULL }; - static char *node_public_attrs[] = + static const char *node_public_attrs[] = { #include "qmgr_node_public.h" #include "site_qmgr_node_print.h" NULL }; - static char *node_readonly_attrs[] = + static const char *node_readonly_attrs[] = { #include "qmgr_node_readonly.h" NULL }; /* DIAGTODO: need a list of public and read-only diag attrs */ - char **attr_public = NULL; - char **attr_readonly = NULL; + const char **attr_public = NULL; + const char **attr_readonly = NULL; char *dupname = NULL; char *name_ptr = NULL; @@ -2404,9 +2404,9 @@ int parse( void pstderr_big( - char *svrname, - char *objname, - char *errmesg) + const char *svrname, + const char *objname, + const char *errmesg) { if (! zopt) @@ -2675,12 +2675,12 @@ int is_valid_object( static struct attrl attrq = { - NULL, ATTR_qtype, "", "", 0 + NULL, (char *)ATTR_qtype, (char *)"", (char *)"", EQ }; static struct attrl attrn = { - NULL, ATTR_NODE_state, "", "", 0 + NULL, (char *)ATTR_NODE_state, (char *)"", (char *)"", EQ }; int local_errno = 0; diff --git a/src/cmds/qmgr_functions.h b/src/cmds/qmgr_functions.h index 9a85528e1d..0a3a203bc7 100644 --- a/src/cmds/qmgr_functions.h +++ b/src/cmds/qmgr_functions.h @@ -35,13 +35,13 @@ struct objname * commalist2objname(char *names, int type); int get_request(char *request); -int is_attr(int object, char *name, int attr_type); +int is_attr(int object, const char *name, int attr_type); void show_help(char *str); int parse(char *request, int *oper, int *type, char **names, struct attropl **attr); -void pstderr_big(char *svrname, char *objname, char *errmesg); +void pstderr_big(const char *svrname, const char *objname, const char *errmesg); void free_objname_list(struct objname *list); diff --git a/src/cmds/qselect.c b/src/cmds/qselect.c index 1f62359764..68bed624f6 100644 --- a/src/cmds/qselect.c +++ b/src/cmds/qselect.c @@ -90,7 +90,7 @@ set_attrop(struct attropl **list, char *a_name, char *r_name, char *v_name, enum #define OPSTRING_LEN 4 #define OP_LEN 2 #define OP_ENUM_LEN 6 -static char *opstring_vals[] = { "eq", "ne", "ge", "gt", "le", "lt" }; +static const char *opstring_vals[] = { "eq", "ne", "ge", "gt", "le", "lt" }; static enum batch_op opstring_enums[] = { EQ, NE, GE, GT, LE, LT }; @@ -267,7 +267,7 @@ int main( sprintf(a_value, "%ld", (long)after); - set_attrop(&select_list, ATTR_a, NULL, a_value, op); + set_attrop(&select_list, (char *)ATTR_a, NULL, a_value, op); break; case 'e': @@ -329,7 +329,7 @@ int main( } } - set_attrop(&select_list, ATTR_c, NULL, optargout, op); + set_attrop(&select_list, (char *)ATTR_c, NULL, optargout, op); break; @@ -375,7 +375,7 @@ int main( break; } - set_attrop(&select_list, ATTR_h, NULL, optargout, op); + set_attrop(&select_list, (char *)ATTR_h, NULL, optargout, op); break; @@ -390,20 +390,20 @@ int main( break; } - set_attrop(&select_list, ATTR_l, resource_name, optargout, op); + set_attrop(&select_list, (char *)ATTR_l, resource_name, optargout, op); } break; case 'p': check_op(optarg, pop, optargout); - set_attrop(&select_list, ATTR_p, NULL, optargout, op); + set_attrop(&select_list, (char *)ATTR_p, NULL, optargout, op); break; case 'q': strncpy(destination, optarg, PBS_MAXROUTEDEST); check_op(optarg, pop, optargout); - set_attrop(&select_list, ATTR_q, NULL, optargout, op); + set_attrop(&select_list, (char *)ATTR_q, NULL, optargout, op); break; case 'r': @@ -426,7 +426,7 @@ int main( break; } - set_attrop(&select_list, ATTR_r, NULL, pc, op); + set_attrop(&select_list, (char *)ATTR_r, NULL, pc, op); break; @@ -457,7 +457,7 @@ int main( pc++; } - set_attrop(&select_list, ATTR_state, NULL, optargout, op); + set_attrop(&select_list, (char *)ATTR_state, NULL, optargout, op); break; @@ -471,18 +471,18 @@ int main( break; } - set_attrop(&select_list, ATTR_u, NULL, optarg, op); + set_attrop(&select_list, (char *)ATTR_u, NULL, optarg, op); break; case 'A': op = EQ; - set_attrop(&select_list, ATTR_A, NULL, optarg, op); + set_attrop(&select_list, (char *)ATTR_A, NULL, optarg, op); break; case 'N': op = EQ; - set_attrop(&select_list, ATTR_N, NULL, optarg, op); + set_attrop(&select_list, (char *)ATTR_N, NULL, optarg, op); break; default : @@ -531,7 +531,7 @@ int main( exit(any_failed); } - selectjob_list = pbs_selectjob_err(connect, select_list, exec_only ? EXECQUEONLY : NULL, &any_failed); + selectjob_list = pbs_selectjob_err(connect, select_list, exec_only ? (char *)EXECQUEONLY : NULL, &any_failed); if (selectjob_list == NULL) { diff --git a/src/cmds/qstat.c b/src/cmds/qstat.c index 4e1c6b6245..6c63bfb238 100644 --- a/src/cmds/qstat.c +++ b/src/cmds/qstat.c @@ -61,9 +61,7 @@ mbool_t DisplayXML = FALSE; #define maxlinesize 65536 int linesize = 77; -int tasksize; - -static char *summarize_arrays_extend_opt = "summarize_arrays"; +static const char *summarize_arrays_extend_opt = "summarize_arrays"; /* END globals */ @@ -214,7 +212,7 @@ void prt_attr( { char *c; - char *comma = ","; + const char *comma = ","; int first = 1; int l; int start; @@ -341,11 +339,11 @@ static char *findattrl( static void prt_nodes( - char *nodes) /* I */ + const char *nodes) /* I */ { int i; - char *stp; + const char *stp; char linebuf[65536]; @@ -439,7 +437,7 @@ static char *cnv_size( int sft; unsigned long nval; char *pc; - char *suffix; + const char *suffix; static char outbuf[25]; if (opt & ALT_DISPLAY_Mb) @@ -516,23 +514,23 @@ static void altdsp_statjob( int alt_opt) /* I */ { - char *comment; + const char *comment; char *pc; struct attrl *pat; - char *exechost; + const char *exechost; char *usern = NULL; char *queuen = NULL; char *jobn = NULL; - char *sess; - char *tasks; + const char *sess; + const char *tasks; char calcTasks[64]; - char *nodect; - char *rqtimecpu; - char *rqtimewal; - char *jstate; - char *eltimecpu; - char *eltimewal; + const char *nodect; + const char *rqtimecpu; + const char *rqtimewal; + const char *jstate; + const char *eltimecpu; + const char *eltimewal; char tmpLine[MAX_LINE_LEN]; int usecput; @@ -540,14 +538,14 @@ static void altdsp_statjob( static char rqmem[SIZEL]; static char srfsbig[SIZEL]; static char srfsfast[SIZEL]; - static char *blank = " -- "; + static const char *blank = " -- "; if (prtheader) { printf("\n%s: ", prtheader->name); - if ((pc = findattrl(prtheader->attribs, ATTR_comment, NULL)) != NULL) + if ((pc = findattrl(prtheader->attribs, (char *)ATTR_comment, NULL)) != NULL) { printf("%s", pc); @@ -827,11 +825,11 @@ static void altdsp_statque( { char rmem[SIZEL]; - char *cput; - char *wallt; - char *jmax; - char *nodect; - char *blank = "-- "; + const char *cput; + const char *wallt; + const char *jmax; + const char *nodect; + const char *blank = "-- "; int jrun; int jque; char qenabled = '\0'; @@ -995,7 +993,7 @@ void display_statjob( char *jid; char *name; char *owner; - char *timeu; + const char *timeu; char *state; char *location; char format[80]; @@ -1127,7 +1125,7 @@ void display_statjob( else { if ((!strcmp(a->name, "Walltime")) && (a->value[0] == '-')) - prt_attr(a->name, "Exceeded", a->value); + prt_attr(a->name, (char *)"Exceeded", a->value); else prt_attr(a->name, a->resource, a->value); @@ -1363,8 +1361,8 @@ void display_statque( int l; char *c; char *name; - char *max; - char *tot; + const char *max; + const char *tot; char ena[MAXNUML + 1]; char str[MAXNUML + 1]; char que[MAXNUML + 1]; @@ -1374,7 +1372,7 @@ void display_statque( char trn[MAXNUML + 1]; char ext[MAXNUML + 1]; char dne[MAXNUML + 1]; - char *type; + const char *type; char format[80]; int NUML = 5; @@ -1509,7 +1507,7 @@ void display_statque( { type = a->value; - *(type + 1) = '\0'; + *((char *)type + 1) = '\0'; } } @@ -1559,8 +1557,8 @@ void display_statserver( int l; char *c; char *name; - char *max; - char *tot; + const char *max; + const char *tot; char que[MAXNUML + 1]; char run[MAXNUML + 1]; char hld[MAXNUML + 1]; @@ -1568,7 +1566,7 @@ void display_statserver( char trn[MAXNUML + 1]; char ext[MAXNUML + 1]; char dne[MAXNUML + 1]; - char *stats; + const char *stats; char format[80]; int NUML; @@ -1958,7 +1956,7 @@ int main( int errflg = 0; int any_failed = 0; extern char *optarg; - char *conflict = "qstat: conflicting options.\n"; + const char *conflict = "qstat: conflicting options.\n"; #if (TCL_QSTAT == 0) char *pc; #else @@ -1974,12 +1972,12 @@ int main( char server_old[MAXSERVERNAME] = ""; char rmt_server[MAXSERVERNAME]; char destination[PBS_MAXDEST + 1]; - char *def_server; + const char *def_server; char *queue_name_out; char *server_name_out; - char *ExtendOpt = NULL; + const char *ExtendOpt = NULL; char operand[PBS_MAXCLTJOBID + 1]; int alt_opt; @@ -2079,7 +2077,7 @@ int main( alt_opt |= ALT_DISPLAY_i; - add_atropl(&p_atropl, ATTR_state, NULL, "EHQTW", EQ); + add_atropl(&p_atropl, (char *)ATTR_state, NULL, (char *)"EHQTW", EQ); break; @@ -2101,7 +2099,7 @@ int main( alt_opt |= ALT_DISPLAY_r; - add_atropl(&p_atropl, ATTR_state, NULL, "RS", EQ); + add_atropl(&p_atropl, (char *)ATTR_state, NULL, (char *)"RS", EQ); break; @@ -2121,7 +2119,7 @@ int main( alt_opt |= ALT_DISPLAY_u; - add_atropl(&p_atropl, ATTR_u, NULL, optarg, EQ); + add_atropl(&p_atropl, (char *)ATTR_u, NULL, optarg, EQ); break; @@ -2241,12 +2239,12 @@ int main( case 'i': alt_opt |= ALT_DISPLAY_i; - add_atropl(&p_atropl, ATTR_state, (char *)0, "EHQTW", EQ); + add_atropl(&p_atropl, (char *)ATTR_state, (char *)0, (char *)"EHQTW", EQ); break; case 'r': alt_opt |= ALT_DISPLAY_r; - add_atropl(&p_atropl, ATTR_state, (char *)0, "RS", EQ); + add_atropl(&p_atropl, (char *)ATTR_state, (char *)0, (char *)"RS", EQ); break; case 'u': @@ -2256,7 +2254,7 @@ int main( while (*++pc == ' '); - add_atropl(&p_atropl, ATTR_u, (char *)0, pc, EQ); + add_atropl(&p_atropl, (char *)ATTR_u, (char *)0, pc, EQ); pc = pc + strlen(pc) - 1; /* for the later incr */ @@ -2522,7 +2520,7 @@ int main( if (*queue_name_out != '\0') { - add_atropl(&p_atropl, ATTR_q, NULL, queue_name_out, EQ); + add_atropl(&p_atropl, (char *)ATTR_q, NULL, queue_name_out, EQ); } } /* END else */ @@ -2571,18 +2569,18 @@ int main( connect, job_id_out, NULL, - exec_only ? EXECQUEONLY : ExtendOpt, + exec_only ? (char *)EXECQUEONLY : (char *)ExtendOpt, &any_failed); } else { if (t_opt) { - p_status = pbs_selstat_err(connect, p_atropl, exec_only ? EXECQUEONLY : NULL, &any_failed); + p_status = pbs_selstat_err(connect, p_atropl, exec_only ? (char *)EXECQUEONLY : NULL, &any_failed); } else { - p_status = pbs_selstat_err(connect, p_atropl, exec_only ? EXECQUEONLY : summarize_arrays_extend_opt, &any_failed); + p_status = pbs_selstat_err(connect, p_atropl, exec_only ? (char *)EXECQUEONLY : (char *)summarize_arrays_extend_opt, &any_failed); } } @@ -2603,7 +2601,7 @@ int main( tcl_stat("job", NULL, f_opt); - prt_job_err("qstat", connect, job_id_out); + prt_job_err((char *)"qstat", connect, job_id_out); } else { @@ -2611,7 +2609,7 @@ int main( if (any_failed != PBSE_NONE) { - prt_job_err("qstat", connect, job_id_out); + prt_job_err((char *)"qstat", connect, job_id_out); } } } diff --git a/src/cmds/qsub_functions.c b/src/cmds/qsub_functions.c index 0d885c5055..d96d6a63ad 100644 --- a/src/cmds/qsub_functions.c +++ b/src/cmds/qsub_functions.c @@ -21,6 +21,7 @@ #include /* all static defines, message & error codes */ #include "qsub_functions.h" #include "common_cmds.h" +#include "../lib/Libifl/lib_ifl.h" #include #include @@ -83,7 +84,7 @@ char *host_name_suffix = NULL; int J_opt = FALSE; int P_opt = FALSE; -char *checkpoint_strings = "n,c,s,u,none,shutdown,periodic,enabled,interval,depth,dir"; +const char *checkpoint_strings = "n,c,s,u,none,shutdown,periodic,enabled,interval,depth,dir"; /* adapted from openssh */ /* The parameter was EMsg, but was never used. @@ -209,7 +210,7 @@ char *x11_get_proto( return(NULL); } - authstring = calloc(1, strlen(proto) + strlen(data) + strlen(screen) + 4); + authstring = (char *)calloc(1, strlen(proto) + strlen(data) + strlen(screen) + 4); if (authstring == NULL) { @@ -294,7 +295,7 @@ int find_job_script_index( char *smart_strtok( char *line, /* I */ - char *delims, /* I */ + const char *delims, /* I */ char **ptrPtr, /* O */ int ign_backslash) /* I */ @@ -526,10 +527,10 @@ char *smart_strtok( -int get_name_value(start, name, value) -char *start; -char **name; -char **value; +int get_name_value( + char *start, + char **name, + char **value) { static char *tok_ptr; char *curr_ptr; @@ -705,7 +706,7 @@ int validate_submit_filter( int rc = 0; job_data *filter_info = NULL; struct stat sfilter; - char *DefaultFilterPath = "/usr/local/sbin/torque_submitfilter"; + const char *DefaultFilterPath = "/usr/local/sbin/torque_submitfilter"; hash_find(*a_hash, ATTR_pbs_o_submit_filter, &filter_info); if ((filter_info != NULL) && (filter_info->var_type == CONFIG_DATA)) @@ -1170,7 +1171,7 @@ void make_argv( int len; char quote; - buffer = calloc(1, strlen(line) + 1); + buffer = (char *)calloc(1, strlen(line) + 1); if (buffer == NULL) { @@ -1181,7 +1182,7 @@ void make_argv( *argc = 0; - argv[(*argc)++] = "qsub"; + argv[(*argc)++] = (char *)"qsub"; l = line; b = buffer; @@ -1440,7 +1441,7 @@ int reader( while (1) { - c = read(s, buf, sizeof(buf)); + c = read_ac_socket(s, buf, sizeof(buf)); if (c > 0) { @@ -1448,7 +1449,7 @@ int reader( while (c) { - if ((wc = write(d, p, c)) < 0) + if ((wc = write_ac_socket(d, p, c)) < 0) { if (errno == EINTR) { @@ -1510,7 +1511,7 @@ void writer( while (1) { - i = read(d, &c, 1); + i = read_ac_socket(d, &c, 1); if (i > 0) { @@ -1524,7 +1525,7 @@ void writer( /* read next character to check */ - while ((i = read(d, &c, 1)) != 1) + while ((i = read_ac_socket(d, &c, 1)) != 1) { if ((i == -1) && (errno == EINTR)) continue; @@ -1556,7 +1557,7 @@ void writer( { /* not escape, write out tilde */ - while ((wi = write(s, &tilde, 1)) != 1) + while ((wi = write_ac_socket(s, &tilde, 1)) != 1) { if ((wi == -1) && (errno == EINTR)) continue; @@ -1581,7 +1582,7 @@ void writer( (c == '\r'); } - while ((wi = write(s, &c, 1)) != 1) + while ((wi = write_ac_socket(s, &c, 1)) != 1) { /* write out character */ @@ -1665,7 +1666,7 @@ void send_winsize( wsz->ws_xpixel, wsz->ws_ypixel); - if (write(sock, buf, PBS_TERM_BUF_SZ) != PBS_TERM_BUF_SZ) + if (write_ac_socket(sock, buf, PBS_TERM_BUF_SZ) != PBS_TERM_BUF_SZ) print_qsub_usage_exit("qsub: sending winsize"); /* { perror("sending winsize"); @@ -1701,7 +1702,7 @@ void send_term( else safe_strncat(buf, term, PBS_TERM_BUF_SZ - 5); - if (write(sock, buf, PBS_TERM_BUF_SZ) != PBS_TERM_BUF_SZ) + if (write_ac_socket(sock, buf, PBS_TERM_BUF_SZ) != PBS_TERM_BUF_SZ) print_qsub_usage_exit("qsub: sending term type"); /* { perror("sending term type"); @@ -1718,7 +1719,7 @@ void send_term( cc_array[4] = oldtio.c_cc[VEOF]; cc_array[5] = oldtio.c_cc[VSUSP]; - if (write(sock, cc_array, PBS_TERM_CCA) != PBS_TERM_CCA) + if (write_ac_socket(sock, cc_array, PBS_TERM_CCA) != PBS_TERM_CCA) print_qsub_usage_exit("qsub: sending term options"); /* { perror("sending term options"); @@ -2114,7 +2115,7 @@ void interactive( while (amt > 0) { - fromlen = read(news, pc, amt); + fromlen = read_ac_socket(news, pc, amt); if (fromlen <= 0) break; @@ -2265,7 +2266,7 @@ int validate_group_list( /* check each group to determine if it is a valid group that the user can be a part of. * group list is of the form group[@host][,group[@host]...] */ char *groups = strdup(glist); - char *delims = ","; + const char *delims = ","; char *tmp_group = strtok(groups, delims); char *at; char *u_name; @@ -2919,7 +2920,7 @@ void process_opts( Depend_opt = passet; */ - pdepend = calloc(1, PBS_DEPEND_LEN); + pdepend = (char *)calloc(1, PBS_DEPEND_LEN); if ((pdepend == NULL) || (rc = parse_depend_list(valuewd,pdepend,PBS_DEPEND_LEN))) @@ -3576,7 +3577,7 @@ void process_opts( /* Duplicate code */ /* #ifdef linux */ aindex = 1; /* prime getopt's starting point */ - tmpArgV[0] = ""; + tmpArgV[0] = (char *)""; /* #else */ /* aindex = 1; prime getopt's starting point */ /* tmpArgV[0] = ""; */ @@ -3706,8 +3707,8 @@ void set_job_defaults( char *get_param( - char *param, /* I */ - char *config_buf) /* I */ + const char *param, /* I */ + const char *config_buf) /* I */ { char tmpLine[1024]; @@ -3723,7 +3724,7 @@ char *get_param( /* NOTE: currently case-sensitive (FIXME) */ - if ((param_val = strstr(config_buf, param)) == NULL) + if ((param_val = strstr((char *)config_buf, param)) == NULL) { return(NULL); } @@ -3879,7 +3880,7 @@ void process_config_file( * display the qsub usage information * exit */ -void print_qsub_usage_exit(char *error_msg) +void print_qsub_usage_exit(const char *error_msg) { static char usage[] = "usage: qsub [-a date_time] [-A account_string] [-b secs]\n\ @@ -3970,7 +3971,7 @@ void set_minwclimit( void add_variable_list( job_info *ji, - char *var_name, + const char *var_name, job_data *src_hash) { @@ -3991,7 +3992,7 @@ void add_variable_list( total_len += hash_strlen(ji->user_attr); count = hash_count(ji->user_attr); total_len += count*2; - var_list = memmgr_calloc(&ji->mm, 1, total_len); + var_list = (char *)memmgr_calloc(&ji->mm, 1, total_len); if (v_value != NULL) { @@ -4000,7 +4001,7 @@ void add_variable_list( strcat(var_list, ","); } - for (en=src_hash; en != NULL; en=en->hh.next) + for (en=src_hash; en != NULL; en=(job_data *)en->hh.next) { pos++; strcat(var_list, en->name); diff --git a/src/cmds/qsub_functions.h b/src/cmds/qsub_functions.h index 34e2a2bd04..0e9d2772f3 100644 --- a/src/cmds/qsub_functions.h +++ b/src/cmds/qsub_functions.h @@ -114,7 +114,7 @@ char *x11_get_proto( char *smart_strtok( char *line, /* I */ - char *delims, /* I */ + const char *delims, /* I */ char **ptrPtr, /* O */ int ign_backslash);/* I */ @@ -220,8 +220,8 @@ int load_config( int BufSize); /* I */ char *get_param( - char *param, /* I */ - char *config_buf); /* I */ + const char *param, /* I */ + const char *config_buf); /* I */ void set_client_attr_defaults( memmgr **mm, /* M */ @@ -233,7 +233,7 @@ void process_config_file( job_info *ji); /* M */ void print_qsub_usage_exit( - char *error_msg); /* I */ + const char *error_msg); /* I */ void add_submit_args_to_job(memmgr **mm, job_data **job_attr, int argc, char **argv); diff --git a/src/cmds/test/common_cmds/scaffolding.c b/src/cmds/test/common_cmds/scaffolding.c index c2b4379e31..2ba8d7d072 100644 --- a/src/cmds/test/common_cmds/scaffolding.c +++ b/src/cmds/test/common_cmds/scaffolding.c @@ -12,7 +12,7 @@ int env_del_call = 0; int env_find_call = 0; int tc_num = 0; -int hash_add_item(memmgr **mm, job_data **head, char *name, char *value, int var_type, int op_type) +int hash_add_item(memmgr **mm, job_data **head, const char *name, const char *value, int var_type, int op_type) { if ((strcmp(name, "ONE_VAR") == 0) && (strcmp(value, "ONE_VAL") == 0) @@ -47,7 +47,7 @@ int hash_add_item(memmgr **mm, job_data **head, char *name, char *value, int var return 0; } -int hash_del_item(memmgr **mm, job_data **head, char *name) +int hash_del_item(memmgr **mm, job_data **head, const char *name) { if (strcmp(name, "_") == 0) { @@ -56,7 +56,7 @@ int hash_del_item(memmgr **mm, job_data **head, char *name) return 0; } -int hash_find(job_data *head, char *name, job_data **env_var) +int hash_find(job_data *head, const char *name, job_data **env_var) { if (tc_num == 1) { @@ -78,7 +78,7 @@ int hash_find(job_data *head, char *name, job_data **env_var) return 1; } -void hash_add_or_exit(memmgr **mm, job_data **head, char *name, char *value, int var_type) +void hash_add_or_exit(memmgr **mm, job_data **head, const char *name, const char *value, int var_type) { if (tc_num == 2) { @@ -109,8 +109,8 @@ int append_dynamic_string(dynamic_string *ds, const char *str) dynamic_string *get_dynamic_string(int size, const char *str) { - dynamic_string *ds = calloc(1, sizeof(dynamic_string)); - ds->str = calloc(1, 1024*10); + dynamic_string *ds = (dynamic_string *)calloc(1, sizeof(dynamic_string)); + ds->str = (char *)calloc(1, 1024*10); return(ds); } diff --git a/src/cmds/test/pbsdsh/scaffolding.c b/src/cmds/test/pbsdsh/scaffolding.c index 43f2663e95..caa10fa50a 100644 --- a/src/cmds/test/pbsdsh/scaffolding.c +++ b/src/cmds/test/pbsdsh/scaffolding.c @@ -19,7 +19,7 @@ int tm_poll(tm_event_t poll_event, tm_event_t *result_event, int wait, int *tm_e exit(1); } -ssize_t read_nonblocking_socket(int fd, void *buf, ssize_t count) +ssize_t read_ac_socket(int fd, void *buf, ssize_t count) { fprintf(stderr, "The call to read_nonblocking_socket needs to be mocked!!\n"); exit(1); diff --git a/src/cmds/test/pbsnodes/scaffolding.c b/src/cmds/test/pbsnodes/scaffolding.c index ad5f4fdefc..e012cdc45e 100644 --- a/src/cmds/test/pbsnodes/scaffolding.c +++ b/src/cmds/test/pbsnodes/scaffolding.c @@ -87,7 +87,7 @@ int pbs_manager_err(int c, int command, int objtype, char *objname, struct attro exit(1); } -int MXMLCreateE(mxml_t **E, char *Name) +int MXMLCreateE(mxml_t **E, const char *Name) { fprintf(stderr, "The call to MXMLCreateE needs to be mocked!!\n"); exit(1); diff --git a/src/cmds/test/qstat/scaffolding.c b/src/cmds/test/qstat/scaffolding.c index 674ea96c1e..3c77fab901 100644 --- a/src/cmds/test/qstat/scaffolding.c +++ b/src/cmds/test/qstat/scaffolding.c @@ -109,7 +109,7 @@ int MXMLAddE(mxml_t *E, mxml_t *C) exit(1); } -int MXMLCreateE(mxml_t **E, char *Name) +int MXMLCreateE(mxml_t **E, const char *Name) { fprintf(stderr, "The call to MXMLCreateE needs to be mocked!!\n"); exit(1); diff --git a/src/cmds/test/qsub_functions/scaffolding.c b/src/cmds/test/qsub_functions/scaffolding.c index b37f0099e6..ed34cfbc1a 100644 --- a/src/cmds/test/qsub_functions/scaffolding.c +++ b/src/cmds/test/qsub_functions/scaffolding.c @@ -17,7 +17,7 @@ char *pbs_geterrmsg(int connect) exit(1); } -int hash_find(job_data *head, char *name, job_data **env_var) +int hash_find(job_data *head, const char *name, job_data **env_var) { fprintf(stderr, "The call to hash_find to be mocked!!\n"); exit(1); @@ -89,19 +89,19 @@ int prepare_path( char *path_in, char *path_out, char *host) exit(1); } -int hash_del_item(memmgr **mm, job_data **head, char *name) +int hash_del_item(memmgr **mm, job_data **head, const char *name) { fprintf(stderr, "The call to hash_del_item to be mocked!!\n"); exit(1); } -int csv_length(char *csv_str) +int csv_length(const char *csv_str) { fprintf(stderr, "The call to csv_length to be mocked!!\n"); exit(1); } -char *csv_nth(char *csv_str, int n) +char *csv_nth(const char *csv_str, int n) { fprintf(stderr, "The call to csv_nth to be mocked!!\n"); exit(1); @@ -143,7 +143,7 @@ int parse_at_list(char *list, int use_count, int abs_path) exit(1); } -char * csv_find_string(char *csv_str, char *search_str) +char * csv_find_string(const char *csv_str, const char *search_str) { fprintf(stderr, "The call to csv_find_string to be mocked!!\n"); exit(1); @@ -167,7 +167,7 @@ int pbs_deljob_err( int c, char *jobid, char *extend, int *local_errno) exit(1); } -void calloc_or_fail( char **dest, int alloc_size, char *err_msg) +void calloc_or_fail( char **dest, int alloc_size, const char *err_msg) { fprintf(stderr, "The call to calloc_or_fail to be mocked!!\n"); exit(1); @@ -197,7 +197,7 @@ char *pbs_strerror(int err) exit(1); } -void hash_add_or_exit(memmgr **mm, job_data **head, char *name, char *value, int var_type) +void hash_add_or_exit(memmgr **mm, job_data **head, const char *name, const char *value, int var_type) { fprintf(stderr, "The call to hash_add_or_exit to be mocked!!\n"); exit(1); @@ -265,3 +265,13 @@ int load_config( { return(0); } + +ssize_t write_ac_socket(int fd, const void *buf, ssize_t count) + { + return(0); + } + +ssize_t read_ac_socket(int fd, void *buf, ssize_t count) + { + return(0); + } diff --git a/src/drmaa/src/submit.c b/src/drmaa/src/submit.c index e38e6f3c8a..330c7ea11f 100644 --- a/src/drmaa/src/submit.c +++ b/src/drmaa/src/submit.c @@ -824,7 +824,7 @@ drmaa_write_tmpfile( while (len > 0) { - size_t written = write(fd, content, len); + size_t written = write_ac_socket(fd, content, len); if (written != (size_t) - 1) { diff --git a/src/include/acct.h b/src/include/acct.h index 59f7ebdcfa..15772e3426 100644 --- a/src/include/acct.h +++ b/src/include/acct.h @@ -104,7 +104,7 @@ #define PBS_ACCT_ABT (int)'A' /* Job Abort by server */ extern int acct_open (char *filename); -extern void account_record (int acctype, job *pjob, char *text); +extern void account_record (int acctype, job *pjob, const char *text); extern void account_jobstr (job *pjob); extern void account_jobend (job *pjob, char * used); diff --git a/src/include/alps_constants.h b/src/include/alps_constants.h index 7d4ce1b94f..4e0ecd71c4 100644 --- a/src/include/alps_constants.h +++ b/src/include/alps_constants.h @@ -96,7 +96,6 @@ #define CONFIRM_BASIL_REQ "echo \"\" | %s" #define DELETE_BASIL_REQ "echo \"\" | %s" - extern const int apbasil_fail_transient; extern const int apbasil_fail_permanent; extern const char *message; @@ -130,7 +129,7 @@ extern const char *text_name; extern const char *memory_mb; extern const char *family; extern const char *cproc_eq; -extern const int cproc_eq_len; +extern const int ac_cproc_eq_len; extern const char *CRAY_GPU_STATUS_START; extern const char *CRAY_GPU_STATUS_END; extern const char *alps_reporter_feature; diff --git a/src/include/attribute.h b/src/include/attribute.h index 091af951c6..b40407fd50 100644 --- a/src/include/attribute.h +++ b/src/include/attribute.h @@ -210,7 +210,7 @@ typedef struct pbs_attribute pbs_attribute; struct attribute_def { const char *at_name; - int (*at_decode)(pbs_attribute *patr, const char *name, char *rn, char *val, int perm); + int (*at_decode)(pbs_attribute *patr, const char *name, const char *rn, const char *val, int perm); int (*at_encode)(pbs_attribute *pattr, tlist_head *phead, const char *aname, const char *rsname, int mode, int perm); int (*at_set)(pbs_attribute *pattr, pbs_attribute *new_attr, enum batch_op); @@ -336,7 +336,7 @@ struct array_strings */ extern void clear_attr(pbs_attribute *pattr, attribute_def *pdef); -extern int find_attr(attribute_def *attrdef, char *name, int limit); +extern int find_attr(attribute_def *attrdef, const char *name, int limit); extern int recov_attr(int fd, void *parent, attribute_def *padef, pbs_attribute *pattr, int limit, int unknown, int do_actions); extern long attr_ifelse_long(pbs_attribute *, pbs_attribute *, long); @@ -353,22 +353,22 @@ extern int attr_atomic_node_set(svrattrl *plist, pbs_attribute *old, int unkn, int privil, int *badattr); extern void attr_atomic_kill(pbs_attribute *temp, attribute_def *pdef, int); -int decode_b(pbs_attribute *patr, const char *name, char *rn, char *val, int); -int decode_c(pbs_attribute *patr, const char *name, char *rn, char *val, int); -int decode_l(pbs_attribute *patr, const char *name, char *rn, char *val, int); -int decode_ll(pbs_attribute *patr, const char *name, char *rn, char *val, int); -int decode_size(pbs_attribute *patr, const char *name, char *rn, char *val, int); -int decode_str(pbs_attribute *patr, const char *name, char *rn, char *val, int); -int decode_time(pbs_attribute *patr, const char *name, char *rn, char *val, int); -int decode_arst(pbs_attribute *patr, const char *name, char *rn, char *val, int); -int decode_arst_direct(pbs_attribute *patr, char *val); -int decode_arst_merge(pbs_attribute *,const char *,char *,char *); -int decode_resc(pbs_attribute *patr, const char *name, char *rn, char *val, int); -int decode_depend(pbs_attribute *patr, const char *name, char *rn, char *val, int); -int decode_hold(pbs_attribute *patr, const char *name, char *rn, char *val, int); -int decode_uacl(pbs_attribute *patr, const char *name, char *rn, char *val, int); -int decode_unkn(pbs_attribute *patr, const char *name, char *rn, char *val, int); -int decode_tv(pbs_attribute *patr, const char *name, char *rescn, char *val, int); +int decode_b(pbs_attribute *patr, const char *name, const char *rn, const char *val, int); +int decode_c(pbs_attribute *patr, const char *name, const char *rn, const char *val, int); +int decode_l(pbs_attribute *patr, const char *name, const char *rn, const char *val, int); +int decode_ll(pbs_attribute *patr, const char *name, const char *rn, const char *val, int); +int decode_size(pbs_attribute *patr, const char *name, const char *rn, const char *val, int); +int decode_str(pbs_attribute *patr, const char *name, const char *rn, const char *val, int); +int decode_time(pbs_attribute *patr, const char *name, const char *rn, const char *val, int); +int decode_arst(pbs_attribute *patr, const char *name, const char *rn, const char *val, int); +int decode_arst_direct(pbs_attribute *patr, const char *val); +int decode_arst_merge(pbs_attribute *,const char *,const char *,const char *); +int decode_resc(pbs_attribute *patr, const char *name, const char *rn, const char *val, int); +int decode_depend(pbs_attribute *patr, const char *name, const char *rn, const char *val, int); +int decode_hold(pbs_attribute *patr, const char *name, const char *rn, const char *val, int); +int decode_uacl(pbs_attribute *patr, const char *name, const char *rn, const char *val, int); +int decode_unkn(pbs_attribute *patr, const char *name, const char *rn, const char *val, int); +int decode_tv(pbs_attribute *patr, const char *name, const char *rescn, const char *val, int); int encode_b(pbs_attribute *attr, tlist_head *phead, const char *atname, const char *rsname, int mode, int perm); @@ -462,10 +462,10 @@ extern int encode_state(pbs_attribute *, tlist_head *, const char *, const extern int encode_props(pbs_attribute*, tlist_head*, const char*, const char*, int, int); extern int encode_jobs(pbs_attribute*, tlist_head*, const char*, const char*, int, int); extern int encode_ntype(pbs_attribute*, tlist_head*, const char*, const char*, int, int); -extern int decode_state(pbs_attribute*, const char*, char*, char*, int); -extern int decode_props(pbs_attribute*, const char*, char*, char*, int); -extern int decode_ntype(pbs_attribute*, const char*, char*, char*, int); -extern int decode_null(pbs_attribute*, const char*, char*, char*, int); +extern int decode_state(pbs_attribute*, const char*, const char*, const char*, int); +extern int decode_props(pbs_attribute*, const char*, const char*, const char*, int); +extern int decode_ntype(pbs_attribute*, const char*, const char*, const char*, int); +extern int decode_null(pbs_attribute*, const char*, const char*, const char*, int); extern int comp_null(pbs_attribute*, pbs_attribute*); extern int count_substrings(char*, int*); extern int set_node_state(pbs_attribute*, pbs_attribute*, enum batch_op); @@ -495,7 +495,7 @@ extern int job_radix_action (pbs_attribute *new_attr, void *pobj, int actmode) /* Token manipulation functions */ -extern int decode_tokens(pbs_attribute *, const char *, char *, char *, int); +extern int decode_tokens(pbs_attribute *, const char *, const char *, const char *, int); int timeval_subtract(struct timeval *result, struct timeval *x, struct timeval *y); diff --git a/src/include/batch_request.h b/src/include/batch_request.h index 4b45d177f6..d0cd6eec36 100644 --- a/src/include/batch_request.h +++ b/src/include/batch_request.h @@ -106,6 +106,7 @@ #include "u_memmgr.h" /* memmgr */ #include "resizable_array.h" #include "hash_table.h" +#include "work_task.h" #define INITIAL_REQUEST_HOLDER_SIZE 20 @@ -439,7 +440,7 @@ extern void req_delete_reservation(struct batch_request *preq); #endif #ifdef SERVER_LIMITS_H -int relay_to_mom (job **, struct batch_request *, void (*func)()); +int relay_to_mom (job **, struct batch_request *, void (*func)(struct work_task *)); #endif /* SERVER_LIMITS_H */ /* PBS Batch Request Decode/Encode routines */ diff --git a/src/include/csv.h b/src/include/csv.h index bbd9358812..f8bb8e1419 100644 --- a/src/include/csv.h +++ b/src/include/csv.h @@ -5,10 +5,10 @@ #ifndef _CSV_H_ #define _CSV_H_ -extern int csv_length(char *csv_str); -extern char *csv_nth(char *csv_str, int n); -extern char *csv_find_string(char *csv_str, const char *search_str); -extern char *csv_find_value(char *csv_str, const char *search_str); +extern int csv_length(const char *csv_str); +extern char *csv_nth(const char *csv_str, int n); +extern char *csv_find_string(const char *csv_str, const char *search_str); +extern char *csv_find_value(const char *csv_str, const char *search_str); /* Note that csv_nth returns a pointer to a static buffer */ diff --git a/src/include/mcom.h b/src/include/mcom.h index df2300a765..e39054e192 100644 --- a/src/include/mcom.h +++ b/src/include/mcom.h @@ -244,7 +244,7 @@ enum MSocketAttrEnum }; -extern int MXMLCreateE(mxml_t **, char *); +extern int MXMLCreateE(mxml_t **, const char *); extern int MXMLAddE(mxml_t *, mxml_t *); extern int MXMLSetVal(mxml_t *, void *, enum MDataFormatEnum); extern int MXMLDestroyE(mxml_t **); diff --git a/src/include/pbs_job.h b/src/include/pbs_job.h index 558344ce2d..40743b89b4 100644 --- a/src/include/pbs_job.h +++ b/src/include/pbs_job.h @@ -1108,7 +1108,7 @@ extern int site_check_user_map(job *, char *, char *, int); int svr_dequejob(job *, int); extern int svr_enquejob(job *, int, int); extern void svr_evaljobstate(job *, int *, int *, int); -extern void svr_mailowner(job *, int, int, char *); +extern void svr_mailowner(job *, int, int, const char *); extern void set_resc_deflt(job *, pbs_attribute *, int); extern void set_statechar(job *); extern int svr_setjobstate(job *, int, int, int); @@ -1122,7 +1122,7 @@ extern int svr_chk_owner(struct batch_request *, job *); extern struct batch_request *cpy_stage(struct batch_request *, job *, enum job_atr, int); extern struct batch_request *setup_cpyfiles(struct batch_request *, job *, char *, char *, int, int); extern struct batch_request *cpy_checkpoint(struct batch_request *, job *, enum job_atr, int); -int issue_signal(job **, char *, void(*)(struct work_task *), void *); +int issue_signal(job **, const char *, void(*)(struct batch_request *), void *); #endif /* BATCH_REQUEST_H */ diff --git a/src/include/pbs_nodes.h b/src/include/pbs_nodes.h index 435b8a50db..aa714fc6d7 100644 --- a/src/include/pbs_nodes.h +++ b/src/include/pbs_nodes.h @@ -348,6 +348,8 @@ struct pbsnode struct AvlNode *node_boards; /* private tree of numa nodes */ char *numa_str; /* comma-delimited string of processor values */ char *gpu_str; /* comma-delimited string of the number of gpus for each nodeboard */ + + unsigned char nd_mom_reported_down;/* notes that the mom reported its own shutdown */ unsigned char nd_is_alps_reporter; unsigned char nd_is_alps_login; @@ -565,7 +567,7 @@ extern int update_nodes_file(struct pbsnode *); extern void bad_node_warning(pbs_net_t, struct pbsnode *); -struct pbsnode *find_nodebyname(char *); +struct pbsnode *find_nodebyname(const char *); struct pbsnode *find_node_in_allnodes(all_nodes *an, char *nodename); int create_partial_pbs_node(char *, unsigned long, int); struct pbssubn *create_subnode(struct pbsnode *pnode); diff --git a/src/include/qmgr.h b/src/include/qmgr.h index 74d0f7ffdf..0aa34b6fdb 100644 --- a/src/include/qmgr.h +++ b/src/include/qmgr.h @@ -116,7 +116,7 @@ void clean_up(); void clean_up_and_exit(int); void freeattrl(struct attrl *); void freeattropl(struct attropl *); -void pstderr_big(char *, char*, char *); +void pstderr_big(const char *, const char*, const char *); void free_objname_list(struct objname *); void free_server(struct server *); void free_objname(struct objname *); @@ -126,7 +126,7 @@ int set_active(int, struct objname *); int get_request(char *); int parse(char *, int *, int *, char **, struct attropl **); int execute(int, int, int, char *, struct attropl *); -int is_attr(int, char *, int); +int is_attr(int, const char *, int); int is_valid_object(struct objname *, int); void disconnect_from_server(); diff --git a/src/include/queue.h b/src/include/queue.h index cd9000437b..bf44e8bf6b 100644 --- a/src/include/queue.h +++ b/src/include/queue.h @@ -175,6 +175,16 @@ extern attribute_def que_attr_def[]; /* at last we come to the queue definition itself */ +typedef struct _queuefix + { + int qu_modified; /* != 0 => update disk file */ + int qu_type; /* queue type: exec, route */ + time_t qu_ctime; /* time queue created */ + time_t qu_mtime; /* time queue last modified */ + char qu_name[PBS_MAXQUEUENAME]; /* queue name */ + } queuefix; + + typedef struct pbs_queue { int q_being_recycled; @@ -186,14 +196,7 @@ typedef struct pbs_queue tlist_head qu_jobs_array_sum; /* jobs with job arrays summarized */ #endif - struct queuefix - { - int qu_modified; /* != 0 => update disk file */ - int qu_type; /* queue type: exec, route */ - time_t qu_ctime; /* time queue created */ - time_t qu_mtime; /* time queue last modified */ - char qu_name[PBS_MAXQUEUENAME]; /* queue name */ - } qu_qs; + queuefix qu_qs; pthread_mutex_t *qu_mutex; /* this queue's mutex */ diff --git a/src/include/resource.h b/src/include/resource.h index d9aed88bc2..7be36851f6 100644 --- a/src/include/resource.h +++ b/src/include/resource.h @@ -119,7 +119,7 @@ typedef struct resource typedef struct resource_def { const char *rs_name; - int (*rs_decode)(pbs_attribute *, const char *, char *, char *, int); + int (*rs_decode)(pbs_attribute *, const char *, const char *, const char *, int); int (*rs_encode)(pbs_attribute *, tlist_head *, const char *, const char *, int, int); int (*rs_set)(pbs_attribute *, pbs_attribute *, enum batch_op); int (*rs_comp)(pbs_attribute *, pbs_attribute *); diff --git a/src/include/server.h b/src/include/server.h index 059703dac5..f2e53b2eaa 100644 --- a/src/include/server.h +++ b/src/include/server.h @@ -208,18 +208,21 @@ enum srv_atr }; extern attribute_def svr_attr_def[]; +typedef struct _server_qs + { + int sv_numjobs; /* number of job owned by server */ + int sv_numque; /* nuber of queues managed */ + int sv_jobidnumber; /* next number to use in new jobid */ + /* the server struct must be saved */ + /* whenever this value is updated */ + time_t sv_savetm; /* time of server db update */ + } server_qs; + + struct server { - struct server_qs - { - int sv_numjobs; /* number of job owned by server */ - int sv_numque; /* nuber of queues managed */ - int sv_jobidnumber; /* next number to use in new jobid */ - /* the server struct must be saved */ - /* whenever this value is updated */ - time_t sv_savetm; /* time of server db update */ - } sv_qs; + server_qs sv_qs; pthread_mutex_t *sv_qs_mutex; pthread_mutex_t *sv_attr_mutex; diff --git a/src/include/u_hash_map_structs.h b/src/include/u_hash_map_structs.h index d67a5f2904..e37be28b5a 100644 --- a/src/include/u_hash_map_structs.h +++ b/src/include/u_hash_map_structs.h @@ -112,15 +112,15 @@ typedef struct job_data UT_hash_handle hh; } job_data; -int hash_add_item(memmgr **mm, job_data **head, char *name, char *value, int var_type, int op_type); +int hash_add_item(memmgr **mm, job_data **head, const char *name, const char *value, int var_type, int op_type); -void hash_add_or_exit(memmgr **mm, job_data **head, char *name, char *value, int var_type); +void hash_add_or_exit(memmgr **mm, job_data **head, const char *name, const char *value, int var_type); -int hash_del_item(memmgr **mm, job_data **head, char *name); +int hash_del_item(memmgr **mm, job_data **head, const char *name); int hash_clear(memmgr **mm, job_data **head); -int hash_find(job_data *head, char *name, job_data **env_var); +int hash_find(job_data *head, const char *name, job_data **env_var); int hash_count(job_data *head); diff --git a/src/include/uthash.h b/src/include/uthash.h index 55cb6978a8..d9ee30d0a6 100644 --- a/src/include/uthash.h +++ b/src/include/uthash.h @@ -308,8 +308,8 @@ do { #define HASH_EMIT_KEY(hh,head,keyptr,fieldlen) \ do { \ unsigned _klen = fieldlen; \ - write(HASH_EMIT_KEYS, &_klen, sizeof(_klen)); \ - write(HASH_EMIT_KEYS, keyptr, fieldlen); \ + write_ac_socket(HASH_EMIT_KEYS, &_klen, sizeof(_klen)); \ + write_ac_socket(HASH_EMIT_KEYS, keyptr, fieldlen); \ } while (0) #else #define HASH_EMIT_KEY(hh,head,keyptr,fieldlen) diff --git a/src/lib/Libattr/attr_fn_arst.c b/src/lib/Libattr/attr_fn_arst.c index a0ad1b5d9f..60bcd2c7c1 100644 --- a/src/lib/Libattr/attr_fn_arst.c +++ b/src/lib/Libattr/attr_fn_arst.c @@ -119,7 +119,7 @@ int decode_arst_direct( pbs_attribute *patr, /* I (modified) */ - char *val) /* I */ + const char *val) /* I */ { unsigned long bksize; @@ -266,8 +266,8 @@ int decode_arst( pbs_attribute *patr, /* O (modified) */ const char *name, /* I pbs_attribute name (notused) */ - char *rescn, /* I resource name (notused) */ - char *val, /* I pbs_attribute value */ + const char *rescn, /* I resource name (notused) */ + const char *val, /* I pbs_attribute value */ int perm) /* only used for resources */ { @@ -331,8 +331,8 @@ int decode_arst_merge( pbs_attribute *patr, /* O (modified) */ const char *name, /* I pbs_attribute name (notused) */ - char *rescn, /* I resource name (notused) */ - char *val) /* I pbs_attribute value */ + const char *rescn, /* I resource name (notused) */ + const char *val) /* I pbs_attribute value */ { int rc; diff --git a/src/lib/Libattr/attr_fn_arst.h b/src/lib/Libattr/attr_fn_arst.h index 856034b71d..d7fdc0ab1f 100644 --- a/src/lib/Libattr/attr_fn_arst.h +++ b/src/lib/Libattr/attr_fn_arst.h @@ -4,11 +4,9 @@ #include "list_link.h" /* tlist_head */ #include "pbs_ifl.h" /* batch_op */ -int decode_arst_direct( struct pbs_attribute *patr, char *val); +int decode_arst_direct( struct pbs_attribute *patr, const char *val); -int decode_arst( struct pbs_attribute *patr, const char *name, char *rescn, char *val, int perm); - -int decode_arst_merge( struct pbs_attribute *patr, const char *name, char *rescn, char *val); +int decode_arst( struct pbs_attribute *patr, const char *name, const char *rescn, const char *val, int perm); int encode_arst( pbs_attribute *attr, tlist_head *phead, const char *atname, const char *rsname, int mode, int perm); diff --git a/src/lib/Libattr/attr_fn_b.c b/src/lib/Libattr/attr_fn_b.c index a1ece928bb..b9718b3978 100644 --- a/src/lib/Libattr/attr_fn_b.c +++ b/src/lib/Libattr/attr_fn_b.c @@ -112,8 +112,8 @@ * ------------------------------------------------------- */ -static char true_val[] = ATR_TRUE; -static char false_val[] = ATR_FALSE; +static const char *true_val = ATR_TRUE; +static const char *false_val = ATR_FALSE; /* * decode_b - decode string into boolean pbs_attribute @@ -128,8 +128,8 @@ int decode_b( pbs_attribute *patr, const char *name, /* pbs_attribute name */ - char *rescn, /* resource name, unused here */ - char *val, /* pbs_attribute value */ + const char *rescn, /* resource name, unused here */ + const char *val, /* pbs_attribute value */ int perm) /* only used for resources */ { @@ -143,7 +143,7 @@ int decode_b( } else { - for (pc = val; *pc; pc++) + for (pc = (char *)val; *pc; pc++) *pc = (char)toupper((int) * pc); if ((strcmp(val, true_val) == 0) || @@ -194,7 +194,7 @@ int encode_b( { size_t ct; svrattrl *pal; - char *value; + const char *value; if (!attr) return (-1); diff --git a/src/lib/Libattr/attr_fn_b.h b/src/lib/Libattr/attr_fn_b.h index 23aa746586..b2295114f1 100644 --- a/src/lib/Libattr/attr_fn_b.h +++ b/src/lib/Libattr/attr_fn_b.h @@ -4,7 +4,7 @@ #include "list_link.h" /* tlist_head */ #include "pbs_ifl.h" /* batch_op */ -int decode_b(pbs_attribute *patr, const char *name, char *rescn, char *val, int perm); +int decode_b(pbs_attribute *patr, const char *name, const char *rescn, const char *val, int perm); int encode_b(pbs_attribute *attr, tlist_head *phead, const char *atname, const char *rsname, int mode, int perm); diff --git a/src/lib/Libattr/attr_fn_c.c b/src/lib/Libattr/attr_fn_c.c index d77c9776f6..35c4b45576 100644 --- a/src/lib/Libattr/attr_fn_c.c +++ b/src/lib/Libattr/attr_fn_c.c @@ -124,8 +124,8 @@ int decode_c( pbs_attribute *patr, const char *name, /* pbs_attribute name */ - char *rescn, /* resource name, unused here */ - char *val, /* pbs_attribute value */ + const char *rescn, /* resource name, unused here */ + const char *val, /* pbs_attribute value */ int perm) /* only used for resources */ { diff --git a/src/lib/Libattr/attr_fn_c.h b/src/lib/Libattr/attr_fn_c.h index 2037da2789..c342acdeb7 100644 --- a/src/lib/Libattr/attr_fn_c.h +++ b/src/lib/Libattr/attr_fn_c.h @@ -4,7 +4,7 @@ #include "list_link.h" /* tlist_head */ #include "pbs_ifl.h" /* batch_op */ -int decode_c( pbs_attribute *patr, const char *name, char *rescn, char *val, int perm); +int decode_c( pbs_attribute *patr, const char *name, const char *rescn, const char *val, int perm); int encode_c( pbs_attribute *attr, tlist_head *phead, const char *atname, const char *rsname, int mode, int perm); diff --git a/src/lib/Libattr/attr_fn_hold.c b/src/lib/Libattr/attr_fn_hold.c index e6d199c6df..181f4488c8 100644 --- a/src/lib/Libattr/attr_fn_hold.c +++ b/src/lib/Libattr/attr_fn_hold.c @@ -111,12 +111,12 @@ int decode_hold( pbs_attribute *patr, const char *name, /* pbs_attribute name */ - char *rescn, /* resource name - unused here */ - char *val, /* pbs_attribute value */ + const char *rescn, /* resource name - unused here */ + const char *val, /* pbs_attribute value */ int perm) /* only used for resources */ { - char *pc; + const char *pc; patr->at_val.at_long = 0; diff --git a/src/lib/Libattr/attr_fn_hold.h b/src/lib/Libattr/attr_fn_hold.h index ebddd56cb1..9b5d335073 100644 --- a/src/lib/Libattr/attr_fn_hold.h +++ b/src/lib/Libattr/attr_fn_hold.h @@ -3,7 +3,7 @@ #include "attribute.h" /* pbs_attribute */ #include "list_link.h" /* tlist_head */ -int decode_hold( pbs_attribute *patr, const char *name, char *rescn, char *val, int perm); +int decode_hold( pbs_attribute *patr, const char *name, const char *rescn, const char *val, int perm); int encode_hold( pbs_attribute *attr, tlist_head *phead, const char *atname, const char *rsname, int mode, int perm); diff --git a/src/lib/Libattr/attr_fn_l.c b/src/lib/Libattr/attr_fn_l.c index e9d6e6d339..859623ed09 100644 --- a/src/lib/Libattr/attr_fn_l.c +++ b/src/lib/Libattr/attr_fn_l.c @@ -123,12 +123,12 @@ int decode_l( pbs_attribute *patr, const char *name, /* pbs_attribute name */ - char *rescn, /* resource name, unused here */ - char *val, /* pbs_attribute value */ + const char *rescn, /* resource name, unused here */ + const char *val, /* pbs_attribute value */ int perm) /* only used for resources */ { - char *pc; + const char *pc; if ((val != (char *)0) && (strlen(val) != 0)) { diff --git a/src/lib/Libattr/attr_fn_l.h b/src/lib/Libattr/attr_fn_l.h index 5075f800cf..ccc989d356 100644 --- a/src/lib/Libattr/attr_fn_l.h +++ b/src/lib/Libattr/attr_fn_l.h @@ -4,7 +4,7 @@ #include "list_link.h" /* tlist_head */ #include "pbs_ifl.h" /* batch_op */ -int decode_l( pbs_attribute *patr, const char *name, char *rescn, char *val, int perm); +int decode_l( pbs_attribute *patr, const char *name, const char *rescn, const char *val, int perm); int encode_l( pbs_attribute *attr, tlist_head *phead, const char *atname, const char *rsname, int mode, int perm); diff --git a/src/lib/Libattr/attr_fn_ll.c b/src/lib/Libattr/attr_fn_ll.c index 8f36e1894e..c686464a1f 100644 --- a/src/lib/Libattr/attr_fn_ll.c +++ b/src/lib/Libattr/attr_fn_ll.c @@ -49,8 +49,8 @@ int decode_ll( pbs_attribute *patr, const char *name, /* pbs_attribute name */ - char *rescn, /* resource name, unused here */ - char *val, /* pbs_attribute value */ + const char *rescn, /* resource name, unused here */ + const char *val, /* pbs_attribute value */ int perm) /* only used for resources */ { diff --git a/src/lib/Libattr/attr_fn_ll.h b/src/lib/Libattr/attr_fn_ll.h index c78dfcf8ca..b2f1bd3275 100644 --- a/src/lib/Libattr/attr_fn_ll.h +++ b/src/lib/Libattr/attr_fn_ll.h @@ -4,7 +4,7 @@ #include "list_link.h" /* tlist_head */ #include "pbs_ifl.h" /* batch_op */ -int decode_ll(pbs_attribute *patr, const char *name, char *rescn, char *val, int perm); +int decode_ll(pbs_attribute *patr, const char *name, const char *rescn, const char *val, int perm); int encode_ll(pbs_attribute *attr, tlist_head *phead, const char *atname, const char *rsname, int mode, int perm); diff --git a/src/lib/Libattr/attr_fn_resc.c b/src/lib/Libattr/attr_fn_resc.c index 6ec092caf3..f123d1830f 100644 --- a/src/lib/Libattr/attr_fn_resc.c +++ b/src/lib/Libattr/attr_fn_resc.c @@ -138,8 +138,8 @@ int decode_resc( pbs_attribute *patr, /* Modified on Return */ const char *name, /* pbs_attribute name */ - char *rescn, /* I resource name - is used here */ - char *val, /* resource value */ + const char *rescn, /* I resource name - is used here */ + const char *val, /* resource value */ int perm) /* access permissions */ { diff --git a/src/lib/Libattr/attr_fn_resc.h b/src/lib/Libattr/attr_fn_resc.h index c5085cad33..5d4eccc473 100644 --- a/src/lib/Libattr/attr_fn_resc.h +++ b/src/lib/Libattr/attr_fn_resc.h @@ -5,7 +5,7 @@ #include "pbs_ifl.h" /* batch_op */ #include "resource.h" /* resource_def */ -int decode_resc(struct pbs_attribute *patr, const char *name, char *rescn, char *val, int perm); +int decode_resc(struct pbs_attribute *patr, const char *name, const char *rescn, const char *val, int perm); int encode_resc(pbs_attribute *attr, tlist_head *phead, const char *atname, const char *rsname, int mode, int ac_perm); diff --git a/src/lib/Libattr/attr_fn_size.c b/src/lib/Libattr/attr_fn_size.c index 87cd3106c5..1af3cfe39a 100644 --- a/src/lib/Libattr/attr_fn_size.c +++ b/src/lib/Libattr/attr_fn_size.c @@ -113,7 +113,7 @@ */ -int to_size(char *, struct size_value *); +int to_size(const char *, struct size_value *); void from_size(struct size_value *, char *); int normalize_size(struct size_value *a, struct size_value *b, struct size_value *c, struct size_value *d); @@ -130,8 +130,8 @@ int decode_size( pbs_attribute *patr, const char *name, /* pbs_attribute name */ - char *rescn, /* resource name, unused here */ - char *val, /* pbs_attribute value */ + const char *rescn, /* resource name, unused here */ + const char *val, /* pbs_attribute value */ int perm) /* only used for resources */ { @@ -423,7 +423,7 @@ normalize_size(struct size_value *a, struct size_value *b, struct size_value *ta int to_size( - char *val, /* I */ + const char *val, /* I */ struct size_value *psize) /* O */ { diff --git a/src/lib/Libattr/attr_fn_size.h b/src/lib/Libattr/attr_fn_size.h index 513c2a6f9c..c924be9d1a 100644 --- a/src/lib/Libattr/attr_fn_size.h +++ b/src/lib/Libattr/attr_fn_size.h @@ -4,7 +4,7 @@ #include "list_link.h" /* tlist_head */ #include "pbs_ifl.h" /* batch_op */ -int decode_size(pbs_attribute *patr, const char *name, char *rescn, char *val, int perm); +int decode_size(pbs_attribute *patr, const char *name, const char *rescn, const char *val, int perm); int encode_size(pbs_attribute *attr, tlist_head *phead, const char *atname, const char *rsname, int mode, int perm); diff --git a/src/lib/Libattr/attr_fn_str.c b/src/lib/Libattr/attr_fn_str.c index 33ff394045..c7abb9b554 100644 --- a/src/lib/Libattr/attr_fn_str.c +++ b/src/lib/Libattr/attr_fn_str.c @@ -126,8 +126,8 @@ int decode_str( pbs_attribute *patr, /* (I modified, allocated ) */ const char *name, /* (I - optional) pbs_attribute name */ - char *rescn, /* resource name - unused here */ - char *val, /* pbs_attribute value */ + const char *rescn, /* resource name - unused here */ + const char *val, /* pbs_attribute value */ int perm) /* only used for resources */ { diff --git a/src/lib/Libattr/attr_fn_str.h b/src/lib/Libattr/attr_fn_str.h index 306f348729..ffd633157a 100644 --- a/src/lib/Libattr/attr_fn_str.h +++ b/src/lib/Libattr/attr_fn_str.h @@ -4,7 +4,7 @@ #include "list_link.h" /* tlist_head */ #include "pbs_ifl.h" /* batch_op */ -int decode_str(pbs_attribute *patr, const char *name, char *rescn, char *val, int perm); +int decode_str(pbs_attribute *patr, const char *name, const char *rescn, const char *val, int perm); int encode_str(pbs_attribute *attr, tlist_head *phead, const char *atname, const char *rsname, int mode, int perm); diff --git a/src/lib/Libattr/attr_fn_time.c b/src/lib/Libattr/attr_fn_time.c index d85492582f..e7daff0c20 100644 --- a/src/lib/Libattr/attr_fn_time.c +++ b/src/lib/Libattr/attr_fn_time.c @@ -126,8 +126,8 @@ int decode_time( pbs_attribute *patr, /* I/O (modified) */ const char *name, /* I - pbs_attribute name (not used) */ - char *rescn, /* I - resource name (not used) */ - char *val, /* I - pbs_attribute value */ + const char *rescn, /* I - resource name (not used) */ + const char *val, /* I - pbs_attribute value */ int perm) /* only used for resources */ { diff --git a/src/lib/Libattr/attr_fn_time.h b/src/lib/Libattr/attr_fn_time.h index d6d4622a76..550923d6ce 100644 --- a/src/lib/Libattr/attr_fn_time.h +++ b/src/lib/Libattr/attr_fn_time.h @@ -3,7 +3,7 @@ #include "attribute.h" /* pbs_attribute */ #include "list_link.h" /* tlist_head */ -int decode_time(pbs_attribute *patr, const char *name, char *rescn, char *val, int perm); +int decode_time(pbs_attribute *patr, const char *name, const char *rescn, const char *val, int perm); int encode_time(pbs_attribute *attr, tlist_head *phead, const char *atname, const char *rsname, int mode, int perm); diff --git a/src/lib/Libattr/attr_fn_tokens.c b/src/lib/Libattr/attr_fn_tokens.c index f813187c72..5ba27d6d27 100644 --- a/src/lib/Libattr/attr_fn_tokens.c +++ b/src/lib/Libattr/attr_fn_tokens.c @@ -22,8 +22,8 @@ int decode_tokens( pbs_attribute *patr, const char *name, /* pbs_attribute name */ - char *rescn, /* resource name, unused here */ - char *val, /* pbs_attribute value */ + const char *rescn, /* resource name, unused here */ + const char *val, /* pbs_attribute value */ int perm) /* only used for resources */ @@ -35,7 +35,7 @@ int decode_tokens( if (val != NULL) { ret = PBSE_BADATVAL; /* Assume bad until proven otherwise */ - colon = strstr(val, ":"); + colon = strstr((char *)val, ":"); if (colon != NULL) { diff --git a/src/lib/Libattr/attr_fn_tokens.h b/src/lib/Libattr/attr_fn_tokens.h index c045917ab1..f52e540efd 100644 --- a/src/lib/Libattr/attr_fn_tokens.h +++ b/src/lib/Libattr/attr_fn_tokens.h @@ -2,5 +2,5 @@ #include "attribute.h" /* pbs_attribute */ -int decode_tokens(pbs_attribute *patr, const char *name, char *rescn, char *val, int perm); +int decode_tokens(pbs_attribute *patr, const char *name, const char *rescn, const char *val, int perm); diff --git a/src/lib/Libattr/attr_fn_tv.c b/src/lib/Libattr/attr_fn_tv.c index 2f3b07f5c6..21cc27c334 100644 --- a/src/lib/Libattr/attr_fn_tv.c +++ b/src/lib/Libattr/attr_fn_tv.c @@ -127,8 +127,8 @@ int decode_tv( pbs_attribute *patr, const char *name, /* pbs_attribute name */ - char *rescn, /* resource name*/ - char *val, /* pbs_attribute value */ + const char *rescn, /* resource name*/ + const char *val, /* pbs_attribute value */ int perm) /* only used for resources */ { diff --git a/src/lib/Libattr/attr_fn_tv.h b/src/lib/Libattr/attr_fn_tv.h index a507165fdc..93790fcece 100644 --- a/src/lib/Libattr/attr_fn_tv.h +++ b/src/lib/Libattr/attr_fn_tv.h @@ -7,7 +7,7 @@ int timeval_subtract(struct timeval *result, struct timeval *x, struct timeval *y); -int decode_tv(pbs_attribute *patr, const char *name, char *rescn, char *val, int perm); +int decode_tv(pbs_attribute *patr, const char *name, const char *rescn, const char *val, int perm); int encode_tv(pbs_attribute *attr, tlist_head *phead, const char *atname, const char *rsname, int mode, int perm); diff --git a/src/lib/Libattr/attr_fn_unkn.c b/src/lib/Libattr/attr_fn_unkn.c index e7cb991ca4..b234299451 100644 --- a/src/lib/Libattr/attr_fn_unkn.c +++ b/src/lib/Libattr/attr_fn_unkn.c @@ -130,8 +130,8 @@ int decode_unkn( pbs_attribute *patr, /* May be Modified on Return */ const char *name, - char *rescn, - char *value, + const char *rescn, + const char *value, int perm) /* only used for resources */ { diff --git a/src/lib/Libattr/attr_fn_unkn.h b/src/lib/Libattr/attr_fn_unkn.h index b296ae8eaf..0aa0a1267f 100644 --- a/src/lib/Libattr/attr_fn_unkn.h +++ b/src/lib/Libattr/attr_fn_unkn.h @@ -4,8 +4,6 @@ #include "list_link.h" /* tlist_head */ #include "pbs_ifl.h" /* batch_op */ -int decode_unkn(pbs_attribute *patr, const char *name, char *rescn, char *value, int perm); - int encode_unkn(pbs_attribute *attr, tlist_head *phead, const char *atname, const char *rsname, int mode, int perm); int set_unkn(struct pbs_attribute *old, struct pbs_attribute *new, enum batch_op op); diff --git a/src/lib/Libattr/attr_func.c b/src/lib/Libattr/attr_func.c index 945e7dd062..7fc4b50634 100644 --- a/src/lib/Libattr/attr_func.c +++ b/src/lib/Libattr/attr_func.c @@ -179,7 +179,7 @@ static int str_nc_cmp( int find_attr( struct attribute_def *attr_def, /* ptr to pbs_attribute definitions */ - char *name, /* pbs_attribute name to find */ + const char *name, /* pbs_attribute name to find */ int limit) /* limit on size of def array */ { diff --git a/src/lib/Libattr/attr_func.h b/src/lib/Libattr/attr_func.h index 6a71e05e73..c92eaf8bf5 100644 --- a/src/lib/Libattr/attr_func.h +++ b/src/lib/Libattr/attr_func.h @@ -5,7 +5,7 @@ void clear_attr(pbs_attribute *pattr, attribute_def *pdef); -int find_attr(struct attribute_def *attr_def, char *name, int limit); +int find_attr(struct attribute_def *attr_def, const char *name, int limit); long attr_ifelse_long(pbs_attribute *attr1, pbs_attribute *attr2, long deflong); diff --git a/src/lib/Libattr/attr_node_func.c b/src/lib/Libattr/attr_node_func.c index 6ab1818a57..cbd10f9361 100644 --- a/src/lib/Libattr/attr_node_func.c +++ b/src/lib/Libattr/attr_node_func.c @@ -554,8 +554,8 @@ int decode_state( pbs_attribute *pattr, /* I (modified) */ const char *name, /* pbs_attribute name */ - char *rescn, /* resource name, unused here */ - char *val, /* pbs_attribute value */ + const char *rescn, /* resource name, unused here */ + const char *val, /* pbs_attribute value */ int perm) /* only used for resources */ { @@ -664,8 +664,8 @@ int decode_ntype( pbs_attribute *pattr, const char *name, /* pbs_attribute name */ - char *rescn, /* resource name, unused here */ - char *val, /* pbs_attribute value */ + const char *rescn, /* resource name, unused here */ + const char *val, /* pbs_attribute value */ int perm) /* only used for resources */ diff --git a/src/lib/Libattr/attr_node_func.h b/src/lib/Libattr/attr_node_func.h index 473e0e46aa..27f4407dae 100644 --- a/src/lib/Libattr/attr_node_func.h +++ b/src/lib/Libattr/attr_node_func.h @@ -14,9 +14,9 @@ int encode_ntype(pbs_attribute *pattr, tlist_head *ph, const char *aname, const int encode_jobs(pbs_attribute *pattr, tlist_head *ph, const char *aname, const char *rname, int mode, int perm); -int decode_state(pbs_attribute *pattr, const char *name, char *rescn, char *val, int perm); +int decode_state(pbs_attribute *pattr, const char *name, const char *rescn, const char *val, int perm); -int decode_ntype(pbs_attribute *pattr, const char *name, char *rescn, char *val, int perm); +int decode_ntype(pbs_attribute *pattr, const char *name, const char *rescn, const char *val, int perm); void free_prop_list(struct prop *prop); diff --git a/src/lib/Libattr/test/attr_atomic/scaffolding.c b/src/lib/Libattr/test/attr_atomic/scaffolding.c index 21b07ad48e..4013708c88 100644 --- a/src/lib/Libattr/test/attr_atomic/scaffolding.c +++ b/src/lib/Libattr/test/attr_atomic/scaffolding.c @@ -11,7 +11,7 @@ void clear_attr(pbs_attribute *pattr, attribute_def *pdef) exit(1); } -int find_attr(struct attribute_def *attr_def, char *name, int limit) +int find_attr(struct attribute_def *attr_def, const char *name, int limit) { fprintf(stderr, "The call to find_attr needs to be mocked!!\n"); exit(1); diff --git a/src/lib/Libattr/test/attr_fn_tokens/scaffolding.c b/src/lib/Libattr/test/attr_fn_tokens/scaffolding.c index 8d584febcb..9570dcddc2 100644 --- a/src/lib/Libattr/test/attr_fn_tokens/scaffolding.c +++ b/src/lib/Libattr/test/attr_fn_tokens/scaffolding.c @@ -4,7 +4,7 @@ #include "attribute.h" /* pbs_attribute */ -int decode_str(pbs_attribute *patr, const char *name, char *rescn, char *val, int perm) +int decode_str(pbs_attribute *patr, const char *name, const char *rescn, const char *val, int perm) { fprintf(stderr, "The call to decode_str needs to be mocked!!\n"); exit(1); diff --git a/src/lib/Libcmds/test/add_verify_resources/scaffolding.c b/src/lib/Libcmds/test/add_verify_resources/scaffolding.c index 60c794848d..114f3d6142 100644 --- a/src/lib/Libcmds/test/add_verify_resources/scaffolding.c +++ b/src/lib/Libcmds/test/add_verify_resources/scaffolding.c @@ -11,7 +11,7 @@ void *memmgr_calloc(memmgr **mgr, int qty, int size) exit(1); } -void hash_add_or_exit(memmgr **mm, job_data **head, char *name, char *value, int var_type) +void hash_add_or_exit(memmgr **mm, job_data **head, const char *name, const char *value, int var_type) { fprintf(stderr, "The call to hash_add_or_exit needs to be mocked!!\n"); exit(1); diff --git a/src/lib/Libcsv/csv.c b/src/lib/Libcsv/csv.c index 15729198f4..e368e6364a 100644 --- a/src/lib/Libcsv/csv.c +++ b/src/lib/Libcsv/csv.c @@ -16,10 +16,10 @@ * @param csv_str The string list. * @return The number of items in the list. */ -int csv_length(char *csv_str) +int csv_length(const char *csv_str) { int length = 0; - char *cp; + const char *cp; if (!csv_str || *csv_str == 0) return(0); @@ -47,10 +47,10 @@ int csv_length(char *csv_str) * otherwise, a pointer to a local buffer containing the nth item. */ #define NBUFFERS 32 -char *csv_nth(char *csv_str, int n) +char *csv_nth(const char *csv_str, int n) { int i; - char *cp; + const char *cp; char *tp; static char buffer[NBUFFERS][128]; static int buffer_index; @@ -77,7 +77,7 @@ char *csv_nth(char *csv_str, int n) memset(buffer[buffer_index], 0, sizeof(buffer[buffer_index])); - if ((tp = strchr(cp, ','))) + if ((tp = strchr((char *)cp, ','))) { if ((tp - cp) > 128) return 0; @@ -100,7 +100,7 @@ char *csv_nth(char *csv_str, int n) * Search a csv list for an entry that matches a specified search string. */ char * -csv_find_string(char *csv_str, const char *search_str) +csv_find_string(const char *csv_str, const char *search_str) { int i; int nitems; @@ -144,7 +144,7 @@ csv_find_string(char *csv_str, const char *search_str) * pointer to the start of the value string. */ char * -csv_find_value(char *csv_str, const char *search_str) +csv_find_value(const char *csv_str, const char *search_str) { char *cp; char *vp; diff --git a/src/lib/Libcsv/csv.h b/src/lib/Libcsv/csv.h index deb2a134f0..fea8e958fc 100644 --- a/src/lib/Libcsv/csv.h +++ b/src/lib/Libcsv/csv.h @@ -1,9 +1,9 @@ #include "license_pbs.h" /* See here for the software license */ -int csv_length(char *csv_str); +int csv_length(const char *csv_str); -char *csv_nth(char *csv_str, int n); +char *csv_nth(const char *csv_str, int n); -char * csv_find_string(char *csv_str, const char *search_str); +char * csv_find_string(const char *csv_str, const char *search_str); -char * csv_find_value(char *csv_str, const char *search_str); +char * csv_find_value(const char *csv_str, const char *search_str); diff --git a/src/lib/Libifl/PBSD_submit_caps.c b/src/lib/Libifl/PBSD_submit_caps.c index c66cc338e9..86c4695fc0 100644 --- a/src/lib/Libifl/PBSD_submit_caps.c +++ b/src/lib/Libifl/PBSD_submit_caps.c @@ -87,6 +87,7 @@ #include "dis.h" #include "u_hash_map_structs.h" #include "u_memmgr.h" +#include "../lib/Libifl/lib_ifl.h" /* PBSD_submit.c @@ -382,12 +383,12 @@ int PBSD_jscript( i = 0; - cc = read(fd, s_buf, SCRIPT_CHUNK_Z); + cc = read_ac_socket(fd, s_buf, SCRIPT_CHUNK_Z); while ((cc > 0) && (PBSD_scbuf(c, PBS_BATCH_jobscript, i, s_buf, cc, jobid, JScript) == 0)) { i++; - cc = read(fd, s_buf, SCRIPT_CHUNK_Z); + cc = read_ac_socket(fd, s_buf, SCRIPT_CHUNK_Z); } close(fd); @@ -441,14 +442,14 @@ int PBSD_jobfile( i = 0; - cc = read(fd, s_buf, SCRIPT_CHUNK_Z); + cc = read_ac_socket(fd, s_buf, SCRIPT_CHUNK_Z); while ((cc > 0) && (PBSD_scbuf(c, req_type, i, s_buf, cc, jobid, which) == 0)) { i++; - cc = read(fd, s_buf, SCRIPT_CHUNK_Z); + cc = read_ac_socket(fd, s_buf, SCRIPT_CHUNK_Z); } close(fd); diff --git a/src/lib/Libifl/lib_ifl.h b/src/lib/Libifl/lib_ifl.h index 2d1a413291..0cb2c132d5 100644 --- a/src/lib/Libifl/lib_ifl.h +++ b/src/lib/Libifl/lib_ifl.h @@ -232,6 +232,9 @@ void free_pidlist(struct pidl *pl); /* nonblock.c */ /* ssize_t write_nonblocking_socket(int fd, const void *buf, ssize_t count); */ /* ssize_t read_nonblocking_socket(int fd, void *buf, ssize_t count); */ +extern ssize_t write_ac_socket(int, const void *, ssize_t); +extern ssize_t read_ac_socket(int, void *, ssize_t); + ssize_t read_blocking_socket(int fd, void *buf, ssize_t count); /* pbsD_alterjo.c */ @@ -427,7 +430,7 @@ int rpp_get_stream_state(int index); /* tcp_dis.c */ void DIS_tcp_settimeout(long timeout); /* static void tcp_pack_buff(struct tcpdisbuf *tp); */ -int tcp_read(struct tcp_chan *chan, long *read_len, long *avail_len); +int tcp_read(struct tcp_chan *chan, long long *read_len, long long *avail_len); int DIS_tcp_wflush(struct tcp_chan *chan); /* static void DIS_tcp_clear(struct tcpdisbuf *tp); */ void DIS_tcp_reset(struct tcp_chan *chan, int i); diff --git a/src/lib/Libifl/nonblock.c b/src/lib/Libifl/nonblock.c index 12f349e31c..2f75bdd4ec 100644 --- a/src/lib/Libifl/nonblock.c +++ b/src/lib/Libifl/nonblock.c @@ -3,6 +3,10 @@ * Headers redefine read/write to name these instead, before inclusion * of stdio.h, so system declaration is used. */ + +#define NEED_BLOCKING_CONNECTIONS +#include /* the master config generated by configure */ + #include #include #include @@ -13,7 +17,7 @@ * this would have had to be handled by the main pbs code anyway. */ -ssize_t write_nonblocking_socket( +ssize_t write_ac_socket( int fd, /* I */ const void *buf, /* I */ @@ -63,8 +67,7 @@ ssize_t write_nonblocking_socket( - -ssize_t read_nonblocking_socket( +ssize_t read_ac_socket( int fd, void *buf, diff --git a/src/lib/Libifl/pbsD_connect.c b/src/lib/Libifl/pbsD_connect.c index bbac7ecdd7..a552f42fac 100644 --- a/src/lib/Libifl/pbsD_connect.c +++ b/src/lib/Libifl/pbsD_connect.c @@ -417,7 +417,7 @@ int PBSD_munge_authenticate( fd = fileno(munge_pipe); - while ((bytes_read = read(fd, ptr, MUNGE_SIZE - total_bytes_read)) > 0) + while ((bytes_read = read_ac_socket(fd, ptr, MUNGE_SIZE - total_bytes_read)) > 0) { total_bytes_read += bytes_read; ptr += bytes_read; @@ -1405,7 +1405,7 @@ int pbs_disconnect_socket( /* wait for server to close connection */ /* NOTE: if read of 'sock' is blocking, request below may hang forever -- hence the signal handler above */ - if (read(sock, &tmp_buf, sizeof(tmp_buf)) < 1) + if (read_ac_socket(sock, &tmp_buf, sizeof(tmp_buf)) < 1) break; } diff --git a/src/lib/Libifl/tcp_dis.c b/src/lib/Libifl/tcp_dis.c index 5a240308f7..54480e7aab 100644 --- a/src/lib/Libifl/tcp_dis.c +++ b/src/lib/Libifl/tcp_dis.c @@ -88,6 +88,8 @@ #include #include #include +#include "../lib/Libifl/lib_ifl.h" /* DIS_tcp_setup, DIS_tcp_cleanup */ + #if defined(FD_SET_IN_SYS_SELECT_H) # include @@ -325,7 +327,7 @@ int DIS_tcp_wflush( if (rc != PBSE_NONE) return(-1); - while ((i = write(chan->sock, pb, ct)) != (ssize_t)ct) + while ((i = write_ac_socket(chan->sock, pb, ct)) != (ssize_t)ct) { if (i == -1) { diff --git a/src/lib/Libifl/test/PBSD_submit_caps/scaffolding.c b/src/lib/Libifl/test/PBSD_submit_caps/scaffolding.c index eb543c6593..264f57cd7a 100644 --- a/src/lib/Libifl/test/PBSD_submit_caps/scaffolding.c +++ b/src/lib/Libifl/test/PBSD_submit_caps/scaffolding.c @@ -88,3 +88,8 @@ int encode_DIS_ReqHdr(struct tcp_chan *chan, int reqt, char *user) void DIS_tcp_cleanup(struct tcp_chan *chan) { } + +ssize_t read_ac_socket(int fd, void *buf, ssize_t count) + { + return(0); + } diff --git a/src/lib/Libifl/test/dec_CpyFil/scaffolding.c b/src/lib/Libifl/test/dec_CpyFil/scaffolding.c index c2cc4e3f4a..9961f8a209 100644 --- a/src/lib/Libifl/test/dec_CpyFil/scaffolding.c +++ b/src/lib/Libifl/test/dec_CpyFil/scaffolding.c @@ -22,7 +22,7 @@ char *disrst(int stream, int *retval) exit(1); } -void append_link(tlist_head *head, list_link *new, void *pobj) +void append_link(tlist_head *head, list_link *newLink, void *pobj) { fprintf(stderr, "The call to append_link needs to be mocked!!\n"); exit(1); diff --git a/src/lib/Libifl/test/dec_rpys/scaffolding.c b/src/lib/Libifl/test/dec_rpys/scaffolding.c index 0e4c9e7d2a..03c0f7d3de 100644 --- a/src/lib/Libifl/test/dec_rpys/scaffolding.c +++ b/src/lib/Libifl/test/dec_rpys/scaffolding.c @@ -29,7 +29,7 @@ char *disrcs(int stream, size_t *nchars, int *retval) exit(1); } -void append_link(tlist_head *head, list_link *new, void *pobj) +void append_link(tlist_head *head, list_link *newLink, void *pobj) { fprintf(stderr, "The call to append_link needs to be mocked!!\n"); exit(1); diff --git a/src/lib/Libifl/test/dec_svrattrl/scaffolding.c b/src/lib/Libifl/test/dec_svrattrl/scaffolding.c index 46505e0f79..d7abb9c1d7 100644 --- a/src/lib/Libifl/test/dec_svrattrl/scaffolding.c +++ b/src/lib/Libifl/test/dec_svrattrl/scaffolding.c @@ -16,7 +16,7 @@ int disrfcs(int stream, size_t *nchars, size_t achars, char *value) exit(1); } -void append_link(tlist_head *head, list_link *new, void *pobj) +void append_link(tlist_head *head, list_link *newLink, void *pobj) { fprintf(stderr, "The call to append_link needs to be mocked!!\n"); exit(1); diff --git a/src/lib/Libifl/test/enc_attropl_hash/scaffolding.c b/src/lib/Libifl/test/enc_attropl_hash/scaffolding.c index a163c5eb6b..c9a4762357 100644 --- a/src/lib/Libifl/test/enc_attropl_hash/scaffolding.c +++ b/src/lib/Libifl/test/enc_attropl_hash/scaffolding.c @@ -29,7 +29,7 @@ int hash_count(job_data *head) exit(1); } -int hash_del_item(memmgr **mm, job_data **head, char *name) +int hash_del_item(memmgr **mm, job_data **head, const char *name) { fprintf(stderr, "The call to hash_del_item needs to be mocked!!\n"); exit(1); diff --git a/src/lib/Libifl/test/pbsD_connect/scaffolding.c b/src/lib/Libifl/test/pbsD_connect/scaffolding.c index 0dc011a6a2..0eed5d2f57 100644 --- a/src/lib/Libifl/test/pbsD_connect/scaffolding.c +++ b/src/lib/Libifl/test/pbsD_connect/scaffolding.c @@ -28,13 +28,13 @@ int socket_get_tcp() exit(1); } -int csv_length(char *csv_str) +int csv_length(const char *csv_str) { fprintf(stderr, "The call to csv_length needs to be mocked!!\n"); exit(1); } -char *csv_nth(char *csv_str, int n) +char *csv_nth(const char *csv_str, int n) { fprintf(stderr, "The call to csv_nth needs to be mocked!!\n"); exit(1); @@ -114,3 +114,8 @@ int socket_close(int sock) { return(0); } + +size_t read_ac_socket(int fd, void *buf, ssize_t count) + { + return(0); + } diff --git a/src/lib/Libifl/test/tcp_dis/scaffolding.c b/src/lib/Libifl/test/tcp_dis/scaffolding.c index d0d294feea..c44854b98d 100644 --- a/src/lib/Libifl/test/tcp_dis/scaffolding.c +++ b/src/lib/Libifl/test/tcp_dis/scaffolding.c @@ -39,4 +39,12 @@ int socket_read(int socket, char **the_str, long long *str_len) return(1); } +ssize_t write_ac_socket(int fd, const void *buf, ssize_t count) + { + return(0); + } +ssize_t read_ac_socket(int fd, void *buf, ssize_t count) + { + return(0); + } diff --git a/src/lib/Libnet/net_common.c b/src/lib/Libnet/net_common.c index e0f4a07953..ce46a08967 100644 --- a/src/lib/Libnet/net_common.c +++ b/src/lib/Libnet/net_common.c @@ -1,3 +1,6 @@ +#define NEED_BLOCKING_CONNECTIONS +#include /* the master config generated by configure */ + #include "license_pbs.h" /* See here for the software license */ #include "lib_net.h" @@ -23,6 +26,9 @@ #include "pbs_error.h" /* torque error codes */ +#include "../lib/Libifl/lib_ifl.h" + + extern time_t pbs_tcp_timeout; /* located in tcp_dis.c. Move here later */ #define RES_PORT_START 144 @@ -502,7 +508,7 @@ void socket_read_flush( { if (avail_bytes > 256) avail_bytes = 256; - i = read(socket, incoming, avail_bytes); + i = read_ac_socket(socket, incoming, avail_bytes); if (i < 0) break; } @@ -552,7 +558,7 @@ int socket_read_force( char log_buf[LOCAL_LOG_BUF_SIZE+1]; while (bytes_read != 0) { - bytes_read = read(socket, read_loc, tmp_len); + bytes_read = read_ac_socket(socket, read_loc, tmp_len); if ((bytes_read == -1) && (errno != EINTR)) { if (getenv("PBSDEBUG") != NULL) @@ -658,7 +664,7 @@ int socket_read_one_byte( rc = socket_wait_for_read(socket); if (rc == PBSE_NONE) { - if (read(socket, one_char, 1) != 1) + if (read_ac_socket(socket, one_char, 1) != 1) rc = PBSE_SOCKET_READ; else rc = PBSE_NONE; @@ -697,7 +703,7 @@ int socket_read_num( break; } } - else if (read(socket, &tmp_char, 1) == -1) + else if (read_ac_socket(socket, &tmp_char, 1) == -1) break; else if (pos >= (int)sizeof(str_ll) - 1) break; @@ -768,7 +774,7 @@ int socket_read_str( { rc = PBSE_INTERNAL; } - else if (read(socket, &delin, 1) != 1) + else if (read_ac_socket(socket, &delin, 1) != 1) { rc = PBSE_INTERNAL; } diff --git a/src/lib/Libnet/port_forwarding.c b/src/lib/Libnet/port_forwarding.c index a4947d51ed..229e3ae672 100644 --- a/src/lib/Libnet/port_forwarding.c +++ b/src/lib/Libnet/port_forwarding.c @@ -16,6 +16,8 @@ #include #include #include +#include "../lib/Libifl/lib_ifl.h" + #include "port_forwarding.h" @@ -142,7 +144,7 @@ void port_forwarder( { /* non-listening socket to be read */ - rc = read( + rc = read_ac_socket( (socks + n)->sock, (socks + n)->buff + (socks + n)->bufavail, BUF_SIZE - (socks + n)->bufavail); @@ -170,7 +172,7 @@ void port_forwarder( { int peer = (socks + n)->peer; - rc = write( + rc = write_ac_socket( (socks + n)->sock, (socks + peer)->buff + (socks + peer)->bufwritten, (socks + peer)->bufavail - (socks + peer)->bufwritten); diff --git a/src/lib/Libnet/test/net_common/scaffolding.c b/src/lib/Libnet/test/net_common/scaffolding.c index 941e5a5883..1ac7563a7e 100644 --- a/src/lib/Libnet/test/net_common/scaffolding.c +++ b/src/lib/Libnet/test/net_common/scaffolding.c @@ -36,3 +36,9 @@ time_t pbs_tcp_timeout; void log_record(int eventtype, int eventclass, const char *caller, const char *msg) { } + +ssize_t read_ac_socket(int fd, void *buf, ssize_t count) + { + return(0); + } + diff --git a/src/lib/Libnet/test/net_server/scaffolding.c b/src/lib/Libnet/test/net_server/scaffolding.c index 707e460e3a..b667331055 100644 --- a/src/lib/Libnet/test/net_server/scaffolding.c +++ b/src/lib/Libnet/test/net_server/scaffolding.c @@ -5,7 +5,7 @@ #include "net_connect.h" -char *msg_daemonname = "unset"; +const char *msg_daemonname = "unset"; void disiui_() {} diff --git a/src/lib/Libnet/test/port_forwarding/scaffolding.c b/src/lib/Libnet/test/port_forwarding/scaffolding.c index 23ff6ced99..4ecc2b210e 100644 --- a/src/lib/Libnet/test/port_forwarding/scaffolding.c +++ b/src/lib/Libnet/test/port_forwarding/scaffolding.c @@ -3,13 +3,13 @@ #include -ssize_t write_nonblocking_socket( int fd, const void *buf, ssize_t count) +ssize_t write_ac_socket( int fd, const void *buf, ssize_t count) { fprintf(stderr, "The call to write_nonblocking_socket needs to be mocked!!\n"); exit(1); } -ssize_t read_nonblocking_socket(int fd, void *buf, ssize_t count) +ssize_t read_ac_socket(int fd, void *buf, ssize_t count) { fprintf(stderr, "The call to read_nonblocking_socket needs to be mocked!!\n"); exit(1); diff --git a/src/lib/Libnet/test/server_core/scaffolding.c b/src/lib/Libnet/test/server_core/scaffolding.c index 45f38d9e27..61217e2d70 100644 --- a/src/lib/Libnet/test/server_core/scaffolding.c +++ b/src/lib/Libnet/test/server_core/scaffolding.c @@ -6,7 +6,7 @@ #include "net_connect.h" #include "log.h" -char *msg_daemonname = "unset"; +const char *msg_daemonname = "unset"; void log_get_set_eventclass(int *objclass, SGetter action) {} diff --git a/src/lib/Libsite/site_check_u.c b/src/lib/Libsite/site_check_u.c index 62778a9bb5..666e0126ee 100644 --- a/src/lib/Libsite/site_check_u.c +++ b/src/lib/Libsite/site_check_u.c @@ -114,7 +114,7 @@ extern char server_host[]; extern char *msg_orighost; /* error message: no PBS_O_HOST */ /* This is in the server code? */ -extern struct pbsnode *find_nodebyname(char *); +extern struct pbsnode *find_nodebyname(const char *); /* * site_check_u - site_check_user_map() diff --git a/src/lib/Libsite/test/site_check_u/scaffolding.c b/src/lib/Libsite/test/site_check_u/scaffolding.c index 9239e195c2..30c97db12a 100644 --- a/src/lib/Libsite/test/site_check_u/scaffolding.c +++ b/src/lib/Libsite/test/site_check_u/scaffolding.c @@ -9,8 +9,8 @@ char *server_host; struct server server; -char *pbs_o_host = "PBS_O_HOST"; -char *msg_orighost = "Job missing PBS_O_HOST value"; +const char *pbs_o_host = "PBS_O_HOST"; +const char *msg_orighost = "Job missing PBS_O_HOST value"; char *get_variable(job *pjob, char *variable) { @@ -19,7 +19,7 @@ char *get_variable(job *pjob, char *variable) } -struct pbsnode *find_nodebyname( char *nodename) +struct pbsnode *find_nodebyname(const char *nodename) { fprintf(stderr, "The call to find_nodebyname needs to be mocked!!\n"); exit(1); diff --git a/src/lib/Libutils/lib_utils.h b/src/lib/Libutils/lib_utils.h index 9c2707cffd..79cadef4e8 100644 --- a/src/lib/Libutils/lib_utils.h +++ b/src/lib/Libutils/lib_utils.h @@ -17,7 +17,7 @@ int MXMLExtractE(mxml_t *E, mxml_t *C, mxml_t **CP); int MXMLSetChild(mxml_t *E, char *CName, mxml_t **CE); -int MXMLCreateE(mxml_t **E, char *Name); +int MXMLCreateE(mxml_t **E, const char *Name); int MXMLDestroyE(mxml_t **EP); diff --git a/src/lib/Libutils/test/u_hash_map_structs/u_hash_map_structs_ct.c b/src/lib/Libutils/test/u_hash_map_structs/u_hash_map_structs_ct.c index 6c21047e17..5509cd54ad 100644 --- a/src/lib/Libutils/test/u_hash_map_structs/u_hash_map_structs_ct.c +++ b/src/lib/Libutils/test/u_hash_map_structs/u_hash_map_structs_ct.c @@ -14,7 +14,7 @@ void initVars() calloc_fail = 0; } -void callocVal(char **dest, char *src) +void callocVal(char **dest, const char *src) { *dest = (char *)calloc(1, strlen(src)+1); if (!dest) @@ -145,8 +145,8 @@ START_TEST(test_add_or_exit) { job_data *the_map = NULL; memmgr *mm = NULL; - char *name = "simple_val"; - char value[] = "should fail"; + const char *name = "simple_val"; + const char *value = "should fail"; int var_type = 4; initVars(); calloc_fail = 1; @@ -218,7 +218,7 @@ void rundebug() { job_data *the_map = NULL; memmgr *mm = NULL; - char *name = "simple_val"; + const char *name = "simple_val"; char value[] = "should fail"; int var_type = 4; memmgr_init(&mm, 0); diff --git a/src/lib/Libutils/test/u_mom_hierarchy/scaffolding.c b/src/lib/Libutils/test/u_mom_hierarchy/scaffolding.c index ae8babb1c8..f46cb7b453 100644 --- a/src/lib/Libutils/test/u_mom_hierarchy/scaffolding.c +++ b/src/lib/Libutils/test/u_mom_hierarchy/scaffolding.c @@ -12,7 +12,7 @@ int pbs_errno; time_t time_now; int LOGLEVEL=0; char log_buffer[LOG_BUF_SIZE]; -char *dis_emsg[] = +const char *dis_emsg[] = { "No error", "Input value too large to convert to this type", diff --git a/src/lib/Libutils/test/u_mu/scaffolding.c b/src/lib/Libutils/test/u_mu/scaffolding.c index f9f6546081..d72d3162d3 100644 --- a/src/lib/Libutils/test/u_mu/scaffolding.c +++ b/src/lib/Libutils/test/u_mu/scaffolding.c @@ -8,3 +8,7 @@ void log_err(int errnum, const char *routine, const char *text) exit(1); } +ssize_t write_ac_socket(int fd, const void *buf, ssize_t count) + { + return(0); + } diff --git a/src/lib/Libutils/u_MXML.c b/src/lib/Libutils/u_MXML.c index 05c83fbbc1..7c2aa80d8d 100644 --- a/src/lib/Libutils/u_MXML.c +++ b/src/lib/Libutils/u_MXML.c @@ -109,7 +109,7 @@ int MXMLSetChild( int MXMLCreateE( mxml_t **E, /* O */ - char *Name) /* I (optional) */ + const char *Name) /* I (optional) */ { /* NOTE: should 'Name' be mandatory? */ diff --git a/src/lib/Libutils/u_constants.c b/src/lib/Libutils/u_constants.c index b0aeb7c4b9..31ae7c554b 100644 --- a/src/lib/Libutils/u_constants.c +++ b/src/lib/Libutils/u_constants.c @@ -77,6 +77,7 @@ * without reference to its choice of law rules. */ +#include "alps_constants.h" const int apbasil_fail_transient = -10; @@ -112,7 +113,7 @@ const char *text_name = "text"; const char *memory_mb = "memory_mb"; const char *family = "family"; const char *cproc_eq = "CPROC="; -const int cproc_eq_len = 6; +const int ac_cproc_eq_len = 6; const char *CRAY_GPU_STATUS_START = ""; const char *CRAY_GPU_STATUS_END = ""; const char *alps_reporter_feature = "alps_reporter"; diff --git a/src/lib/Libutils/u_hash_map_structs.c b/src/lib/Libutils/u_hash_map_structs.c index ecc3a67ac4..8d9d49a38a 100644 --- a/src/lib/Libutils/u_hash_map_structs.c +++ b/src/lib/Libutils/u_hash_map_structs.c @@ -101,8 +101,8 @@ int hash_add_item( memmgr **mm, /* M - memory manager */ job_data **head, /* M - hashmap */ - char *name, /* key for the item */ - char *value, /* value for the item */ + const char *name, /* key for the item */ + const char *value, /* value for the item */ int var_type, /* type of variable */ int op_type) /* operation of variable */ @@ -179,8 +179,8 @@ void hash_add_or_exit( memmgr **mm, /* M - memory manager */ job_data **head, /* M - hashmap */ - char *name, /* I - The item being added to the hashmap */ - char *val, /* I - Sets the value of variable */ + const char *name, /* I - The item being added to the hashmap */ + const char *val, /* I - Sets the value of variable */ int var_type) /* I - Sets the type of the variable */ { if (hash_add_item(mm, head, name, val, var_type, SET) == FALSE) @@ -196,7 +196,7 @@ void hash_add_or_exit( int hash_del_item( memmgr **mm, /* M - memory manager */ job_data **head, /* M - hashmap */ - char *name) /* I - entry to delete */ + const char *name) /* I - entry to delete */ { int rc = FALSE; char *tmp_name = NULL; @@ -248,9 +248,9 @@ int hash_clear( */ int hash_find( - job_data *head, /* I - hashmap */ - char *name, /* I - name to find */ - job_data **env_var) /* O - return value when found */ + job_data *head, /* I - hashmap */ + const char *name, /* I - name to find */ + job_data **env_var) /* O - return value when found */ { int rc = TRUE; diff --git a/src/lib/Libutils/u_mu.c b/src/lib/Libutils/u_mu.c index 71c698d5be..e659f16821 100644 --- a/src/lib/Libutils/u_mu.c +++ b/src/lib/Libutils/u_mu.c @@ -1,4 +1,4 @@ - +#include /* the master config generated by configure */ #include #include @@ -6,6 +6,7 @@ #include "utils.h" #include "../Liblog/pbs_log.h" +#include "../Libifl/lib_ifl.h" @@ -341,7 +342,7 @@ int write_buffer( { int written; - while ((written = write(fds,buf,len)) != len) + while ((written = write_ac_socket(fds,buf,len)) != len) { if ((errno == EINTR) && (written == -1)) diff --git a/src/momctl/momctl.c b/src/momctl/momctl.c index 0c2eea20a9..c135928f23 100644 --- a/src/momctl/momctl.c +++ b/src/momctl/momctl.c @@ -31,9 +31,9 @@ extern char *optarg; #define MAX_QUERY 128 -char *LocalHost = "localhost"; +const char *LocalHost = "localhost"; -char *DiagPtr = "diag"; +const char *DiagPtr = "diag"; char *Query[MAX_QUERY]; int QueryI = 0; @@ -63,7 +63,7 @@ enum MOMCmdEnum CmdIndex = momNONE; /* prototypes */ -void MCShowUsage(char *); +void MCShowUsage(const char *); int do_mom(char *, int, int); /* END prototypes */ @@ -136,7 +136,7 @@ int main( CmdIndex = momQuery; - if ((Query[QueryI] = calloc(strlen(DiagPtr) + 3, sizeof(char))) == NULL) + if ((Query[QueryI] = (char *)calloc(strlen(DiagPtr) + 3, sizeof(char))) == NULL) { fprintf(stderr,"ERROR: could not calloc %d bytes!\n", (int)strlen(DiagPtr) + 3); @@ -894,7 +894,7 @@ int do_mom( void MCShowUsage( - char *Msg) /* I (optional) */ + const char *Msg) /* I (optional) */ { if (Msg != NULL) diff --git a/src/pam/pam_pbssimpleauth.c b/src/pam/pam_pbssimpleauth.c index 92a0413a5d..b9de21b33a 100644 --- a/src/pam/pam_pbssimpleauth.c +++ b/src/pam/pam_pbssimpleauth.c @@ -159,7 +159,7 @@ int pam_sm_authenticate(pam_handle_t *pamh, int flags, int argc, continue; } - amt = read(fp, &xjob.ji_qs, sizeof(xjob.ji_qs)); + amt = read_ac_socket(fp, &xjob.ji_qs, sizeof(xjob.ji_qs)); if (amt != sizeof(xjob.ji_qs)) { diff --git a/src/resmom/aix4/mom_mach.c b/src/resmom/aix4/mom_mach.c index 30a1f6194a..6597d9beff 100644 --- a/src/resmom/aix4/mom_mach.c +++ b/src/resmom/aix4/mom_mach.c @@ -1709,7 +1709,7 @@ kvm_read(int fd, long addr, char *buf, int size) if (lseek(fd, addr, SEEK_SET) != addr) return -1; - if ((ret = read(fd, buf, size)) == -1) + if ((ret = read_ac_socket(fd, buf, size)) == -1) return -1; return ret; diff --git a/src/resmom/aix5/mom_mach.c b/src/resmom/aix5/mom_mach.c index 87ec66cc91..ce0ba56cba 100644 --- a/src/resmom/aix5/mom_mach.c +++ b/src/resmom/aix5/mom_mach.c @@ -1679,7 +1679,7 @@ kvm_read(int fd, long addr, char *buf, int size) if (lseek(fd, addr, SEEK_SET) != addr) return -1; - if ((ret = read(fd, buf, size)) == -1) + if ((ret = read_ac_socket(fd, buf, size)) == -1) return -1; return ret; diff --git a/src/resmom/alps_reservations.c b/src/resmom/alps_reservations.c index 00f2eab9fd..c2bce095b7 100644 --- a/src/resmom/alps_reservations.c +++ b/src/resmom/alps_reservations.c @@ -77,9 +77,6 @@ * without reference to its choice of law rules. */ - - - #include #include #include @@ -91,6 +88,7 @@ #include "resizable_array.h" #include "dynamic_string.h" #include "utils.h" +#include "../lib/Libifl/lib_ifl.h" extern char mom_alias[]; @@ -621,7 +619,7 @@ int confirm_reservation( ptr = output; memset(output, 0, sizeof(output)); - while ((bytes_read = read(fd, ptr, sizeof(output) - total_bytes_read - 1)) > 0) + while ((bytes_read = read_ac_socket(fd, ptr, sizeof(output) - total_bytes_read - 1)) > 0) { total_bytes_read += bytes_read; ptr += bytes_read; diff --git a/src/resmom/fujitsu/mom_mach.c b/src/resmom/fujitsu/mom_mach.c index 350f83ee43..36ec2a1a01 100644 --- a/src/resmom/fujitsu/mom_mach.c +++ b/src/resmom/fujitsu/mom_mach.c @@ -1925,7 +1925,7 @@ get_la(double *rv) return (rm_errno = RM_ERR_SYSTEM); } - if (read(kd, (char *)&load, sizeof(load)) != sizeof(load)) + if (read_ac_socket(kd, (char *)&load, sizeof(load)) != sizeof(load)) { log_err(errno, id, "read"); return (rm_errno = RM_ERR_SYSTEM); @@ -1967,7 +1967,7 @@ getanon(char *id) return NULL; } - if (read(kd, (char *)&ai, sizeof(struct anoninfo)) != + if (read_ac_socket(kd, (char *)&ai, sizeof(struct anoninfo)) != sizeof(struct anoninfo)) { log_err(errno, id, "read"); @@ -2055,7 +2055,7 @@ physmem(struct rm_attribute *attrib) return NULL; } - if (read(kd, (char *)&pmem, sizeof(pmem)) != sizeof(pmem)) + if (read_ac_socket(kd, (char *)&pmem, sizeof(pmem)) != sizeof(pmem)) { log_err(errno, id, "read"); rm_errno = RM_ERR_SYSTEM; diff --git a/src/resmom/generate_alps_status.c b/src/resmom/generate_alps_status.c index af854a14bb..a6c6cab7c3 100644 --- a/src/resmom/generate_alps_status.c +++ b/src/resmom/generate_alps_status.c @@ -77,8 +77,6 @@ * without reference to its choice of law rules. */ - - #include #include #include @@ -89,6 +87,7 @@ #include "utils.h" #include "alps_constants.h" +#include "../lib/Libifl/lib_ifl.h" /* diff --git a/src/resmom/irix5/mom_mach.c b/src/resmom/irix5/mom_mach.c index 51a440a9fd..1e4a54a62d 100644 --- a/src/resmom/irix5/mom_mach.c +++ b/src/resmom/irix5/mom_mach.c @@ -2066,7 +2066,7 @@ physmem(struct rm_attribute *attrib) return NULL; } - if (read(kfd, (char *)&pmem, sizeof(pmem)) != sizeof(pmem)) + if (read_ac_socket(kfd, (char *)&pmem, sizeof(pmem)) != sizeof(pmem)) { log_err(errno, id, "read"); rm_errno = RM_ERR_SYSTEM; @@ -2352,7 +2352,7 @@ get_la(double *rv) return (rm_errno = RM_ERR_SYSTEM); } - if (read(kfd, (char *)&load, sizeof(load)) != sizeof(load)) + if (read_ac_socket(kfd, (char *)&load, sizeof(load)) != sizeof(load)) { log_err(errno, id, "read"); return (rm_errno = RM_ERR_SYSTEM); diff --git a/src/resmom/irix6/mom_mach.c b/src/resmom/irix6/mom_mach.c index a64af8b878..45cb49c5ef 100644 --- a/src/resmom/irix6/mom_mach.c +++ b/src/resmom/irix6/mom_mach.c @@ -2288,7 +2288,7 @@ physmem(struct rm_attribute *attrib) return NULL; } - if (read(kfd, (char *)&pmem, sizeof(pmem)) != sizeof(pmem)) + if (read_ac_socket(kfd, (char *)&pmem, sizeof(pmem)) != sizeof(pmem)) { log_err(errno, id, "read"); rm_errno = PBSE_RMSYSTEM; @@ -2566,7 +2566,7 @@ get_la(double *rv) return (rm_errno = PBSE_RMSYSTEM); } - if (read(kfd, (char *)&load, sizeof(load)) != sizeof(load)) + if (read_ac_socket(kfd, (char *)&load, sizeof(load)) != sizeof(load)) { log_err(errno, id, "read"); return (rm_errno = PBSE_RMSYSTEM); diff --git a/src/resmom/irix6array/mom_mach.c b/src/resmom/irix6array/mom_mach.c index 26329bcdaf..8cee27b05a 100644 --- a/src/resmom/irix6array/mom_mach.c +++ b/src/resmom/irix6array/mom_mach.c @@ -1828,7 +1828,7 @@ physmem(struct rm_attribute *attrib) return NULL; } - if (read(kfd, (char *)&pmem, sizeof(pmem)) != sizeof(pmem)) + if (read_ac_socket(kfd, (char *)&pmem, sizeof(pmem)) != sizeof(pmem)) { log_err(errno, id, (char *)"read"); rm_errno = RM_ERR_SYSTEM; @@ -2018,7 +2018,7 @@ get_la(double *rv) return (rm_errno = RM_ERR_SYSTEM); } - if (read(kfd, (char *)&load, sizeof(load)) != sizeof(load)) + if (read_ac_socket(kfd, (char *)&load, sizeof(load)) != sizeof(load)) { log_err(errno, id, (char *)"read"); return (rm_errno = RM_ERR_SYSTEM); diff --git a/src/resmom/linux/test/mom_mach/scaffolding.c b/src/resmom/linux/test/mom_mach/scaffolding.c index 09bcbbe10a..e46088ccc1 100644 --- a/src/resmom/linux/test/mom_mach/scaffolding.c +++ b/src/resmom/linux/test/mom_mach/scaffolding.c @@ -13,19 +13,19 @@ int svr_resc_size = 0; char path_meminfo[MAX_LINE]; -char no_parm[] = "required parameter not found"; +const char *no_parm = "required parameter not found"; long system_ncpus = 0; time_t time_now = 0; int ignmem = 0; double wallfactor = 1.00; double cputfactor = 1.00; int exiting_tasks = 0; -char extra_parm[] = "extra parameter(s)"; +const char *extra_parm = "extra parameter(s)"; int igncput = 0; char *ret_string; resource_def *svr_resc_def; int ignvmem = 0; -char *msg_momsetlim = "Job start failed. Can't set \"%s\" limit: %s.\n"; +const char *msg_momsetlim = "Job start failed. Can't set \"%s\" limit: %s.\n"; tlist_head svr_alljobs; int LOGLEVEL = 7; /* force logging code to be exercised as tests run */ int ignwalltime = 0; diff --git a/src/resmom/mom_comm.c b/src/resmom/mom_comm.c index 5abd9eeef7..9621930f92 100644 --- a/src/resmom/mom_comm.c +++ b/src/resmom/mom_comm.c @@ -111,6 +111,7 @@ #include "log.h" #include "../lib/Liblog/pbs_log.h" #include "../lib/Liblog/log_event.h" +#include "../lib/Libifl/lib_ifl.h" #include "net_connect.h" #include "dis.h" #include "dis_init.h" @@ -328,7 +329,7 @@ int task_save( /* just write the "critical" base structure to the file */ - while ((i = write(fds,&ptask->ti_qs,sizeof(ptask->ti_qs)) ) != sizeof(ptask->ti_qs)) + while ((i = write_ac_socket(fds,&ptask->ti_qs,sizeof(ptask->ti_qs)) ) != sizeof(ptask->ti_qs)) { if ((i < 0) && (errno == EINTR)) { @@ -629,7 +630,7 @@ int task_recov( /* read in task quick save sub-structure */ - while (read(fds, (char *)&task_save, sizeof(task_save)) == sizeof(task_save)) + while (read_ac_socket(fds, (char *)&task_save, sizeof(task_save)) == sizeof(task_save)) { tid = TM_NULL_TASK; @@ -8148,7 +8149,7 @@ void fork_demux( else { /* read the pipe and then continue */ - while ((read(pipes[0], &buf, sizeof(buf) - 1) == -1) && + while ((read_ac_socket(pipes[0], &buf, sizeof(buf) - 1) == -1) && (errno == EINTR)) ; @@ -8180,7 +8181,7 @@ void fork_demux( close(im_mom_stdout); close(im_mom_stderr); - if (write(pipes[1], "fail", strlen("fail")) < 0) + if (write_ac_socket(pipes[1], "fail", strlen("fail")) < 0) perror(__func__); close(pipes[1]); @@ -8194,7 +8195,7 @@ void fork_demux( close(im_mom_stdout); close(im_mom_stderr); - if (write(pipes[1], "fail", strlen("fail")) < 0) + if (write_ac_socket(pipes[1], "fail", strlen("fail")) < 0) perror(__func__); close(pipes[1]); @@ -8221,7 +8222,7 @@ void fork_demux( close(im_mom_stdout); close(im_mom_stderr); - if (write(pipes[1], "fail", strlen("fail")) < 0) + if (write_ac_socket(pipes[1], "fail", strlen("fail")) < 0) perror(__func__); close(pipes[1]); @@ -8238,7 +8239,7 @@ void fork_demux( close(im_mom_stderr); close(fd1); - if (write(pipes[1], "fail", strlen("fail")) < 0) + if (write_ac_socket(pipes[1], "fail", strlen("fail")) < 0) perror(__func__); close(pipes[1]); @@ -8246,7 +8247,7 @@ void fork_demux( _exit(5); } - if (write(pipes[1], "success", strlen("success")) < 0) + if (write_ac_socket(pipes[1], "success", strlen("success")) < 0) perror(__func__); close(pipes[1]); diff --git a/src/resmom/mom_inter.c b/src/resmom/mom_inter.c index f92bf6f463..d49fac672d 100644 --- a/src/resmom/mom_inter.c +++ b/src/resmom/mom_inter.c @@ -97,6 +97,7 @@ #include "portability.h" #include "pbs_ifl.h" +#include "../lib/Libifl/lib_ifl.h" #include "server_limits.h" #include "net_connect.h" #include "log.h" @@ -138,7 +139,7 @@ static int read_net( while (amt > 0) { - got = read(sock, buf, amt); + got = read_ac_socket(sock, buf, amt); if (got == 0) { @@ -367,7 +368,7 @@ int mom_reader( while (c > 0) { - if ((wc = write(ptc, p, c)) < 0) + if ((wc = write_ac_socket(ptc, p, c)) < 0) { if (errno == EINTR) { @@ -439,7 +440,7 @@ int mom_writer( while (1) { - c = read(ptc, buf, sizeof(buf)); + c = read_ac_socket(ptc, buf, sizeof(buf)); if (c > 0) { @@ -448,7 +449,7 @@ int mom_writer( while (c > 0) { - if ((wc = write(s, p, c)) < 0) + if ((wc = write_ac_socket(s, p, c)) < 0) { if (errno == EINTR) { diff --git a/src/resmom/mom_main.c b/src/resmom/mom_main.c index 81fd78c157..40d7133db2 100644 --- a/src/resmom/mom_main.c +++ b/src/resmom/mom_main.c @@ -62,6 +62,7 @@ #include "../lib/Liblog/chk_file_sec.h" #include "../lib/Liblog/setup_env.h" #include "../lib/Libnet/lib_net.h" /* socket_avail_bytes_on_descriptor */ +#include "../lib/Libifl/lib_ifl.h" #include "net_connect.h" #include "dis.h" #include "dis_init.h" @@ -1037,7 +1038,7 @@ static const char *reqvarattr( while (child_len < TMAX_VARBUF) { - len = read(fd, child_spot, TMAX_VARBUF - child_len); + len = read_ac_socket(fd, child_spot, TMAX_VARBUF - child_len); if ((len <= 0) && (errno != EINTR)) @@ -4084,7 +4085,7 @@ char *conf_res( retryread: - while ((len = read(fd, child_spot, ret_size - child_len)) > 0) + while ((len = read_ac_socket(fd, child_spot, ret_size - child_len)) > 0) { for (i = 0;i < len;i++) { @@ -7375,7 +7376,7 @@ int setup_program_environment(void) sprintf(log_buffer, "%ld\n", (long)getpid()); - if (write(lockfds, log_buffer, strlen(log_buffer) + 1) != + if (write_ac_socket(lockfds, log_buffer, strlen(log_buffer) + 1) != (ssize_t)(strlen(log_buffer) + 1)) { log_err(errno, msg_daemonname, "failed to write to lockfile"); @@ -8525,7 +8526,7 @@ int read_layout_file() char line[MAX_LINE]; char *delims = " \t\n\r="; char *tok = NULL; - char *val = NULL; + const char *val = NULL; int i = 0; int empty_line; hwloc_bitmap_t nodeset = NULL; diff --git a/src/resmom/mom_req_quejob.c b/src/resmom/mom_req_quejob.c index d7e33211f1..e71e93dab6 100644 --- a/src/resmom/mom_req_quejob.c +++ b/src/resmom/mom_req_quejob.c @@ -102,6 +102,7 @@ #include "pbs_error.h" #include "log.h" #include "../lib/Liblog/pbs_log.h" +#include "../lib/Libifl/lib_ifl.h" #include "svrfunc.h" #include "mom_job_func.h" /* mom_job_purge */ @@ -159,7 +160,7 @@ extern int reject_job_submit; extern char *msg_daemonname; -extern int decode_arst_merge(struct pbs_attribute *,const char *,char *,char *); +extern int decode_arst_merge(struct pbs_attribute *,const char *,const char *,const char *); /* Private Functions in this file */ @@ -669,7 +670,7 @@ void req_jobscript( return; } - if (write( + if (write_ac_socket( fds, preq->rq_ind.rq_jobfile.rq_data, (unsigned)preq->rq_ind.rq_jobfile.rq_size) != preq->rq_ind.rq_jobfile.rq_size) @@ -778,7 +779,7 @@ void req_mvjobfile( return; } - if (write( + if (write_ac_socket( fds, preq->rq_ind.rq_jobfile.rq_data, preq->rq_ind.rq_jobfile.rq_size) != preq->rq_ind.rq_jobfile.rq_size) diff --git a/src/resmom/pbs_demux.c b/src/resmom/pbs_demux.c index 61af02a135..e8bb18d107 100644 --- a/src/resmom/pbs_demux.c +++ b/src/resmom/pbs_demux.c @@ -102,6 +102,7 @@ #if defined(FD_SET_IN_SYS_SELECT_H) # include #endif +#include "../lib/Libifl/lib_ifl.h" enum rwhere {invalid, new_out, new_err, old_out, old_err}; @@ -134,7 +135,7 @@ void readit( i = 0; - if ((amt = read(sock, buf, 256)) > 0) + if ((amt = read_ac_socket(sock, buf, 256)) > 0) { /* disable cookie search PW - mpiexec patch */ diff --git a/src/resmom/prolog.c b/src/resmom/prolog.c index 2967b3dd57..f8a720689f 100644 --- a/src/resmom/prolog.c +++ b/src/resmom/prolog.c @@ -97,6 +97,7 @@ #include "pbs_job.h" #include "log.h" #include "../lib/Liblog/pbs_log.h" +#include "../lib/Libifl/lib_ifl.h" #include "mom_mach.h" #include "mom_func.h" #include "resource.h" @@ -906,7 +907,7 @@ int run_pelog( strerror(errno), which == PE_PROLOGUSER ? "prologue" : "epilogue"); - if (write(2, log_buffer, strlen(log_buffer)) == -1) {} + if (write_ac_socket(2, log_buffer, strlen(log_buffer)) == -1) {} fsync(2); } @@ -1270,7 +1271,7 @@ int run_pelog( pelog, strerror(errno)); - if (write(2, log_buffer, strlen(log_buffer)) == -1) + if (write_ac_socket(2, log_buffer, strlen(log_buffer)) == -1) { /* cannot write message to stderr */ diff --git a/src/resmom/release_reservation.c b/src/resmom/release_reservation.c index dc70d8bafb..d7e1e2d702 100644 --- a/src/resmom/release_reservation.c +++ b/src/resmom/release_reservation.c @@ -77,8 +77,6 @@ * without reference to its choice of law rules. */ - - #include #include #include @@ -90,6 +88,7 @@ #include "alps_constants.h" #include "utils.h" +#include "../lib/Libifl/lib_ifl.h" diff --git a/src/resmom/requests.c b/src/resmom/requests.c index 7133cba852..1625e32386 100644 --- a/src/resmom/requests.c +++ b/src/resmom/requests.c @@ -109,6 +109,7 @@ #include "log.h" #include "../lib/Liblog/pbs_log.h" #include "../lib/Liblog/log_event.h" +#include "../lib/Libifl/lib_ifl.h" #include "checkpoint.h" /* start_checkpoint */ #include "resmon.h" #include "net_connect.h" @@ -658,7 +659,7 @@ int return_file( strcpy(prq->rq_ind.rq_jobfile.rq_jobid, pjob->ji_qs.ji_jobid); - while ((amt = read(fds, buf, RT_BLK_SZ)) > 0) + while ((amt = read_ac_socket(fds, buf, RT_BLK_SZ)) > 0) { /* prq->rq_ind.rq_jobfile.rq_sequence = seq++; */ /* prq->rq_ind.rq_jobfile.rq_type = (int)which; */ @@ -1317,7 +1318,7 @@ int message_job( rc = PBSE_NONE; alarm(alarm_time); - if (write(fds, text, len) != len) + if (write_ac_socket(fds, text, len) != len) { log_err(errno, "message_job", (char *)"unable to write message to job"); diff --git a/src/resmom/solaris7/mom_mach.c b/src/resmom/solaris7/mom_mach.c index b0e62263d3..441c48e6df 100644 --- a/src/resmom/solaris7/mom_mach.c +++ b/src/resmom/solaris7/mom_mach.c @@ -808,7 +808,7 @@ mom_get_sample(void) if ((fd = open(procname, O_RDONLY)) == -1) continue; - if (read(fd, pi, sizeof(psinfo_t)) != sizeof(psinfo_t)) + if (read_ac_socket(fd, pi, sizeof(psinfo_t)) != sizeof(psinfo_t)) { sprintf(log_buffer, "read of %s failed", procname); log_err(errno, id, log_buffer); diff --git a/src/resmom/start_exec.c b/src/resmom/start_exec.c index b2577ec3b5..7dbaa2797f 100644 --- a/src/resmom/start_exec.c +++ b/src/resmom/start_exec.c @@ -105,6 +105,7 @@ #include "log.h" #include "../lib/Liblog/pbs_log.h" #include "../lib/Liblog/log_event.h" +#include "../lib/Libifl/lib_ifl.h" #include "mom_mach.h" #include "mom_func.h" #include "pbs_error.h" @@ -616,7 +617,7 @@ int become_the_user( (unsigned long)pjob->ji_qs.ji_un.ji_momt.ji_exuid, strerror(errno)); - if (write(2, log_buffer, strlen(log_buffer)) == -1) + if (write_ac_socket(2, log_buffer, strlen(log_buffer)) == -1) { } @@ -635,7 +636,7 @@ int become_the_user( (unsigned long)pjob->ji_qs.ji_un.ji_momt.ji_exuid, strerror(errno)); - if (write(2, log_buffer, strlen(log_buffer)) == -1) + if (write_ac_socket(2, log_buffer, strlen(log_buffer)) == -1) { } @@ -653,7 +654,7 @@ int become_the_user( (unsigned long)pjob->ji_qs.ji_un.ji_momt.ji_exuid, strerror(errno)); - if (write(2, log_buffer, strlen(log_buffer)) == -1) + if (write_ac_socket(2, log_buffer, strlen(log_buffer)) == -1) { } @@ -2372,7 +2373,7 @@ int TMomFinalizeJob2( while (j < i) { - if ((k = write(TJE->pipe_script[1], buf + j, i - j)) < 0) + if ((k = write_ac_socket(TJE->pipe_script[1], buf + j, i - j)) < 0) { if (errno == EINTR) continue; @@ -3103,7 +3104,7 @@ int start_interactive_session( /* send jobid as validation to qsub */ if ((*qsub_sock_ptr < 0)|| - (write(*qsub_sock_ptr, pjob->ji_qs.ji_jobid, PBS_MAXSVRJOBID + 1) != PBS_MAXSVRJOBID + 1)) + (write_ac_socket(*qsub_sock_ptr, pjob->ji_qs.ji_jobid, PBS_MAXSVRJOBID + 1) != PBS_MAXSVRJOBID + 1)) { log_err(errno, __func__, "cannot write jobid"); @@ -3457,7 +3458,7 @@ void attempt_to_set_limits( { /* report error to user via stderr file */ - if (write(2, log_buffer, strlen(log_buffer)) == -1) + if (write_ac_socket(2, log_buffer, strlen(log_buffer)) == -1) { } @@ -3516,7 +3517,7 @@ void go_to_init_dir( idir, strerror(errno)); - if (write(2, log_buffer, strlen(log_buffer)) == -1) + if (write_ac_socket(2, log_buffer, strlen(log_buffer)) == -1) { } @@ -3560,7 +3561,7 @@ int setup_x11_forwarding( { sprintf(log_buffer, "PBS: X11 forwarding init failed\n"); - if (write(2, log_buffer, strlen(log_buffer)) == -1) + if (write_ac_socket(2, log_buffer, strlen(log_buffer)) == -1) { } @@ -4022,7 +4023,7 @@ int TMomFinalizeChild( sprintf(log_buffer, "PBS: site specific job setup failed\n"); - if (write(2, log_buffer, strlen(log_buffer)) == -1) + if (write_ac_socket(2, log_buffer, strlen(log_buffer)) == -1) { } @@ -4055,7 +4056,7 @@ int TMomFinalizeChild( idir, strerror(errno)); - if (write(2, log_buffer, strlen(log_buffer)) == -1) + if (write_ac_socket(2, log_buffer, strlen(log_buffer)) == -1) { } @@ -4225,7 +4226,7 @@ int TMomFinalizeChild( sprintf(log_buffer, "PBS: exec of shell '%.256s' failed\n", shell); - if (write(2, log_buffer, strlen(log_buffer)) == -1) + if (write_ac_socket(2, log_buffer, strlen(log_buffer)) == -1) { } @@ -4340,7 +4341,7 @@ int TMomFinalizeJob3( /* send back as an acknowledgement that MOM got it */ - if (write(TJE->mjspipe[1], &sjr, sizeof(sjr)) == -1) + if (write_ac_socket(TJE->mjspipe[1], &sjr, sizeof(sjr)) == -1) { } @@ -4665,7 +4666,7 @@ int start_process( for (;;) { - i = read(parent_read, (char *) & sjr, sizeof(sjr)); + i = read_ac_socket(parent_read, (char *) & sjr, sizeof(sjr)); if ((i == -1) && (errno == EINTR)) continue; @@ -4674,7 +4675,7 @@ int start_process( { gotsuccess = 1; - if (write(parent_write, &sjr, sizeof(sjr)) == -1) + if (write_ac_socket(parent_write, &sjr, sizeof(sjr)) == -1) { } @@ -5058,10 +5059,10 @@ int start_process( /* never send cookie - PW mpiexec patch */ /* - if (write(1,pjob->ji_wattr[JOB_ATR_Cookie].at_val.at_str, + if (write_ac_socket(1,pjob->ji_wattr[JOB_ATR_Cookie].at_val.at_str, strlen(pjob->ji_wattr[JOB_ATR_Cookie].at_val.at_str)) == -1) {} - if (write(2,pjob->ji_wattr[JOB_ATR_Cookie].at_val.at_str, + if (write_ac_socket(2,pjob->ji_wattr[JOB_ATR_Cookie].at_val.at_str, strlen(pjob->ji_wattr[JOB_ATR_Cookie].at_val.at_str)) == -1) {} */ } @@ -5159,7 +5160,7 @@ int start_process( if (log_buffer[0] != '\0') { /* report error to user via stderr file */ - if (write(2, log_buffer, strlen(log_buffer)) == -1) + if (write_ac_socket(2, log_buffer, strlen(log_buffer)) == -1) { } @@ -5170,7 +5171,7 @@ int start_process( i); - if (write(2, log_buffer, strlen(log_buffer)) == -1) + if (write_ac_socket(2, log_buffer, strlen(log_buffer)) == -1) { } @@ -5194,7 +5195,7 @@ int start_process( idir, strerror(errno)); - if (write(2, log_buffer, strlen(log_buffer)) == -1) + if (write_ac_socket(2, log_buffer, strlen(log_buffer)) == -1) { } @@ -5223,7 +5224,7 @@ int start_process( idir, strerror(errno)); - if (write(2, log_buffer, strlen(log_buffer)) == -1) + if (write_ac_socket(2, log_buffer, strlen(log_buffer)) == -1) { } @@ -5244,7 +5245,7 @@ int start_process( pjob->ji_grpcache->gc_homedir, strerror(errno)); - if (write(2, log_buffer, strlen(log_buffer)) == -1) + if (write_ac_socket(2, log_buffer, strlen(log_buffer)) == -1) { } @@ -5277,7 +5278,7 @@ int start_process( argv[0], strerror(errno)); - if (write(2, log_buffer, strlen(log_buffer)) == -1) + if (write_ac_socket(2, log_buffer, strlen(log_buffer)) == -1) { } @@ -6418,7 +6419,7 @@ static void starter_return( sjrtn->sj_code = code; - if (write(upfds, (char *)sjrtn, sizeof(*sjrtn)) == -1) + if (write_ac_socket(upfds, (char *)sjrtn, sizeof(*sjrtn)) == -1) { } @@ -6439,7 +6440,7 @@ static void starter_return( do { alarm(120); - i = read(downfds, &ack, sizeof(ack)); + i = read_ac_socket(downfds, &ack, sizeof(ack)); alarmsecs = alarm(0); if ((i == -1) && (errno != EINTR)) @@ -7681,7 +7682,7 @@ int TMomCheckJobChild( for (;;) { - i = read(TJE->jsmpipe[0], (char *) &TJE->sjr, read_size); + i = read_ac_socket(TJE->jsmpipe[0], (char *) &TJE->sjr, read_size); if ((i == -1) && (errno == EINTR)) continue; diff --git a/src/resmom/test/alps_reservations/scaffolding.c b/src/resmom/test/alps_reservations/scaffolding.c index bf36b5cf07..91ef1ec7ee 100644 --- a/src/resmom/test/alps_reservations/scaffolding.c +++ b/src/resmom/test/alps_reservations/scaffolding.c @@ -64,7 +64,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; @@ -293,7 +293,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); @@ -303,7 +303,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) { @@ -514,7 +514,7 @@ 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) { return(ENOMEM); } @@ -888,7 +888,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; @@ -896,7 +896,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() */ @@ -1029,3 +1029,13 @@ void *get_thing_from_index( } /* END get_thing_from_index() */ + +ssize_t write_ac_socket(int fd, const void *buf, ssize_t count) + { + return(0); + } + +ssize_t read_ac_socket(int fd, void *buf, ssize_t count) + { + return(0); + } diff --git a/src/resmom/test/alps_reservations/test_alps_reservations.c b/src/resmom/test/alps_reservations/test_alps_reservations.c index 2208b71b6e..4b53c40531 100644 --- a/src/resmom/test/alps_reservations/test_alps_reservations.c +++ b/src/resmom/test/alps_reservations/test_alps_reservations.c @@ -219,7 +219,7 @@ START_TEST(execute_reservation_test) snprintf(cmdbuf, sizeof(cmdbuf), "%s %d", cmd, rid); rc = execute_reservation(cmdbuf, &rsv_id); - snprintf(buf, sizeof(buf), "Failed to execute the command '%s'", cmdbuf); + snprintf(buf, sizeof(buf), "Failed to execute the command '%s', rc=%d", cmdbuf, rc); fail_unless(rc == 0, buf); snprintf(buf, sizeof(buf), "Reservation id should be 30 but is '%s'", rsv_id); fail_unless(!strcmp(rsv_id, "30"), buf); diff --git a/src/resmom/test/catch_child/scaffolding.c b/src/resmom/test/catch_child/scaffolding.c index 592cea9c94..00e83aed1c 100644 --- a/src/resmom/test/catch_child/scaffolding.c +++ b/src/resmom/test/catch_child/scaffolding.c @@ -54,7 +54,7 @@ resource_def *svr_resc_def; /* resc_def_all.c */ char *path_epiloguser; /* mom_main.c */ char *path_epilog; /* mom_main.c */ int PBSNodeCheckEpilog = 1; /* mom_main.c */ /* 1 to trigger conditions */ -char *msg_daemonname = "unset"; /* pbs_log.c */ +const char *msg_daemonname = "unset"; /* pbs_log.c */ char *path_jobs; /* mom_main.c */ tlist_head mom_polljobs; /* mom_main.c */ char *path_epiloguserp; /* mom_main.c */ @@ -1235,7 +1235,7 @@ u_long addclient(const char *name) return 0; } -int find_attr(struct attribute_def *attr_def, char *name, int limit) +int find_attr(struct attribute_def *attr_def, const char *name, int limit) { int rc = 0; if (func_num == INIT_ABORT_JOBS) diff --git a/src/resmom/test/checkpoint/scaffolding.c b/src/resmom/test/checkpoint/scaffolding.c index baf052fb47..16ca5d2c04 100644 --- a/src/resmom/test/checkpoint/scaffolding.c +++ b/src/resmom/test/checkpoint/scaffolding.c @@ -97,7 +97,7 @@ int mom_does_checkpoint() exit(1); } -int decode_str(pbs_attribute *patr, const char *name, char *rescn, char *val, int perm) +int decode_str(pbs_attribute *patr, const char *name, const char *rescn, const char *val, int perm) { fprintf(stderr, "The call to decode_str needs to be mocked!!\n"); exit(1); @@ -121,7 +121,7 @@ int pbs_alterjob(int c, char *jobid, struct attrl *attrib, char *extend) exit(1); } -char * csv_find_value(char *csv_str, char *search_str) +char * csv_find_value(const char *csv_str, char *search_str) { fprintf(stderr, "The call to csv_find_value needs to be mocked!!\n"); exit(1); @@ -187,7 +187,7 @@ int remtree(char *dirname) exit(1); } -char * csv_find_string(char *csv_str, char *search_str) +char * csv_find_string(const char *csv_str, char *search_str) { fprintf(stderr, "The call to csv_find_string needs to be mocked!!\n"); exit(1); diff --git a/src/resmom/test/generate_alps_status/scaffolding.c b/src/resmom/test/generate_alps_status/scaffolding.c index 93343c37b1..22b705ff4a 100644 --- a/src/resmom/test/generate_alps_status/scaffolding.c +++ b/src/resmom/test/generate_alps_status/scaffolding.c @@ -111,7 +111,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; @@ -168,7 +168,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); @@ -178,7 +178,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/resmom/test/generate_alps_status/test_generate_alps_status.c b/src/resmom/test/generate_alps_status/test_generate_alps_status.c index fab70c2052..fa8d515ccd 100644 --- a/src/resmom/test/generate_alps_status/test_generate_alps_status.c +++ b/src/resmom/test/generate_alps_status/test_generate_alps_status.c @@ -33,9 +33,9 @@ char *sample_start24 = "