Ejemplo n.º 1
0
//!	Removes a report request.
void
KPPPReportManager::DisableReports(ppp_report_type type, thread_id thread)
{
	if (thread < 0)
		return;
	
	LockerHelper locker(fLock);
	
	ppp_report_request *request;
	
	for (int32 i = 0; i < fReportRequests.CountItems(); i++) {
		request = fReportRequests.ItemAt(i);
		
		if (request->thread != thread)
			continue;
		
		if (request->type == type || type == PPP_ALL_REPORTS)
			fReportRequests.RemoveItem(request);
	}
	
	// empty message queue
	while (has_data(thread)) {
		thread_id sender;
		receive_data(&sender, NULL, 0);
	}
}
Ejemplo n.º 2
0
void ImageMessage::Clear() {
#define OFFSET_OF_FIELD_(f) (reinterpret_cast<char*>(      \
  &reinterpret_cast<ImageMessage*>(16)->f) - \
   reinterpret_cast<char*>(16))

#define ZR_(first, last) do {                              \
    size_t f = OFFSET_OF_FIELD_(first);                    \
    size_t n = OFFSET_OF_FIELD_(last) - f + sizeof(last);  \
    ::memset(&first, 0, n);                                \
  } while (0)

  if (_has_bits_[0 / 32] & 7) {
    ZR_(width_, height_);
    if (has_data()) {
      if (data_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
        data_->clear();
      }
    }
  }

#undef OFFSET_OF_FIELD_
#undef ZR_

  ::memset(_has_bits_, 0, sizeof(_has_bits_));
  mutable_unknown_fields()->Clear();
}
Ejemplo n.º 3
0
String OS_Unix::get_stdin_string(bool p_block) {

	String ret;
	if (p_block) {
		char buff[1024];
		ret = stdin_buf + fgets(buff,1024,stdin);
		stdin_buf = "";
		return ret;
	};

	while (has_data(stdin)) {

		char ch;
		read(fileno(stdin), &ch, 1);
		if (ch == '\n') {
			ret = stdin_buf;
			stdin_buf = "";
			return ret;
		} else {
			char str[2] = { ch, 0 };
			stdin_buf += str;
		};
	};

	return "";
}
Ejemplo n.º 4
0
void ImageMessage::SerializeWithCachedSizes(
    ::google::protobuf::io::CodedOutputStream* output) const {
  // @@protoc_insertion_point(serialize_start:ImageMessage)
  // required uint32 width = 1;
  if (has_width()) {
    ::google::protobuf::internal::WireFormatLite::WriteUInt32(1, this->width(), output);
  }

  // required uint32 height = 2;
  if (has_height()) {
    ::google::protobuf::internal::WireFormatLite::WriteUInt32(2, this->height(), output);
  }

  // required bytes data = 3;
  if (has_data()) {
    ::google::protobuf::internal::WireFormatLite::WriteBytesMaybeAliased(
      3, this->data(), output);
  }

  if (!unknown_fields().empty()) {
    ::google::protobuf::internal::WireFormat::SerializeUnknownFields(
        unknown_fields(), output);
  }
  // @@protoc_insertion_point(serialize_end:ImageMessage)
}
Ejemplo n.º 5
0
::google::protobuf::uint8* ImageMessage::SerializeWithCachedSizesToArray(
    ::google::protobuf::uint8* target) const {
  // @@protoc_insertion_point(serialize_to_array_start:ImageMessage)
  // required uint32 width = 1;
  if (has_width()) {
    target = ::google::protobuf::internal::WireFormatLite::WriteUInt32ToArray(1, this->width(), target);
  }

  // required uint32 height = 2;
  if (has_height()) {
    target = ::google::protobuf::internal::WireFormatLite::WriteUInt32ToArray(2, this->height(), target);
  }

  // required bytes data = 3;
  if (has_data()) {
    target =
      ::google::protobuf::internal::WireFormatLite::WriteBytesToArray(
        3, this->data(), target);
  }

  if (!unknown_fields().empty()) {
    target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray(
        unknown_fields(), target);
  }
  // @@protoc_insertion_point(serialize_to_array_end:ImageMessage)
  return target;
}
Ejemplo n.º 6
0
void Message::Clear() {
  if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) {
    if (has_to()) {
      if (to_ != &::google::protobuf::internal::kEmptyString) {
        to_->clear();
      }
    }
    id_ = GOOGLE_LONGLONG(0);
    time_ = GOOGLE_LONGLONG(0);
    if (has_from()) {
      if (from_ != &::google::protobuf::internal::kEmptyString) {
        from_->clear();
      }
    }
    type_ = 0;
    if (has_sn()) {
      if (sn_ != &::google::protobuf::internal::kEmptyString) {
        sn_->clear();
      }
    }
    if (has_data()) {
      if (data_ != &::google::protobuf::internal::kEmptyString) {
        data_->clear();
      }
    }
    expire_ = GOOGLE_LONGLONG(0);
  }
  ::memset(_has_bits_, 0, sizeof(_has_bits_));
}
Ejemplo n.º 7
0
int32 InfoBox::UpdateThread(void *data) {

	int32		code;
	ThreadData	*dt=(ThreadData *)data;
	thread_id	sender;
	int32		seconds=0;
	int32		i;
	int32		buffer;	// not a real data buffer. contains the command code, only.
				// (4 bytes long)
				

	
	while (true) {

		// calculate sizes and display them
		if (dt->seconds>0) {
			((Application1 *)be_app)->GetImageSize();
			((InfoBox *)dt->parent)->UpdateSizes();
		}

		// wait...
		for (i=0; i<dt->seconds*4; i++) {
			snooze(250000);
			if (dt->interruptFlag)
				i=dt->seconds*4+1;
		}
		
		snooze(30000);
		dt->interruptFlag=false;
		if (has_data(find_thread(NULL))) {
			code=receive_data(&sender, &buffer, 4);
			switch(code) {
				case 'exit':{
					//release_sem(exit_thread_sem);
					return 0;
				}
				
				case 'leng': {
					seconds=buffer;
					break;
				}

				default: {
					break;
				}
			} // switch
		}
		
	} // while
	return 0;
}
Ejemplo n.º 8
0
void Message::SerializeWithCachedSizes(
    ::google::protobuf::io::CodedOutputStream* output) const {
  // optional string to = 1;
  if (has_to()) {
    ::google::protobuf::internal::WireFormatLite::WriteString(
      1, this->to(), output);
  }

  // optional int64 id = 2;
  if (has_id()) {
    ::google::protobuf::internal::WireFormatLite::WriteInt64(2, this->id(), output);
  }

  // optional int64 time = 3;
  if (has_time()) {
    ::google::protobuf::internal::WireFormatLite::WriteInt64(3, this->time(), output);
  }

  // optional string from = 4;
  if (has_from()) {
    ::google::protobuf::internal::WireFormatLite::WriteString(
      4, this->from(), output);
  }

  // optional int32 type = 5;
  if (has_type()) {
    ::google::protobuf::internal::WireFormatLite::WriteInt32(5, this->type(), output);
  }

  // optional string sn = 6;
  if (has_sn()) {
    ::google::protobuf::internal::WireFormatLite::WriteString(
      6, this->sn(), output);
  }

  // optional bytes data = 7;
  if (has_data()) {
    ::google::protobuf::internal::WireFormatLite::WriteBytes(
      7, this->data(), output);
  }

  // optional int64 expire = 8;
  if (has_expire()) {
    ::google::protobuf::internal::WireFormatLite::WriteInt64(8, this->expire(), output);
  }

}
Ejemplo n.º 9
0
/* ----------------------------------------------------------------------
 * N_VMake Test
 *
 * NOTE: This routine depends on N_VConst to check vector data.
 * --------------------------------------------------------------------*/
int Test_N_VMake(HYPRE_ParVector W, int myid)
{
  int failure;
  /* double   start_time, stop_time; */
  N_Vector X;
  int local_length = hypre_ParVectorLastIndex(W) 
                     - hypre_ParVectorFirstIndex(W) + 1;

  /* clone vector */
  /* start_time = get_time(); */  
  X = N_VMake_ParHyp(W);
  /* stop_time = get_time();  */

  /* check cloned vector */
  if (X == NULL) {
    printf(">>> FAILED test -- N_VMake, Proc %d \n", myid);
    printf("    After N_VMakeEmpty, X == NULL \n \n");
    return(1);
  } 

  /* check cloned vector data */
  if (!has_data(X)) {
    printf(">>> FAILED test -- N_VMake, Proc %d \n", myid);
    printf("    Vector data == NULL \n \n");
    N_VDestroy(X);
    return(1);
  }    

  N_VConst(ONE,X);
  failure = check_ans(ONE, X, local_length);
  if (failure) {
    printf(">>> FAILED test -- N_VMake, Proc %d \n", myid);
    printf("    Failed N_VConst check \n \n");
    N_VDestroy(X);
    return(1);
  }    

  N_VDestroy(X); 

  if (myid == 0) {
    printf("    PASSED test -- N_VMake \n");
    /* PRINT_TIME("    N_VMake Time: %22.15e \n \n", stop_time - start_time); */
  }

  return(0);
}
Ejemplo n.º 10
0
BackupSystem::stream_dict_t BackupSystem::generate_streams(generate_archive_fp generator){
	known_guids_t known_guids;
	stream_dict_t stream_dict;
	for (stream_index_t i = 0; i < this->base_objects.size(); i++){
		auto fso = this->base_objects[i];
		std::vector<std::shared_ptr<BackupStream>> streams;
		for (auto &child : fso->get_iterator()){
			auto stream = (this->*generator)(*child, known_guids);
			if (!stream || !stream->has_data())
				continue;
			child->set_unique_ids(*this);
			stream->set_unique_id(child->get_stream_id());
			streams.push_back(stream);
			this->streams.push_back(stream);
		}
		stream_dict[i] = std::move(streams);
	}
	return stream_dict;
}
Ejemplo n.º 11
0
uint64_t IRInstruction::hash() const {
  std::vector<uint64_t> bits;
  bits.push_back(opcode());

  for (size_t i = 0; i < srcs_size(); i++) {
    bits.push_back(src(i));
  }

  if (dests_size() > 0) {
    bits.push_back(dest());
  }

  if (has_data()) {
    size_t size = get_data()->data_size();
    const auto& data = get_data()->data();
    for (size_t i = 0; i < size; i++) {
      bits.push_back(data[i]);
    }
  }

  if (has_type()) {
    bits.push_back(reinterpret_cast<uint64_t>(get_type()));
  }
  if (has_field()) {
    bits.push_back(reinterpret_cast<uint64_t>(get_field()));
  }
  if (has_method()) {
    bits.push_back(reinterpret_cast<uint64_t>(get_method()));
  }
  if (has_string()) {
    bits.push_back(reinterpret_cast<uint64_t>(get_string()));
  }
  if (has_literal()) {
    bits.push_back(get_literal());
  }

  uint64_t result = 0;
  for (uint64_t elem : bits) {
    result ^= elem;
  }
  return result;
}
Ejemplo n.º 12
0
static void walk_children(Entity & entity, path::DataNode & data_node)
{
    map<string, shared_ptr<Entity>> children = entity.get_children();
    vector<string> order = entity.get_order_of_children();
    YLOG_DEBUG("Children count for: {} : {}",get_entity_path(entity, entity.parent).path, children.size());
    YLOG_DEBUG("Children order count : {}",order.size());
    if(order.size()>0)
    {
        for(auto child_seg : order)
        {
            YLOG_DEBUG("Inserting in order for child segpath path: '{}' in parent '{}'", child_seg, get_entity_path(entity, entity.parent).path);
            auto child = children[child_seg];
            if(child == nullptr)
            {
                YLOG_DEBUG("Child '{}' is null", child_seg);
                continue;
            }
            YLOG_DEBUG("==================");
            YLOG_DEBUG("Looking at child '{}': {}", child_seg, get_entity_path(*(child), child->parent).path);
            if(child->has_operation() || child->has_data() || child->is_presence_container)
                populate_data_node(*(child), data_node);
            else
                YLOG_DEBUG("Child has no data and no operations");

        }
    }
    else
    {
        for(auto const& child : children)
        {
            if(child.second == nullptr)
                continue;
            YLOG_DEBUG("==================");
            YLOG_DEBUG("Looking at child '{}': {}",child.first, get_entity_path(*(child.second), child.second->parent).path);
            if(child.second->has_operation() || child.second->has_data() || child.second->is_presence_container)
                populate_data_node(*(child.second), data_node);
            else
                YLOG_DEBUG("Child has no data and no operations");
        }
    }
}
Ejemplo n.º 13
0
int ImageMessage::ByteSize() const {
  int total_size = 0;

  if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) {
    // required uint32 width = 1;
    if (has_width()) {
      total_size += 1 +
        ::google::protobuf::internal::WireFormatLite::UInt32Size(
          this->width());
    }

    // required uint32 height = 2;
    if (has_height()) {
      total_size += 1 +
        ::google::protobuf::internal::WireFormatLite::UInt32Size(
          this->height());
    }

    // required bytes data = 3;
    if (has_data()) {
      total_size += 1 +
        ::google::protobuf::internal::WireFormatLite::BytesSize(
          this->data());
    }

  }
  if (!unknown_fields().empty()) {
    total_size +=
      ::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize(
        unknown_fields());
  }
  GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
  _cached_size_ = total_size;
  GOOGLE_SAFE_CONCURRENT_WRITES_END();
  return total_size;
}
Ejemplo n.º 14
0
/*
 *  set_common_attributes
 *
 *  Set the on event attributes, 
 *
 *  This should be called by every prompt adding function.
 */
void set_common_attributes(struct prompt_add_args* args, xmlNodePtr input){

    if (args->rule->tabindex > 0){
        char* intbuf;
        asprintf(&intbuf, "%d", args->rule->tabindex);
        xmlNewProp(input, "tabindex", intbuf);
        free(intbuf);
    } 

    // class gets inserted to a list
    if ((args->rule->el_class != NULL) && args->rule->el_class[0]!='\0'){
        append_class(input, args->rule->el_class);
    }    
    // Add a class for the pg attribute name
    // but remove the [n] from base[n]
    char* fieldname;
    asprintf(&fieldname, "%s", args->rule->fieldname);
    int k;
    for (k=0; k<strlen(fieldname); k++){
        if (fieldname[k] == '[') fieldname[k] = '\0';
    }
    append_class(input, fieldname);
    free(fieldname);
    fieldname = NULL;

    // add the pgtype_datum as a json attribute 
    if ((args->pgtype != NULL) && (args->rule->publish_pgtype)){
        char* pgtype_json = pgtype_datum_to_json(args->pgtype);
        if (pgtype_json != NULL){
            char* escaped_pgtype = xmlURIEscapeStr(pgtype_json, NULL);
            if (escaped_pgtype != NULL){
                xmlNewProp(input, "pgtype", escaped_pgtype);
                free(escaped_pgtype);
            }    
            free(pgtype_json);
        }    
    }

    if (has_data(args->rule->regex_pattern)){
        xmlNewProp(input, "pattern", args->rule->regex_pattern);
    }    

    if (has_data(args->rule->onfocus)) add_event(args, input, 
        "onfocus", args->rule->onfocus);

    if (has_data(args->rule->onblur))  add_event(args, input, 
        "onblur", args->rule->onblur);

    if (has_data(args->rule->onchange))  add_event(args, input, 
        "onchange", args->rule->onchange);

    if (has_data(args->rule->onselect))  add_event(args, input, 
        "onselect", args->rule->onselect);

    if (has_data(args->rule->onclick))  add_event(args, input, 
        "onclick", args->rule->onclick);

    if (has_data(args->rule->ondblclick))  add_event(args, input, 
        "ondblclick", args->rule->ondblclick);

    if (has_data(args->rule->onmousedown))  add_event(args, input, 
        "onmousedown", args->rule->onmousedown);

    if (has_data(args->rule->onmouseup))  add_event(args, input, 
        "onmouseup", args->rule->onmouseup);

    if (has_data(args->rule->onmouseover))  add_event(args, input, 
        "onmouseover", args->rule->onmouseover);

    if (has_data(args->rule->onmouseout))  add_event(args, input, 
        "onmouseout", args->rule->onmouseout);

    if (has_data(args->rule->onkeypress))  add_event(args, input, 
        "onkeypress", args->rule->onkeypress);

    if (has_data(args->rule->onkeydown))  add_event(args, input, 
        "onkeydown", args->rule->onkeydown);

    if (has_data(args->rule->onkeyup))  add_event(args, input, 
        "onkeyup", args->rule->onkeyup);

    if (has_data(args->rule->src)) add_event(args, input, 
        "src", args->rule->src);

    return;
}
Ejemplo n.º 15
0
int Message::ByteSize() const {
  int total_size = 0;

  if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) {
    // optional string to = 1;
    if (has_to()) {
      total_size += 1 +
        ::google::protobuf::internal::WireFormatLite::StringSize(
          this->to());
    }

    // optional int64 id = 2;
    if (has_id()) {
      total_size += 1 +
        ::google::protobuf::internal::WireFormatLite::Int64Size(
          this->id());
    }

    // optional int64 time = 3;
    if (has_time()) {
      total_size += 1 +
        ::google::protobuf::internal::WireFormatLite::Int64Size(
          this->time());
    }

    // optional string from = 4;
    if (has_from()) {
      total_size += 1 +
        ::google::protobuf::internal::WireFormatLite::StringSize(
          this->from());
    }

    // optional int32 type = 5;
    if (has_type()) {
      total_size += 1 +
        ::google::protobuf::internal::WireFormatLite::Int32Size(
          this->type());
    }

    // optional string sn = 6;
    if (has_sn()) {
      total_size += 1 +
        ::google::protobuf::internal::WireFormatLite::StringSize(
          this->sn());
    }

    // optional bytes data = 7;
    if (has_data()) {
      total_size += 1 +
        ::google::protobuf::internal::WireFormatLite::BytesSize(
          this->data());
    }

    // optional int64 expire = 8;
    if (has_expire()) {
      total_size += 1 +
        ::google::protobuf::internal::WireFormatLite::Int64Size(
          this->expire());
    }

  }
  GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
  _cached_size_ = total_size;
  GOOGLE_SAFE_CONCURRENT_WRITES_END();
  return total_size;
}
Ejemplo n.º 16
0
int32 PoorManServer::_Worker(void* data)
{
	static const struct timeval kTimeVal = {60, 0};
	PoorManServer* s = static_cast<PoorManServer*>(data);
	httpd_conn* hc;
	int retval;
	
	if (has_data(find_thread(NULL))) {
		thread_id sender;
		if (receive_data(&sender, &hc, sizeof(httpd_conn*)) != 512)
			goto cleanup;
	} else {
		// No need to go throught the whole cleanup, as we haven't open
		// nor allocated ht yet.
		atomic_add(&s->fCurConns, -1);
		return 0;
	}
	
	PRINT(("A worker thread starts to work.\n"));

	setsockopt(hc->conn_fd, SOL_SOCKET, SO_RCVTIMEO, &kTimeVal,
		sizeof(struct timeval));
	retval = recv(
		hc->conn_fd,
		&(hc->read_buf[hc->read_idx]),
		hc->read_size - hc->read_idx,
		0
	);
	if (retval < 0)
		goto cleanup;

	hc->read_idx += retval;
	switch(httpd_got_request(hc)) {
		case GR_GOT_REQUEST:
			break;
		case GR_BAD_REQUEST:
			httpd_send_err(hc, 400,
				httpd_err400title, (char *)"", httpd_err400form, (char *)"");
			httpd_write_response(hc);//fall through
		case GR_NO_REQUEST: //fall through
		default: //won't happen
			goto cleanup;
			break;
	}
	
	if (httpd_parse_request(hc) < 0) {
		httpd_write_response(hc);
		goto cleanup;
	}
	
	retval = httpd_start_request(hc, (struct timeval*)0);
	if (retval < 0) {
		httpd_write_response(hc);
		goto cleanup;
	}
	
	/*true means the connection is already handled
	 *by the directory index generator in httpd_start_request().
	 */
	if (hc->file_address == (char*) 0) {
		static_cast<PoorManApplication*>(be_app)->GetPoorManWindow()->SetHits(
			static_cast<PoorManApplication*>(be_app)->GetPoorManWindow()->GetHits() + 1
		);
		hc->conn_fd = -1;
		goto cleanup;
	}
	
	switch (hc->method) {
		case METHOD_GET:
			s->_HandleGet(hc);
			break;
		case METHOD_HEAD:
			s->_HandleHead(hc);
			break;
		case METHOD_POST:
			s->_HandlePost(hc);
			break;
	}
	
cleanup: ;
	httpd_close_conn(hc, (struct timeval*)0);
	httpd_destroy_conn(hc);
	
	delete hc;
	atomic_add(&s->fCurConns, -1);
	return 0;
}
Ejemplo n.º 17
0
void slowPoll( void )
	{
	RANDOM_STATE randomState;
	BYTE buffer[ RANDOM_BUFSIZE + 8 ];
	key_info keyInfo;
	team_info teami;
	thread_info threadi;
	area_info areai;
	port_info porti;
	sem_info semi;
	image_info imagei;
	double temperature;
	int32 devID, cookie;
	int fd, value;

	if( ( fd = open( "/dev/urandom", O_RDONLY ) ) >= 0 )
		{
		MESSAGE_DATA msgData;
		BYTE buffer[ ( DEVRANDOM_BITS / 8 ) + 8 ];
		static const int quality = 100;

		/* Read data from /dev/urandom, which won't block (although the
		   quality of the noise is lesser). */
		read( fd, buffer, DEVRANDOM_BITS / 8 );
		setMessageData( &msgData, buffer, DEVRANDOM_BITS / 8 );
		krnlSendMessage( SYSTEM_OBJECT_HANDLE, IMESSAGE_SETATTRIBUTE_S,
						 &msgData, CRYPT_IATTRIBUTE_ENTROPY );
		zeroise( buffer, DEVRANDOM_BITS / 8 );
		close( fd );

		krnlSendMessage( SYSTEM_OBJECT_HANDLE, IMESSAGE_SETATTRIBUTE,
						 ( MESSAGE_CAST ) &quality,
						 CRYPT_IATTRIBUTE_ENTROPY_QUALITY );
		return;
		}

	initRandomData( randomState, buffer, RANDOM_BUFSIZE );

	/* Get the state of all keys on the keyboard and various other
	   system states */
#if 0	/* See comment at start */
	if( get_key_info( &keyInfo ) == B_NO_ERROR )
		addRandomData( randomState, &keyInfo, sizeof( key_info ) );
#endif /* 0 */
	value = is_computer_on();	/* Returns 1 if computer is on */
	addRandomValue( randomState, value );
	temperature = is_computer_on_fire();	/* MB temp.if on fire */
	addRandomData( randomState, &temperature, sizeof( double ) );

	/* Get information on all running teams (thread groups, ie applications).
	   This returns the team ID, number of threads, images, and areas,
	   debugger port and thread ID, program args, and uid and gid */
	cookie = 0;
	while( get_next_team_info( &cookie, &teami ) == B_NO_ERROR )
		addRandomData( randomState, &teami, sizeof( teami ) );

	/* Get information on all running threads.  This returns the thread ID,
	   team ID, thread name and state (eg running, suspended, asleep,
	   blocked), the thread priority, elapsed user and kernel time, and
	   thread stack information */
	cookie = 0;
	while( get_next_thread_info( 0, &cookie, &threadi ) == B_NO_ERROR )
		{
		addRandomValue( randomState, has_data( threadi.thread ) );
		addRandomData( randomState, &threadi, sizeof( threadi ) );
		}

	/* Get information on all memory areas (chunks of virtual memory).  This
	   returns the area ID, name, size, locking scheme and protection bits,
	   ID of the owning team, start address, number of resident bytes, copy-
	   on-write count, an number of pages swapped in and out */
	cookie = 0;
	while( get_next_area_info( 0, &cookie, &areai ) == B_NO_ERROR )
		addRandomData( randomState, &areai, sizeof( areai ) );

	/* Get information on all message ports.  This returns the port ID, ID of
	   the owning team, message queue length, number of messages in the
	   queue, and total number of messages processed */
	cookie = 0;
	while( get_next_port_info( 0, &cookie, &porti ) == B_NO_ERROR )
		addRandomData( randomState, &porti, sizeof( porti ) );

	/* Get information on all semaphores.  This returns the semaphore and
	   owning team ID, the name, thread count, and the ID of the last thread
	   which acquired the semaphore */
	cookie = 0;
	while( get_next_sem_info( 0, &cookie, &semi ) == B_NO_ERROR )
		addRandomData( randomState, &semi, sizeof( semi ) );

	/* Get information on all images (code blocks, eg applications, shared
	   libraries, and add-on images (DLL's on steroids).  This returns the
	   image ID and type (app, library, or add-on), the order in which the
	   image was loaded compared to other images, the address of the init
	   and shutdown routines, the device and node where the image lives,
	   and the image text and data sizes) */
	cookie = 0;
	while( get_next_image_info( 0, &cookie, &imagei ) == B_NO_ERROR )
		addRandomData( randomState, &imagei, sizeof( imagei ) );

	/* Get information on all storage devices.  This returns the device
	   number, root inode, various device parameters such as I/O block size,
	   and the number of free and used blocks and inodes */
	devID = 0;
	while( next_dev( &devID ) >= 0 )
		{
		fs_info fsInfo;

		if( fs_stat_dev( devID, &fsInfo ) == B_NO_ERROR )
			addRandomData( randomState, &fsInfo, sizeof( fs_info ) );
		}

	/* Flush any remaining data through */
	endRandomData( randomState, 100 );
	}
Ejemplo n.º 18
0
bool	
GenericThread::HasData()
{
	return has_data(fThreadId);
}