Example #1
0
void
Session::default_service (const char *addrspec)
{
   const char *equal = ACE_OS::strchr(addrspec,'=');
  if (equal == 0)
    return;
  ACE_CString name (addrspec,(equal - addrspec));
  Endpoint ep (equal+1);

  static long next_def_pid = 0;
  --next_def_pid;
  HostProcess *hp = new HostProcess ("defaulted",next_def_pid);
  hp->proc_name(name);
  hp->add_listen_endpoint (ep);
  this->processes_.bind(next_def_pid,hp);
  this->procs_by_name_.bind(name,hp);
}
Example #2
0
File: Log.cpp Project: manut/TAO
void
Log::get_preamble ()
{
  char * p = ACE_OS::strstr (this->line_, "(");
  char * t = 0;

  this->info_ = this->line_;

  if (p == 0)
    return;

  if (p != this->line_)
    {
      char * x = ACE_OS::strstr (this->line_, "TAO (");
      if (x+4 != p)
        {
          x = ACE_OS::strstr (this->line_, "@(");
          if (x + 1 != p)
            return;
        }
    }


  long pid = ACE_OS::strtol(p + 1, &t, 10);
  if (pid == 0)
    return;

  long tid = 0;
  if ( *t == '|' )
    tid = ACE_OS::strtol(t + 1, 0, 10);
  else if ( *t != ')')
    return; // not either (pid) or (pid|tid)

  this->info_ = ACE_OS::strstr (p, ")") + 1;
  this->hostproc_ = 0;
  for (ACE_DLList_Iterator<HostProcess> i (this->procs_);
       !i.done();
       i.advance())
    {
      i.next(this->hostproc_);
      if (this->hostproc_->pid() == pid)
        {
          break;
        }
      this->hostproc_ = 0;
    }

  if (this->hostproc_ == 0)
    this->hostproc_ = this->session_.find_process(pid);

  if (this->hostproc_ == 0)
    {
      size_t numprocs = this->procs_.size();
      this->hostproc_ = new HostProcess (this->origin_,pid);
      this->procs_.insert_tail(this->hostproc_);
      ACE_CString &procname = this->alias_.length() > 0 ?
        this->alias_ : this->origin_;
      switch (numprocs)
        {
        case 0:
          this->hostproc_->proc_name(procname);
          break;
        case 1:
          {
            ACE_CString a2 = procname + "_1";
            HostProcess *first;
            if (this->procs_.get(first) == 0)
              first->proc_name(a2);
          }
          //fallthru
        default:
          {
            char ext[10];
            ACE_OS::sprintf(ext,"_" ACE_SIZE_T_FORMAT_SPECIFIER_ASCII,numprocs+1);
            ACE_CString a2 = procname + ext;
            this->hostproc_->proc_name(a2);
          }
        }

      this->session_.add_process (this->hostproc_);
    }
  this->thr_ = this->hostproc_->find_thread (tid, this->offset_);
  return;
}