Пример #1
0
int fowMPINONB ( const char *filename )
{
  static aFiledataM *of;
  static unsigned long buffersize = 0;
  int id;
  enum {
    bcastRoot = 0
  };
  MPI_Comm commNode = commInqCommNode ();
  int rankNode = commInqRankNode ();

  /* broadcast buffersize to collectors ( just once, for all files )*/

  if (!buffersize)
    {
      if (rankNode == bcastRoot)
        buffersize = findWriteAccumBufsize();
      xmpi(MPI_Bcast(&buffersize, 1, MPI_UNSIGNED_LONG, bcastRoot, commNode));
    }

  xdebug("buffersize=%ld", buffersize);

  listSetForeach(bibAFiledataM, elemCheck, (void *)filename);
  of = initAFiledataMPINONB(filename, (size_t)buffersize);

  if ((id = listSetAdd(bibAFiledataM, of)) < 0 )
    xabort("filename %s not unique", of->name);

  xdebug("IOPE%d: name=%s, init and added aFiledataM, return id = %d",
         rankNode, filename, id);
  of->fileID = id;
  return id;
}
Пример #2
0
/* we return 0 even if rmwatch fails, because xmsg_handle_data checks
 * if our session is still connected, so it'll ignore unneeded events */
static COMMAND(xmsg_disconnect)
{
	if (!session_connected_get(session)) {
		printq("not_connected", session_name(session));
		return -1;
	}
	
	xmsg_timer_change(session, NULL);
	if (!timer_remove_session(session, "o"))
		xdebug("old oneshot resume timer removed");
	session_status_set(session, EKG_STATUS_NA);

	if (quiet == -1)
		protocol_disconnected_emit(session, format_find("xmsg_umount"), EKG_DISCONNECT_NETWORK);
	else
		protocol_disconnected_emit(session, NULL, EKG_DISCONNECT_USER);

#ifdef HAVE_INOTIFY
	if (session->priv && inotify_rm_watch(in_fd, (long int) session->priv))
		xdebug2(DEBUG_ERROR, "rmwatch failed");
	else
		xdebug("inotify watch removed: %d", (long int) session->priv);
#endif /*HAVE_INOTIFY*/

	return 0;
}
Пример #3
0
static int
destroyAFiledataMPINONB(void *v)
{
  int iret = 0;
  aFiledataM *of;
  MPI_Status status;
  int rankNode = commInqRankNode ();
  MPI_Offset endpos;

  of = (aFiledataM * ) v;

  xdebug ( "IOPE%d: close file %d, name=\"%s\"",
           rankNode, of->fileID, of->name );

  /* close file */
  xmpi(MPI_Wait(&of->request, &status));
  xmpi(MPI_Barrier(commInqCommNode()));
  xmpi(MPI_File_get_position_shared(of->fh, &endpos));
  xmpi(MPI_File_set_size(of->fh, endpos));
  iret = MPI_File_close ( & ( of->fh ));

  /* file closed, cleanup */

  dbuffer_cleanup ( & ( of->db1 ));
  dbuffer_cleanup ( & ( of->db2 ));

  free ( of );

  xdebug ( "IOPE%d: closed file, cleaned up, return",
           rankNode );

  return iret == MPI_SUCCESS ? 0 : -1;
}
Пример #4
0
bool ADM_latm2aac::pushData(int incomingLen,uint8_t *inData,uint64_t dts)
{
    // Lookup sync
    uint8_t *end=inData+incomingLen;
    uint8_t *start=inData;
    xdebug("Pushing data %d bytes\n",incomingLen);
    while(start<end)
    {
        int key=(start[0]<<8)+start[1];
        if((key & 0xffe0)!=0x56e0)
        {
            ADM_warning("Sync lost\n");
            return true;
        }
        uint32_t len=start[2]+((key & 0x1f)<<8);
        start+=3;
        if(start+len>end)
        {
            ADM_warning("Not enough data, need %d, got %d\n",len,(int)(end-start));
            return true;
        }
        xdebug("Found LATM : size %d\n",len);
        demuxLatm(dts,start,len);
        dts=ADM_NO_PTS;
        // LATM demux
        start+=len;
    }
    xdebug("-- end of this LOAS frame --\n");
    return true;
}
Пример #5
0
static WATCHER(xmsg_handle_data)
{
	int n;
	int c = 0;
	struct inotify_event *evp;

	if (type)
		return -1;

	ioctl(fd, FIONREAD, &n);
	if (n == 0)
		return 0;

	ev = xrealloc(ev, n);
	n = read(fd, ev, n);

	if (n < 0)
		xerrn("inotify read() failed");
	
	for (evp = ev; n > 0; n -= (evp->len + sizeof(struct inotify_event)), evp = (void*) evp + (evp->len + sizeof(struct inotify_event))) {
		session_t *s;

		for (s = sessions; s; s = s->next) {
			if (s && (s->priv == (void*) (long int) evp->wd) && (s->plugin == &xmsg_plugin))
				break;
		}
		
		xdebug("n = %d, wd = %d, str = %s", n, evp->wd, evp->name);
			
		if ((evp->mask & IN_IGNORED) || !s || !session_connected_get(s))
			continue;
		else if (evp->mask & IN_UNMOUNT)
			xmsg_disconnect(NULL, NULL, s, NULL, -1);
		else if (!(evp->mask & IN_Q_OVERFLOW) && (c != -1) && (!xmsg_handle_file(s, evp->name))) 
			c++;
		
		if ((evp->mask & IN_Q_OVERFLOW) || ((config_maxinotifycount > 0) && c >= config_maxinotifycount)) {
			for (s = sessions; s; s = s->next) {
				if (s && (s->plugin == &xmsg_plugin)) {
					const int i = session_int_get(s, "oneshot_resume_timer");
					if (!timer_remove_session(s, "o"))
						xdebug("old oneshot resume timer removed");
					if ((i > 0) && timer_add_session(s, "o", i, 0, xmsg_iterate_dir)) {
						xdebug("oneshot resume timer added");
						session_status_set(s, EKG_STATUS_AWAY);
					} else
						session_status_set(s, EKG_STATUS_AVAIL);
					c = -1;
				}
			}
		}
	}
	if (c >= 0)
		xdebug("processed %d files", c);
	else
		xdebug("reached max_inotifycount");

	return 0;
}
Пример #6
0
int
patable_add(struct patable *table, const char *pattern,
            const void *data)
{
  int i;
  struct patentry *p;
  size_t newsz;
  int ecode, eoff;
  const char *emsg;

  // int options = PCRE_ANCHORED | PCRE_DOLLAR_ENDONLY;
  int options = PCRE_ANCHORED;

  if (table->cur >= table->npat) {
    /* TODO: check if there's a bug here */
    newsz = table->npat * 2;
    p = realloc(table->pat, sizeof(*p) * newsz);
    if (!p)
      return 0;
    for (i = table->npat; i < newsz; i++) {
      table->pat[i].re = 0;
    }
    table->pat = p;
    table->npat = newsz;
  }

  for (i = table->cur; i < table->npat; i++) {
    if (table->pat[i].re == 0) {
      table->pat[i].re = pcre_compile2(pattern, options,
                                       &ecode, &emsg, &eoff, NULL);
      if (!table->pat[i].re) {
        xdebug(0, "invalid regular expresssion in \"%s\": %s", pattern, emsg);
        return 0;
      }
      table->pat[i].ext = pcre_study(table->pat[i].re,
                                     PCRE_STUDY_EXTRA_NEEDED |
                                     PCRE_STUDY_JIT_COMPILE,
                                     &emsg);

      if (!table->pat[i].ext) {
        xdebug(0, "analyzing regular expresssion in \"%s\": %s", pattern, emsg);
        pcre_free(table->pat[i].re);
        table->pat[i].re = 0;
        return 0;
      }
      table->pat[i].data = (void *)data;

      table->cur = i + 1;
      return 1;
    }
  }

  table->cur = i;
  return patable_add(table, pattern, data);
}
Пример #7
0
int
patable_exec(struct patable *table, const char *source, size_t len,
             struct xobs *pool)
{
  int i, j;
  int ovec[OVECTOR_MAX];
  int ngroup;

  char **gvec;

  assert(xobs_object_size(pool) == 0);

  if (len == (size_t)-1)
    len = strlen(source);

  for (i = 0; i < table->cur; i++) {
    assert(table->pat[i].re != 0);
    ngroup = pcre_exec(table->pat[i].re, table->pat[i].ext,
                       source, len,
                       0, /* start offset */
                       0, /* options */
                       ovec, sizeof(ovec) / sizeof(ovec[0]));

    if (ngroup > 0) {
      gvec = xobs_alloc(pool, sizeof(char *) * ngroup);
      if (!gvec) {
        xdebug(errno, "allocating ovector for reg exec failed");
        return 0;
      }

      for (j = 0; j < ngroup; j++) {
        // g0: 0 1
        // g1: 2 3
        // g2: 4 5
        //
        // j = 0 1 2

        gvec[j] = xobs_copy0(pool, source + ovec[j << 1],
                             ovec[(j << 1) + 1] - ovec[j << 1]);
        if (!gvec[j]) {
          xdebug(errno, "allocating ovector string for reg exec failed");
          xobs_free(pool, gvec);
          return 0;
        }
      }
      //table->pat[i].cb(ngroup, gvec);
      xobs_free(pool, gvec);
      return 1;
    }
  }

  return 0;
}
Пример #8
0
static void xmsg_timer_change(session_t *s, const char *varname)
{
	int n = (varname ? session_int_get(s, varname) : 0);
	
	xdebug("n = %d", n);
	if (!varname || session_connected_get(s)) {
		if (!timer_remove_session(s, "w"))
			xdebug("old timer removed");
		if (n > 0) {
			if (timer_add_session(s, "w", n, 1, xmsg_iterate_dir))
				xdebug("new timer added");
		}
	}
}
Пример #9
0
/* kind = 0 for sent, 1 for toobig */
static void xmsg_unlink_dotfiles(session_t *s, const char *varname)
{
	if (session_int_get(s, varname)) {
		const int kind = !xstrcasecmp(varname, "unlink_sent");
		const int maxfs = session_int_get(s, "max_filesize");
		const char *dfsuffix = session_get(s, "dotfile_suffix");
		const char *dir = xmsg_dirfix(session_uid_get(s)+XMSG_UID_DIROFFSET);
		DIR *d;
		struct dirent *de;
		struct stat st, std;
		char *df, *dfd, *dp, *dpd;
		
		if (!dir || !(d = opendir(dir))) {
			xdebug("unable to open specified directory");
			return;
		}
		
		df = xmalloc(xstrlen(dir) + NAME_MAX + 2);
		dfd = xmalloc(xstrlen(dir) + NAME_MAX + 3 + xstrlen(dfsuffix));
		xstrcpy(df, dir);
		dp = df + xstrlen(df);
		*(dp++) = '/';
		xstrcpy(dfd, df);
		dpd = dfd + xstrlen(dfd);
		*(dpd++) = '.';
		
		while ((de = readdir(d))) {
			if (de->d_name[0] == '.')
				continue;
			if (xstrlen(de->d_name) > NAME_MAX) {
				xdebug2(DEBUG_ERROR, "Filename longer than NAME_MAX (%s), skipping.", de->d_name);
				continue;
			}
			xstrcpy(dp, de->d_name);
			xstrcpy(dpd, de->d_name);
			xstrcat(dpd, dfsuffix);
			if (!stat(df, &st) && !stat(dfd, &std)
					&& ((!maxfs || (st.st_size < maxfs)) == kind)) {
				xdebug("removing %s", de->d_name);
				unlink(df);
				unlink(dfd);
			}
		}

		closedir(d);
		xfree(df);
		xfree(dfd);
	}
}
Пример #10
0
static void
serverWinCreate(void)
{
  int ranks[1], modelID;
  MPI_Comm commCalc = commInqCommCalc ();
  MPI_Group groupCalc;
  int nProcsModel = commInqNProcsModel ();
  MPI_Info no_locks_info;
  xmpi(MPI_Info_create(&no_locks_info));
  xmpi(MPI_Info_set(no_locks_info, "no_locks", "true"));

  xmpi(MPI_Win_create(MPI_BOTTOM, 0, 1, no_locks_info, commCalc, &getWin));

  /* target group */
  ranks[0] = nProcsModel;
  xmpi ( MPI_Comm_group ( commCalc, &groupCalc ));
  xmpi ( MPI_Group_excl ( groupCalc, 1, ranks, &groupModel ));

  rxWin = xcalloc((size_t)nProcsModel, sizeof (rxWin[0]));
  size_t totalBufferSize = collDefBufferSizes();
  rxWin[0].buffer = (unsigned char*) xmalloc(totalBufferSize);
  size_t ofs = 0;
  for ( modelID = 1; modelID < nProcsModel; modelID++ )
    {
      ofs += rxWin[modelID - 1].size;
      rxWin[modelID].buffer = rxWin[0].buffer + ofs;
    }

  xmpi(MPI_Info_free(&no_locks_info));

  xdebug("%s", "created mpi_win, allocated getBuffer");
}
Пример #11
0
int xmsg_plugin_init(int prio)
{
	PLUGIN_CHECK_VER("xmsg");
#ifdef HAVE_INOTIFY
	if ((in_fd = inotify_init()) == -1)
		xerrn("unable to init inotify");
#endif /*HAVE_INOTIFY*/
	
	xdebug("inotify fd = %d", in_fd);
	
	xmsg_plugin.params	= xmsg_plugin_vars;
	xmsg_plugin.priv	= &xmsg_priv;
	plugin_register(&xmsg_plugin, prio);

	query_connect_id(&xmsg_plugin, PROTOCOL_VALIDATE_UID, xmsg_validate_uid, NULL);
	query_connect_id(&xmsg_plugin, EKG_SIGUSR1, xmsg_handle_sigusr, NULL);

#define XMSG_CMDFLAGS SESSION_MUSTBELONG
#define XMSG_CMDFLAGS_TARGET SESSION_MUSTBELONG|COMMAND_ENABLEREQPARAMS|COMMAND_PARAMASTARGET|SESSION_MUSTBECONNECTED
	command_add(&xmsg_plugin, "xmsg:", "?", xmsg_inline_msg, XMSG_CMDFLAGS, NULL);
	command_add(&xmsg_plugin, "xmsg:chat", "!uU !", xmsg_msg, XMSG_CMDFLAGS_TARGET, NULL);
	command_add(&xmsg_plugin, "xmsg:connect", NULL, xmsg_connect, XMSG_CMDFLAGS, NULL);
	command_add(&xmsg_plugin, "xmsg:disconnect", NULL, xmsg_disconnect, XMSG_CMDFLAGS, NULL);
	command_add(&xmsg_plugin, "xmsg:msg", "!uU !", xmsg_msg, XMSG_CMDFLAGS_TARGET, NULL);
	command_add(&xmsg_plugin, "xmsg:reconnect", NULL, xmsg_reconnect, XMSG_CMDFLAGS, NULL);
#undef XMSG_CMDFLAGS_TARGET
#undef XMSG_CMDFLAGS

#ifdef HAVE_INOTIFY
	variable_add(&xmsg_plugin, "max_inotifycount", VAR_INT, 1, &config_maxinotifycount, NULL, NULL, NULL);
	watch_add(&xmsg_plugin, in_fd, WATCH_READ, xmsg_handle_data, NULL);
#endif /*HAVE_INOTIFY*/
	
	return 0;
}
Пример #12
0
static void
_reject(isc_session_t *sp, pduq_t *pq)
{
     pduq_t	*opq;
     pdu_t	*pdu;
     reject_t	*reject;
     int	itt;

     debug_called(8);
     pdu = mtod(pq->mp, pdu_t *);
     itt = pdu->ipdu.bhs.itt;
     reject = &pq->pdu.ipdu.reject;
     sdebug(2, "itt=%x reason=0x%x", ntohl(itt), reject->reason);
     opq = i_search_hld(sp, itt, 0);
     if(opq != NULL)
	  iscsi_reject(sp, opq, pq);
     else {
	  switch(pq->pdu.ipdu.bhs.opcode) {
	  case ISCSI_LOGOUT_CMD: // XXX: wasabi does this - can't figure out why
	       sdebug(2, "ISCSI_LOGOUT_CMD ...");
	       break;
	  default:
	       xdebug("%d] we lost something itt=%x",
		      sp->sid, ntohl(pq->pdu.ipdu.bhs.itt));
	  }
     }
     pdu_free(sp->isc, pq);
}
Пример #13
0
std::string dove::build_rankline(rapidxml::xml_document<char> &system,
    int taskid, 
    std::string id) {
  xdebug("Building rankline");
  dove::hwcom com = parse_pids(system, id);

  int type = com.type;
  switch (type) {
  case HW_THREAD:
    // TODO support threads
    throw "Only supports cores for now";
    break;
  case CORE:
    return build_rankline_core(taskid, com);
  case SOCKET:
    // TODO support sockets
    throw "Only supports cores for now";
    break;
  case HOST: 
    throw "Only supports cores for now";
    // TODO support hosts
    break;
  case UNKNOWN:
  default: 
    throw "Unknown hardware component type";
    break;
  }
  throw "Unknown state";
}
Пример #14
0
static int
ic_scan(isc_session_t *sp)
{
     union ccb	*ccb;

     debug_called(8);
     sdebug(2, "scanning sid=%d", sp->sid);

     if((ccb = malloc(sizeof(union ccb), M_TEMP, M_WAITOK | M_ZERO)) == NULL) {
	  xdebug("scan failed (can't allocate CCB)");
	  return ENOMEM; // XXX
     }

     sp->flags &= ~ISC_CAMDEVS;
     sp->flags |= ISC_SCANWAIT;

     CAM_LOCK(sp);
     if(xpt_create_path(&sp->cam_path, NULL, cam_sim_path(sp->cam_sim),
			0, CAM_LUN_WILDCARD) != CAM_REQ_CMP) {
	  xdebug("can't create cam path");
	  CAM_UNLOCK(sp);
	  free(ccb, M_TEMP);
	  return ENODEV; // XXX
     }
     xpt_setup_ccb(&ccb->ccb_h, sp->cam_path, 5/*priority (low)*/);
     ccb->ccb_h.func_code	= XPT_SCAN_BUS;
     ccb->ccb_h.cbfcnp		= scan_callback;
     ccb->crcn.flags		= CAM_FLAG_NONE;
     ccb->ccb_h.spriv_ptr0	= sp;

     xpt_action(ccb);
     CAM_UNLOCK(sp);

     while(sp->flags & ISC_SCANWAIT)
	  tsleep(sp, PRIBIO, "ffp", 5*hz); // the timeout time should
					    // be configurable
     sdebug(2, "# of luns=%d", sp->target_nluns);

     if(sp->target_nluns > 0) {
	  sp->flags |= ISC_CAMDEVS;
	  return 0;
     }

     return ENODEV;
}
Пример #15
0
void finalizeMPINONB(void)
{
  if (!listSetIsEmpty(bibAFiledataM))
    xabort("set bibAFiledataM not empty");
  else
    {
      xdebug("%s", "destroy set");
      listSetDelete(bibAFiledataM);
    }
}
Пример #16
0
static
void getTimeStepData()
{
  int modelID;
  char text[1024];
  int nProcsModel = commInqNProcsModel ();
  void *getWinBaseAddr;
  int attrFound;

  xdebug("%s", "START");

  for ( modelID = 0; modelID < nProcsModel; modelID++ )
    clearModelWinBuffer(modelID);
  // todo put in correct lbs and ubs
  xmpi(MPI_Win_start(groupModel, 0, getWin));
  xmpi(MPI_Win_get_attr(getWin, MPI_WIN_BASE, &getWinBaseAddr, &attrFound));
  xassert(attrFound);
  for ( modelID = 0; modelID < nProcsModel; modelID++ )
    {
      xdebug("modelID=%d, nProcsModel=%d, rxWin[%d].size=%zu,"
             " getWin=%p, sizeof(int)=%u",
             modelID, nProcsModel, modelID, rxWin[modelID].size,
             getWinBaseAddr, (unsigned)sizeof(int));
      /* FIXME: this needs to use MPI_PACK for portability */
      xmpi(MPI_Get(rxWin[modelID].buffer, (int)rxWin[modelID].size,
                   MPI_UNSIGNED_CHAR, modelID, 0,
                   (int)rxWin[modelID].size, MPI_UNSIGNED_CHAR, getWin));
    }
  xmpi ( MPI_Win_complete ( getWin ));

  if ( ddebug > 2 )
    for ( modelID = 0; modelID < nProcsModel; modelID++ )
      {
        sprintf(text, "rxWin[%d].size=%zu from PE%d rxWin[%d].buffer",
                modelID, rxWin[modelID].size, modelID, modelID);
        xprintArray(text, rxWin[modelID].buffer,
                    (int)(rxWin[modelID].size / sizeof (double)),
                    DATATYPE_FLT);
      }
  readGetBuffers();

  xdebug("%s", "RETURN");
}
Пример #17
0
/**
    \fn getData
    \brief pop one packet from packet queue
*/
bool ADM_latm2aac::getData(uint64_t *time,uint32_t *len, uint8_t *data, uint32_t maxSize)
{
    if(empty()) return false;
    xdebug("%d slogs in latm buffers\n",listOfUsedBuffers.size());
    latmBuffer *b=listOfUsedBuffers.front();
    listOfUsedBuffers.pop_front();
    listOfFreeBuffers.push_back(b);
    if(b->bufferLen>maxSize)
    {
        ADM_warning("Buffer too small\n");
        return false;

    }
    memcpy(data,b->buffer,b->bufferLen);
    *len=b->bufferLen;
    b->bufferLen=0;
    *time=b->dts;
    xdebug("   read %d bytes\n",*len);
    return true;
}
Пример #18
0
void
init_jobs (void)
{
    xdebug (NULL);
    list = xmalloc (sizeof (*list));
    if (list != NULL)
    {
        list->head = NULL;
        list->tail = NULL;
        list->size = 0;
    }
}
Пример #19
0
void
clear_jobs (void)
{
    xdebug (NULL);
    job *tmp = list->head;
    while (tmp != NULL)
    {
        job *tmp2 = tmp->next;
        clear_job (tmp);
        tmp = tmp2;
    }
    xfree (list);
}
Пример #20
0
static QUERY(xmsg_handle_sigusr)
{
	session_t *s;

	for (s = sessions; s; s = s->next) {
		if (!timer_remove_session(s, "o"))
			xdebug("old oneshot resume timer removed");
		if (s && (s->plugin == &xmsg_plugin))
			xmsg_iterate_dir(0, (void*) s);
	}

	return 0;
}
Пример #21
0
static
void serverWinCleanup ()
{
  if (getWin != MPI_WIN_NULL)
    xmpi(MPI_Win_free(&getWin));
  if (rxWin)
    {
      free(rxWin[0].buffer);
      free(rxWin);
    }

  xdebug("%s", "cleaned up mpi_win");
}
Пример #22
0
static void
_scsi_rsp(isc_session_t *sp, pduq_t *pq)
{
     pduq_t	*opq;

     debug_called(8);
     opq = i_search_hld(sp, pq->pdu.ipdu.bhs.itt, 0);
     debug(5, "itt=%x pq=%p opq=%p", ntohl(pq->pdu.ipdu.bhs.itt), pq, opq);
     if(opq != NULL)
	  iscsi_done(sp, opq, pq);
     else
	  xdebug("%d] we lost something itt=%x",
		 sp->sid, ntohl(pq->pdu.ipdu.bhs.itt));
     pdu_free(sp->isc, pq);
}
Пример #23
0
static TIMER_SESSION(xmsg_iterate_dir)
{
	const char *dir;
	DIR *d;
	struct dirent *de;
	int n = 0;
	const int maxn = session_int_get(s, "max_oneshot_files");

	if (type || !s || !session_connected_get(s))
		return -1;
	
	session_status_set(s, EKG_STATUS_AVAIL);
	if (!(dir = xmsg_dirfix(session_uid_get(s)+XMSG_UID_DIROFFSET))
			|| !(d = opendir(dir))) {

		xerr("unable to open specified directory");
		return 0;
	}
	
	while ((de = readdir(d))) {
		if (!xmsg_handle_file(s, de->d_name))
			n++;
		
		if ((maxn > 0) && n >= maxn) {
			const int i = session_int_get(s, "oneshot_resume_timer");
			if ((i > 0) && timer_add_session(s, "o", i, 0, xmsg_iterate_dir))
				xdebug("oneshot resume timer added");
			session_status_set(s, EKG_STATUS_AWAY);
			break;
		}
	}
	closedir(d);
	xdebug("processed %d files", n);

	return 0;
}
Пример #24
0
// TODO consider creating dove::xml and moving all of my 
// helper functions into that namespace to keep it clean
std::vector<rapidxml::xml_node<char>*> dove::get_all_hosts(
    rapidxml::xml_document<char> &system) {
  xdebug("Getting all hosts from system.xml");
  rapidxml::xml_node<>* nodes = system.first_node("system")->
    first_node("nodes");
  
  std::vector<rapidxml::xml_node<char>*> result;
  for (rapidxml::xml_node<char> *child = nodes->first_node();
      child;
      child = child->next_sibling()) {
    if (strcmp(child->name(), "node")==0)
      result.push_back(child);
  }
  
  return result;
}
Пример #25
0
int fcMPINONB ( int fileID )
{
  aFiledataM *of;
  int rankNode = commInqRankNode ();

  xdebug("IOPE%d: write buffer, close file and cleanup, in %d",
         rankNode, fileID );

  if (!(of = listSetGet(bibAFiledataM, fileIDTest, (void *)(intptr_t)fileID)))
    xabort("listSet, fileID=%d not found", fileID);

  writeMPINONB(of);

  /* remove file element */
  int iret = listSetRemove(bibAFiledataM, fileIDTest, (void *)(intptr_t)fileID);
  return iret;
}
Пример #26
0
static void
_read_data(isc_session_t *sp, pduq_t *pq)
{
     pduq_t		*opq;

     debug_called(8);
     opq = i_search_hld(sp, pq->pdu.ipdu.bhs.itt, 1);
     if(opq != NULL) {
	  if(scsi_decap(sp, opq, pq) != 1) {
	       i_remove_hld(sp, opq); // done
	       pdu_free(sp->isc, opq);
	  }
     }
     else
	  xdebug("%d] we lost something itt=%x",
		 sp->sid, ntohl(pq->pdu.ipdu.bhs.itt));
     pdu_free(sp->isc, pq);
}
Пример #27
0
static void
_r2t(isc_session_t *sp, pduq_t *pq)
{
     pduq_t	*opq;

     debug_called(8);
     opq = i_search_hld(sp, pq->pdu.ipdu.bhs.itt, 1);
     if(opq != NULL) {
	  iscsi_r2t(sp, opq, pq);
     } 
     else {
	  r2t_t		*r2t = &pq->pdu.ipdu.r2t;

	  xdebug("%d] we lost something itt=%x r2tSN=%d bo=%x ddtl=%x",
		 sp->sid, ntohl(pq->pdu.ipdu.bhs.itt),
		 ntohl(r2t->r2tSN), ntohl(r2t->bo), ntohl(r2t->ddtl));
     }
     pdu_free(sp->isc, pq);
}
Пример #28
0
static void
myVarPart(struct PPM_extent varShape[3], struct xyzDims collGrid,
          struct PPM_extent myPart[3])
{
  int32_t myCollGridCoord[3];
  {
    struct PPM_extent collGridShape[3];
    for (int i = 0; i < 3; ++i)
      {
        collGridShape[i].first = 0;
        collGridShape[i].size = collGrid.sizes[i];
      }
    PPM_lidx2rlcoord_e(3, collGridShape, commInqRankColl(), myCollGridCoord);
    xdebug("my coord: (%d, %d, %d)", myCollGridCoord[0], myCollGridCoord[1],
           myCollGridCoord[2]);
  }
  PPM_uniform_partition_nd(3, varShape, collGrid.sizes,
                           myCollGridCoord, myPart);
}
Пример #29
0
int
patable_add(struct patable *table, const char *pattern,
            const void *data)
{
  int i;
  struct patentry *p;
  size_t newsz;
  int ecode;

  if (table->cur >= table->npat) {
    /* TODO: check if there's a bug here */
    newsz = table->npat * 2;
    p = realloc(table->pat, sizeof(*p) * newsz);
    if (!p)
      return 0;

    for (i = table->npat; i < newsz; i++) {
      table->pat[i].used = 0;
    }
    table->pat = p;
    table->npat = newsz;
  }

  for (i = table->cur; i < table->npat; i++) {
    if (!table->pat[i].used) {
      ecode = regcomp(&table->pat[i].re, pattern, REG_EXTENDED);
      if (ecode != 0) {
        char buf[LINE_MAX];
        regerror(ecode, &table->pat[i].re, buf, sizeof(buf));
        xdebug(0, "invalid regular expression in \"%s\": %s", pattern, buf);
        return 0;
      }
      table->pat[i].data = (void *)data;
      table->cur = i + 1;
      table->pat[i].used = 1;
      return 1;
    }
  }

  table->cur = i;
  return patable_add(table, pattern, data);
}
Пример #30
0
std::vector<rapidxml::xml_node<char>*> dove::get_all_threads(
    rapidxml::xml_document<char> &system) {
  xdebug("Getting all threads from system.xml");
  xml_node_vector result;
  xml_node_vector cores = get_all_cores(system);
  xml_node_vector::iterator it;
  for (it = cores.begin();
      it != cores.end();
      ++it) {
    rapidxml::xml_node<char>* core = *it;
    for (rapidxml::xml_node<char>* hwth = core->first_node();
        hwth;
        hwth = hwth->next_sibling()) {
      if (strcmp(hwth->name(), "pu")==0)
        result.push_back(hwth);
    }
  }
  
  return result;
}