예제 #1
0
TEST_F(PacksTests, test_discovery_cache) {
  auto pack = Pack("foobar", getPackWithDiscovery());
  for (int i = 0; i < 5; i++) {
    pack.checkDiscovery();
  }
  auto stats = pack.getStats();
  EXPECT_EQ(stats.total, 5);
  EXPECT_EQ(stats.hits, 4);
  EXPECT_EQ(stats.misses, 1);
}
LIBFREESPACE_API int freespace_perform() {
    int rc;
    // Reset the perform event
    ResetEvent(freespace_instance_->performEvent_);

    // Check if the device discovery thread has detected any changes
    // and rescan if so.
    rc = checkDiscovery();

    // Service all of the devices.
    // NOTE: Servicing includes initiating
    freespace_private_filterDevices(NULL, 0, NULL, performHelper);

    return rc;
}
LIBFREESPACE_API int freespace_getDeviceList(FreespaceDeviceId* list, int listSize, int *listSizeOut) {
    int i;
    int rc;

    // Check if the device list has changed.
    rc = checkDiscovery();
    if (rc != FREESPACE_SUCCESS) {
        return rc;
    }

    for (*listSizeOut = 0, i = 0; *listSizeOut < listSize && i < freespace_instance_->deviceCount_; i++) {
        struct FreespaceDeviceStruct* device = freespace_instance_->devices_[i];
        if (device->isAvailable_) {
            list[*listSizeOut] = device->id_;
            (*listSizeOut)++;
        }
    }

    return FREESPACE_SUCCESS;
}
예제 #4
0
파일: packs.cpp 프로젝트: Ramsey16/osquery
bool Pack::shouldPackExecute() {
  return checkVersion() && checkPlatform() && checkDiscovery();
}
예제 #5
0
bool Pack::shouldPackExecute() {
    return (valid_ && checkDiscovery());
}
예제 #6
0
파일: packs.cpp 프로젝트: wxsBSD/osquery
bool Pack::shouldPackExecute() {
  active_ = (valid_ && checkDiscovery());
  return active_;
}
예제 #7
0
파일: packs.cpp 프로젝트: bukalov/osquery
bool Pack::shouldPackExecute() { return checkDiscovery(); }