/** * @brief * -PBS_resc() - internal common code for sending resource requests * * @par Functionality: * Formats and sends the requests for pbs_rescquery(), pbs_rescreserve(), * and pbs_rescfree(). Note, while the request is overloaded for all * three, each has its own expected reply format. * * @param[in] c - communication handle * @param[in] reqtype - request type * @param[in] rescl- pointer to resource list * @param[in] ct - count of query strings * @param[in] rh - resource handle * * @return int * @retval 0 success * @retval !0 error * */ static int PBS_resc(int c, int reqtype, char **rescl, int ct, pbs_resource_t rh) { int rc; int sock; sock = connection[c].ch_socket; /* setup DIS support routines for following DIS calls */ DIS_tcp_setup(sock); if ((rc = encode_DIS_ReqHdr(sock, reqtype, pbs_current_user)) || (rc = encode_DIS_Resc(sock, rescl, ct, rh)) || (rc = encode_DIS_ReqExtend(sock, (char *)0))) { connection[c].ch_errtxt = strdup(dis_emsg[rc]); if (connection[c].ch_errtxt == NULL) { pbs_errno = PBSE_SYSTEM; } else { pbs_errno = PBSE_PROTOCOL; } return (pbs_errno); } if (DIS_tcp_wflush(sock)) { return (pbs_errno = PBSE_PROTOCOL); } return (0); }
static int PBS_resc( int c, int reqtype, char **rescl, int ct, resource_t rh) { int rc; int sock; struct tcp_chan *chan = NULL; sock = connection[c].ch_socket; /* setup DIS support routines for following DIS calls */ if ((chan = DIS_tcp_setup(sock)) == NULL) { pthread_mutex_unlock(connection[c].ch_mutex); rc = PBSE_PROTOCOL; return rc; } else if ((rc = encode_DIS_ReqHdr(chan, reqtype, pbs_current_user)) || (rc = encode_DIS_Resc(chan, rescl, ct, rh)) || (rc = encode_DIS_ReqExtend(chan, (char *)0))) { connection[c].ch_errtxt = strdup(dis_emsg[rc]); pthread_mutex_unlock(connection[c].ch_mutex); DIS_tcp_cleanup(chan); return (PBSE_PROTOCOL); } if (DIS_tcp_wflush(chan)) { rc = PBSE_PROTOCOL; } DIS_tcp_cleanup(chan); return rc; } /* END PBS_resc() */