コード例 #1
0
ファイル: lib.rtask.c プロジェクト: ReiAyanamiQH/jhlava
int
lsRGetpgrp_(int sock, int taskid, int pid)
{
    struct _buf_ {
	struct LSFHeader hdrBuf;
	struct resPid pidBuf;
    } buf;
    LS_REQUEST_T *request;
    char host[MAXHOSTNAMELEN];

    struct resPid pidReq;
    int s, pgid;

    s = sock;
    gethostbysock_(s, host);

    if (!FD_ISSET(s,&connection_ok_)){
        FD_SET(s,&connection_ok_);
        if (ackReturnCode_(s) < 0) {
            closesocket(s);
            _lostconnection_(host);
            return (-1);
        }
    }

    pidReq.rpid = taskid;
    pidReq.pid = pid;

    if (callRes_(s, RES_GETPID, (char *) &pidReq, (char *) &buf,
		 sizeof(buf), xdr_resGetpid, 0, 0, NULL) == -1) {
        closesocket(s);
        _lostconnection_(host);
        return (-1);
    }

    request = lsReqHandCreate_(taskid, 
			       currentSN, 
			       s, 
			       (void *)&pgid,
			       rgetpidCompletionHandler_,
			       (appCompletionHandler) NULL,
			       NULL);

    if (request == NULL)
        return(-1);

    if (lsQueueDataAppend_((char *)request, requestQ))
        return(-1);

    if (lsReqWait_(request, 0) < 0)
        return (-1);

    lsReqFree_(request);

    return(pgid);

} 
コード例 #2
0
ファイル: lib.res.c プロジェクト: CraigNoble/openlava
int
lsRGetRusage(int rpid, struct jRusage *ru, int options)
{
    LS_REQUEST_T *request;

    request = lsIRGetRusage_(rpid,
			     ru,
			     (appCompletionHandler) NULL,
			     NULL,
			     options);

    if (! request)
	return -1;

    if (lsReqWait_(request, 0) < 0)
        return -1;

    lsReqFree_(request);

    return 0;
}
コード例 #3
0
ファイル: lib.res.c プロジェクト: CraigNoble/openlava
int
lsGetRProcRusage(char *host, int pid, struct jRusage *ru, int options)
{
    struct {
	struct LSFHeader hdr;
	struct resRusage rusageReq;
    } requestBuf;

    struct lsRequest *request;
    struct resRusage rusageReq;
    int s;
    int descriptor[2];

    if (_isconnected_(host, descriptor))
      s = descriptor[0];
    else {
	lserrno = LSE_LOSTCON;
	return -1;
    }

    if (!FD_ISSET(s,&connection_ok_)){
	FD_SET(s,&connection_ok_);
	if (ackReturnCode_(s) < 0) {
	    closesocket(s);
	    _lostconnection_(host);
	    return -1;
	}
    }

    rusageReq.rid = pid;
    rusageReq.whatid = RES_RID_ISPID;

    if (options & RES_RPID_KEEPPID) {
	rusageReq.options |= RES_RPID_KEEPPID;
    } else {
	rusageReq.options = 0;
    }

    if (callRes_(s, RES_RUSAGE, (char *)&rusageReq, (char *)&requestBuf,
		 sizeof(requestBuf), xdr_resGetRusage, 0, 0, NULL) == -1) {
	closesocket(s);
	_lostconnection_(host);
	return -1;
    }

    request = lsReqHandCreate_(pid,
			       currentSN,
			       s,
			       (void *)ru,
			       rgetRusageCompletionHandler_,
			       NULL,
			       NULL);

    if (request == NULL)
        return -1;

    if (lsQueueDataAppend_((char *)request, requestQ))
        return -1;


    if (! request)
	return -1;

    if (lsReqWait_(request, 0) < 0)
        return -1;

    lsReqFree_(request);

    return 0;

}