Esempio n. 1
0
int
rgetRusageCompletionHandler_(struct lsRequest *request)
{
    XDR xdrs;
    int rc;

    rc = resRC2LSErr_(request->rc);
    if (rc != 0)
	return -1;
    xdrmem_create(&xdrs, request->replyBuf, request->replyBufLen, XDR_DECODE);
    if (! xdr_jRusage(&xdrs, (struct jRusage *)request->extra, NULL)) {
	lserrno = LSE_BAD_XDR;
	xdr_destroy(&xdrs);
	return -1;
    }

    xdr_destroy(&xdrs);
    return 0;

}
Esempio n. 2
0
bool_t 
xdr_statusReq (XDR *xdrs, struct statusReq *statusReq, struct LSFHeader *hdr)
{
    int i;
    int jobArrId, jobArrElemId;

    if (xdrs->x_op == XDR_FREE) {
        for(i=0; i < statusReq->numExecHosts; i++)
            FREEUP(statusReq->execHosts[i]);
        if (statusReq->numExecHosts > 0)
            FREEUP(statusReq->execHosts);
        statusReq->numExecHosts = 0;
        FREEUP (statusReq->execHome);
        FREEUP (statusReq->execCwd);
        FREEUP (statusReq->queuePreCmd);
        FREEUP (statusReq->queuePostCmd);
        FREEUP (statusReq->execUsername);
        if (statusReq->runRusage.npids > 0)
            FREEUP (statusReq->runRusage.pidInfo);
        if (statusReq->runRusage.npgids > 0)
            FREEUP (statusReq->runRusage.pgid);
        return(TRUE);
    }

    if (xdrs->x_op == XDR_ENCODE) {
	jobId64To32(statusReq->jobId, &jobArrId, &jobArrElemId);
    }
    if (!(xdr_int(xdrs,&jobArrId) &&
	  xdr_int(xdrs,&statusReq->jobPid) &&
	  xdr_int(xdrs,&statusReq->jobPGid) &&
	  xdr_int(xdrs,&statusReq->actPid) &&	  	  
	  xdr_int(xdrs,&statusReq->seq)        &&
	  xdr_int(xdrs, &statusReq->newStatus) &&
	  xdr_int(xdrs,&statusReq->reason) &&
	  xdr_int(xdrs,&statusReq->subreasons) &&	  
	  xdr_int(xdrs, (int *) &statusReq->sbdReply)))
        return (FALSE);

    
    if (!xdr_arrayElement(xdrs, (char *) &statusReq->lsfRusage, hdr,
			  xdr_lsfRusage))
        return (FALSE);

    if (!(xdr_int(xdrs, &statusReq->execUid) &&
          xdr_int(xdrs, &statusReq->numExecHosts)))
        return(FALSE);
    if (xdrs->x_op == XDR_DECODE) {
        if (statusReq->numExecHosts > 0) {
            statusReq->execHosts = (char **) calloc(statusReq->numExecHosts,
                                     sizeof(char *));
            if (!statusReq->execHosts)
                return(FALSE);
        }
    }
    if (!xdr_array_string(xdrs, statusReq->execHosts, MAXHOSTNAMELEN,
                                                      statusReq->numExecHosts))
        return(FALSE);
    if (!(xdr_int(xdrs, &statusReq->exitStatus) &&
          xdr_var_string(xdrs, &statusReq->execHome) &&
	  xdr_var_string(xdrs, &statusReq->execUsername) &&
	  xdr_var_string(xdrs, &statusReq->execCwd) &&
	  xdr_var_string(xdrs, &statusReq->queuePreCmd) &&
	  xdr_var_string(xdrs, &statusReq->queuePostCmd)))
	return(FALSE);


    if (!xdr_int(xdrs, &statusReq->msgId))
        return (FALSE);


    
    if (!(xdr_jRusage(xdrs, &(statusReq->runRusage), hdr)))
        return (FALSE);

    if (!(xdr_int(xdrs, &(statusReq->sigValue)) &&
         xdr_int(xdrs, &(statusReq->actStatus))))
        return(FALSE);

    if (!xdr_int(xdrs, &jobArrElemId)) {
        return (FALSE);
    }

    if (xdrs->x_op == XDR_DECODE) {
	jobId32To64(&statusReq->jobId,jobArrId,jobArrElemId);
    }  
  
    return(TRUE);
}