void TAO::Unknown_IDL_Type::_tao_decode (TAO_InputCDR & cdr) { // @@ (JP) The following code depends on the fact that // TAO_InputCDR does not contain chained message blocks, // otherwise <begin> and <end> could be part of // different buffers! // This will be the start of a new message block. char const * const begin = cdr.rd_ptr (); // Skip over the next argument. TAO::traverse_status const status = TAO_Marshal_Object::perform_skip (this->type_, &cdr); if (status != TAO::TRAVERSE_CONTINUE) { throw ::CORBA::MARSHAL (); } // This will be the end of the new message block. char const * const end = cdr.rd_ptr (); // The ACE_CDR::mb_align() call can shift the rd_ptr by up to // ACE_CDR::MAX_ALIGNMENT - 1 bytes. Similarly, the offset adjustment // can move the rd_ptr by up to the same amount. We accommodate // this by including 2 * ACE_CDR::MAX_ALIGNMENT bytes of additional // space in the message block. size_t const size = end - begin; ACE_Message_Block new_mb (size + 2 * ACE_CDR::MAX_ALIGNMENT); ACE_CDR::mb_align (&new_mb); ptrdiff_t offset = ptrdiff_t (begin) % ACE_CDR::MAX_ALIGNMENT; if (offset < 0) { offset += ACE_CDR::MAX_ALIGNMENT; } new_mb.rd_ptr (offset); new_mb.wr_ptr (offset + size); ACE_OS::memcpy (new_mb.rd_ptr (), begin, size); this->cdr_.reset (&new_mb, cdr.byte_order ()); this->cdr_.char_translator (cdr.char_translator ()); this->cdr_.wchar_translator (cdr.wchar_translator ()); this->cdr_.set_repo_id_map (cdr.get_repo_id_map ()); this->cdr_.set_codebase_url_map (cdr.get_codebase_url_map ()); this->cdr_.set_value_map (cdr.get_value_map ()); // Take over the GIOP version, the input cdr can have a different // version then our current GIOP version. ACE_CDR::Octet major_version; ACE_CDR::Octet minor_version; cdr.get_version (major_version, minor_version); this->cdr_.set_version (major_version, minor_version); }
/** * create new mailbox in hashtable for given pid */ mailbox* create_mailbox(pid_t pid) { mailbox* mb = new_mb(); unsigned hashval; mb->stop = FALSE; mb->full = FALSE; mb->size = 0; mb->pid = pid; mb->msg = NULL; spin_lock_init(&(mb->lock)); init_waitqueue_head(&(mb->wait_full)); init_waitqueue_head(&(mb->wait_empty)); hashval = hash(pid); spin_lock(&table_lock); mb->next = all[hashval]; all[hashval] = mb; spin_unlock(&table_lock); return mb; }