Пример #1
0
int PBSD_selectattr_put(

  int             c,
  int             type,
  struct attropl *attropl,
  struct attrl   *attrib,
  char           *extend)

  {
  int rc = PBSE_NONE;
  int sock;
  struct tcp_chan *chan = NULL;
  
  if ((c < 0) || 
      (c >= PBS_NET_MAX_CONNECTIONS))
    {
    return(PBSE_IVALREQ);
    }

  pthread_mutex_lock(connection[c].ch_mutex);

  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, type, pbs_current_user)) ||
      (rc = encode_DIS_attropl(chan, attropl)) ||
      (rc = encode_DIS_attrl(chan, attrib)) ||
      (rc = encode_DIS_ReqExtend(chan, extend)))
    {
    connection[c].ch_errtxt = strdup(dis_emsg[rc]);

    pthread_mutex_unlock(connection[c].ch_mutex);
    DIS_tcp_cleanup(chan);
    return (PBSE_PROTOCOL);
    }

  pthread_mutex_unlock(connection[c].ch_mutex);

  /* write data */

  if (DIS_tcp_wflush(chan))
    {
    rc = PBSE_PROTOCOL;
    }

  DIS_tcp_cleanup(chan);
  return rc;
  } /* END PBSD_selectattr_put() */
Пример #2
0
/**
 * @brief encode the Modify Reservation request for sending to the server.
 *
 * @param[in] sock - socket descriptor for the connection.
 * @param[in] resv_id - Reservation identifier of the reservation that would be modified.
 * @param[in] aoplp - list of attributes that will be modified.
 *
 * @return - error code while writing data to the socket.
 */
int
encode_DIS_ModifyResv(int sock, char *resv_id, struct attropl *aoplp)
{
	int   rc = 0;

	if (resv_id == NULL)
		resv_id = "";

	if (((rc = diswui(sock, MGR_OBJ_RESV)) != 0) ||
		((rc = diswst(sock, resv_id)) != 0))
			return rc;

	return (encode_DIS_attropl(sock, aoplp));
}
Пример #3
0
int
encode_DIS_SubmitResv(int sock, char *resv_id, struct attropl *aoplp)
{
	int   rc;

	if (resv_id == NULL)
		resv_id = "";

	/* send the reservation ID and then an empty destination
	 * This is done so the server can use the queuejob structure
	 */
	if ((rc = diswst(sock, resv_id) != 0) ||
		(rc = diswst(sock, "") != 0))
			return rc;

	return (encode_DIS_attropl(sock, aoplp));
}
Пример #4
0
int encode_DIS_QueueJob(

  struct tcp_chan *chan,
  const char  *jobid,
  const char  *destin,
  struct attropl *aoplp)

  {
  int   rc;

  if (jobid == (char *)0)
    jobid = (char *)"";

  if (destin == (char *)0)
    destin = (char *)"";

  if ((rc = diswst(chan, jobid) != 0) ||
      (rc = diswst(chan, destin) != 0))
    {
    return rc;
    }

  return(encode_DIS_attropl(chan, aoplp));
  }  /* END encode_DIS_QueueJob() */