Exemplo n.º 1
0
iterator_t* iterator_init(uint8_t num_threads, uint8_t shard,
			  uint8_t num_shards)
{
	uint64_t num_addrs = blacklist_count_allowed();
	iterator_t *it = xmalloc(sizeof(struct iterator));
	const cyclic_group_t *group = get_group(num_addrs);
	if (num_addrs > (1LL << 32)) {
		zsend.max_index = 0xFFFFFFFF;
	} else {
		zsend.max_index = (uint32_t) num_addrs;
	}
	it->cycle = make_cycle(group);
	it->num_threads = num_threads;
	it->thread_shards = xcalloc(num_threads, sizeof(shard_t));
	it->complete = xcalloc(it->num_threads, sizeof(uint8_t));
	pthread_mutex_init(&it->mutex, NULL);
	for (uint8_t i = 0; i < num_threads; ++i) {
		shard_init(&it->thread_shards[i],
			   shard,
			   num_shards,
			   i,
			   num_threads,
			   &it->cycle,
			   shard_complete,
			   it
			   );

	}
	return it;
}
Exemplo n.º 2
0
static
rc_t stats_data_update_group(stats_data_t *self,
                             int64_t spot_id,
                             uint32_t spot_len,
                             uint32_t bio_spot_len,
                             uint32_t cmp_spot_len,
                             char const grp[],
                             uint64_t grp_len)
{
    if (grp_len == 0 || grp == NULL || grp[0] == '\0' ||
        (grp_len == 7 && strncasecmp("default", grp, 7) == 0))
    {
        group_stats_update(&self->deflt, spot_id, spot_len, bio_spot_len, cmp_spot_len);
    }
    else
    {
        group_stats_t *const fnd = stats_data_get_group(self, (unsigned)grp_len, grp);
        
        if (fnd == NULL)
            return RC(rcXF, rcFunction, rcConstructing, rcMemory, rcExhausted);
        
        if (fnd - get_group(self, 0) < MAX_GROUP_COUNT)
            group_stats_update(fnd, spot_id, spot_len, bio_spot_len, cmp_spot_len);
        else {
            KDataBufferWhack(&self->group);
            KDataBufferWhack(&self->names);
            stats_data_init_funcs(self, false);
            (void)PLOGMSG(klogWarn, (klogWarn, "Too many spot groups ($(count)); dropping group stats", "count=%u", (unsigned)(self->count)));
        }
    }
    return 0;
}
Exemplo n.º 3
0
static Cmdret conf_syntax(List *args)
{
  log_msg("CONFIG", "conf_syntax");
  char *group = list_arg(args, 1, VAR_STRING);
  List *words = list_arg(args, 2, VAR_LIST);
  char *single = list_arg(args, 2, VAR_STRING);
  if (!group && (!words || !single))
    return NORET;

  fn_group *grp = get_group(group);
  if (!grp)
    grp = set_group(group);

  if (single) {
    fn_syn syn = {
      .key = strdup(single),
      .group = grp,
    };
    set_syn(&syn);
    return NORET;
  }

  log_msg("CONFIG", "# %d", utarray_len(words->items));
  for (int i = 0; i < utarray_len(words->items); i++) {
    fn_syn syn = {
      .key = strdup(list_arg(words, i, VAR_STRING)),
      .group = grp,
    };
    set_syn(&syn);
  }
  return NORET;
}
Exemplo n.º 4
0
marathon_group::app_ptr_t mesos_state_t::add_or_replace_app(const std::string& app_id,
															const std::string& group_id,
															const std::string& task_id)
{
	marathon_group::app_ptr_t app = get_app(app_id);
	if(!app)
	{
		app = std::make_shared<marathon_app>(app_id);
		g_logger.log("Created app [" + app_id + ']', sinsp_logger::SEV_DEBUG);
	}
	else
	{
		g_logger.log("Found app [" + app_id + ']', sinsp_logger::SEV_DEBUG);
	}
	if(!app)
	{
		g_logger.log("Could not find or create app [" + app_id + ']', sinsp_logger::SEV_ERROR);
		return 0;
	}

	if(!task_id.empty())
	{
		g_logger.log("Adding task [" + task_id + "] to app [" + app_id + ']', sinsp_logger::SEV_DEBUG);
		add_task_to_app(app, task_id);
	}

	marathon_group::ptr_t group = get_group(group_id);
	if(group)
	{
		g_logger.log("Adding app [" + app_id + "] to group [" + group_id + ']', sinsp_logger::SEV_DEBUG);
		group->add_or_replace_app(app);
	}

	return app;
}
Exemplo n.º 5
0
static int stats_data_name_cmp_idx(stats_data_t *const self,
                                   unsigned const idx,
                                   unsigned const Alen,
                                   char const Aname[])
{
    group_stats_t const *const B = get_group(self, idx);
    return stats_data_name_cmp(self, B, Alen, Aname);
}
Exemplo n.º 6
0
pim_group_node *pim_router::create_group(const inet6_addr &addr, node *conf) {
	pim_group_node *node = get_group(addr);
	if (!node) {
		return new pim_group_node(this, addr,
				(pim_groupconf_node *)conf->get_or_create_child("pim"));
	}
	return node;
}
Exemplo n.º 7
0
LicenseItem::LicenseItem (struct rdf_license_t const* license, EntityEntry* entity, Registry &wr)
    : Gtk::RadioButton(_(license->name)), _lic(license), _eep(entity), _wr(wr)
{
    static Gtk::RadioButtonGroup group = get_group();
    static bool first = true;
    if (first) first = false;
    else       set_group (group);
}
Exemplo n.º 8
0
void mpi_comm_create_(int* comm, int* group, int* newcomm, int* ierr) {
  MPI_Comm tmp;

  *ierr = MPI_Comm_create(get_comm(*comm),get_group(*group), &tmp);
  if(*ierr == MPI_SUCCESS) {
    *newcomm = new_comm(tmp);
  }
}
Exemplo n.º 9
0
void mpi_group_incl_(int* group, int* n, int* ranks, int* group_out, int* ierr) {
  MPI_Group tmp;

  *ierr = MPI_Group_incl(get_group(*group), *n, ranks, &tmp);
  if(*ierr == MPI_SUCCESS) {
    *group_out = new_group(tmp);
  }
}
Exemplo n.º 10
0
static void _extract_series(FILE* fp, int stepx, bool header, hid_t gid_level,
			    char* node_name, char* data_set_name) {
	hid_t	gid_series;
	int 	size_data;
	void	*data;
	uint32_t type;
	char	*data_type, *subtype;
	hdf5_api_ops_t* ops;
	gid_series = get_group(gid_level, data_set_name);
	if (gid_series < 0) {
		// This is okay, may not have ran long enough for
		// a sample (hostname????)
		// OR trying to get all tasks
		return;
	}
	data_type = get_string_attribute(gid_series, ATTR_DATATYPE);
	if (!data_type) {
		H5Gclose(gid_series);
		info("No datatype in %s", data_set_name);
		return;
	}
	type = acct_gather_profile_type_from_string(data_type);
	xfree(data_type);
	subtype = get_string_attribute(gid_series, ATTR_SUBDATATYPE);
	if (subtype == NULL) {
		H5Gclose(gid_series);
		info("No %s attribute", ATTR_SUBDATATYPE);
		return;
	}
	ops = profile_factory(type);
	if (ops == NULL) {
		xfree(subtype);
		H5Gclose(gid_series);
		info("Failed to create operations for %s",
		     acct_gather_profile_type_to_string(type));
		return;
	}
	data = get_hdf5_data(
		gid_series, type, data_set_name, &size_data);
	if (data) {
		if (strcmp(subtype,SUBDATA_SUMMARY) != 0)
			(*(ops->extract_series)) (fp, header, params.job_id,
				 stepx, node_name, data_set_name,
				 data, size_data);
		else
			(*(ops->extract_total)) (fp, header, params.job_id,
				 stepx, node_name, data_set_name,
				 data, size_data);
		xfree(data);
	} else {
		fprintf(fp, "%d,%d,%s,No %s Data\n",
		        params.job_id, stepx, node_name,
		        data_set_name);
	}
	xfree(ops);
	H5Gclose(gid_series);

}
Exemplo n.º 11
0
bool mesos_state_t::remove_app(const std::string& app_id)
{
	marathon_group::ptr_t group = get_group(app_id);
	if(group)
	{
		return group->remove_app(app_id);
	}
	return false;
}
Exemplo n.º 12
0
marathon_group::ptr_t mesos_state_t::get_app_group(const std::string& app_id)
{
	std::string group_id = marathon_app::get_group_id(app_id);
	if(!group_id.empty())
	{
		return get_group(group_id);
	}
	return 0;
}
Exemplo n.º 13
0
void add_package(package_t* package)
{
   variable_t* evar;
   variable_t* vvar;
   list_node* enode;
   list_node* vnode;
   list_node* rnode;
   group_t* group;
   char* name;
   int got_one;
   char* text;
   
   if (package->requires)
   {
      DEBUG(stderr, "(pre-using required packages list)\n");

      for (rnode=list_tail(package->requires) ; rnode ; rnode=previous(rnode))
      {
         name = (char*) get_value(rnode);

         if (group = get_group(name))
            use_group(group);
         else
            use_package(name);
      }
   }

   for (vnode = head(package->variables) ; vnode ; vnode = next(vnode))
   {
      vvar = get_value(vnode);
      got_one = 0;
      for (enode = head(the_environment) ; enode ; enode = next(enode))
      {
         evar = get_value(enode);
         if (!strcmp(vvar->name, evar->name))
         {
            remove_node(the_environment, enode, 0);
            add_to_tail(the_environment, update_var(evar, vvar));
            got_one = 1;
            break;
         }
      }
      if (!got_one)
      {
         enode = get_into_env(vvar);
         evar = get_value(enode);
         set_value(enode, update_var(evar, vvar));
      }
   }
   
   for (vnode = head(package->scripts) ; vnode ; vnode = next(vnode))
   {
      text = ((script_t*) get_value(vnode))->text;
      add_to_tail(the_scripts, (void*) text);
   }   
}
Exemplo n.º 14
0
static group_stats_t *stats_data_get_group(stats_data_t *const self,
                                           unsigned const len,
                                           char const name[])
{
    unsigned i;
    unsigned which;
    group_stats_t *fnd;
    
    for (i = 0; i < STATS_DATA_MRU_COUNT && i < self->count; ++i) {
        group_stats_t *const k = self->mru[i];
        
        if (k && stats_data_name_cmp(self, k, len, name) == 0) {
            fnd = k;
            goto UPDATE_MRU;
        }
    }
    which = stats_data_search(self, len, name);
    if (which < self->count && stats_data_name_cmp_idx(self, which, len, name) == 0)
        fnd = get_group(self, which);
    else {
        int const offset = string_buffer_add(&self->names, len, name);
        unsigned const move = self->count - which;
        
        if (offset < 0)
            return NULL;
        
        if (++self->count > MAX_GROUP_COUNT)
            return get_group(self, MAX_GROUP_COUNT);
        
        if (KDataBufferResize(&self->group, self->count) != 0)
            return NULL;
        
        fnd = get_group(self, which);
        assert(fnd + move + 1 <= get_group(self, self->count) || move == 0);
        memmove(fnd + 1, fnd, move * sizeof(*fnd));
        
        group_stats_init(fnd, offset, len, self->count);
        stats_data_invald_mru(self);
    }
UPDATE_MRU:
    stats_data_update_mru(self, fnd);
    return fnd;
}
Exemplo n.º 15
0
static hid_t _get_series_parent(hid_t group)
{
	hid_t gid_level = -1;

	if (strcasecmp(params.level, "Node:Totals") == 0) {
		gid_level = get_group(group, GRP_TOTALS);
		if (gid_level < 0) {
			info("Failed to open  group %s", GRP_TOTALS);
		}
	} else if (strcasecmp(params.level, "Node:TimeSeries") == 0) {
		gid_level = get_group(group, GRP_SAMPLES);
		if (gid_level < 0) {
			info("Failed to open group %s", GRP_SAMPLES);
		}
	} else {
		info("%s is an illegal level", params.level);
		return -1;

	}

	return gid_level;
}
Exemplo n.º 16
0
static void add_to_group(char* bp) {
    int size = GET_SIZE(HDRP(bp));
    int group = get_group(size);
    void* heap_listp_new = heap_listp - (GROUPSIZE + (2*WSIZE));
    int** grpp = heap_listp_new + (group * WSIZE);    
    if (*grpp) {
        int* tmpptr = *grpp;
        PUT(HDRP(bp) + 4, (int)tmpptr);
        PUT(FTRP(bp) + 4, (int)tmpptr);
    }    
    //printf("group: %d", group);
    PUTPTR(grpp, bp);
}
static gboolean visible_func(GtkTreeModel *model, GtkTreeIter *iter, gpointer user_data) {
	RyostklconfigProDimnessSelector *dimness_selector = RYOSTKLCONFIG_PRO_DIMNESS_SELECTOR(user_data);
	RyostklconfigProDimnessSelectorPrivate *priv = dimness_selector->priv;
	guint group;

	if (priv->is_pro)
		return TRUE;

	group = get_group(model, iter);
	if (group == GROUP_PRO)
		return FALSE;
	else
		return TRUE;
}
static struct pa_policy_group* get_group_or_classify(struct userdata *u, struct pa_sink_input *sinp, uint32_t *flags_ret) {
    struct pa_policy_group *group;
    const char *group_name;

    pa_assert(u);
    pa_assert(sinp);
    pa_assert(flags_ret);

    group = get_group(u, NULL, sinp->proplist, flags_ret);

    if (!group) {
        pa_log_info("Sink input '%s' is missing a policy group. "
                    "Classifying...", sink_input_ext_get_name(sinp->proplist));

        /* After classifying, search group struct using get_group, but don't try to update flags,
         * since those are not added to the sink input yet. That will happen in
         * handle_new_sink_input->pa_policy_group_insert_sink_input. pa_classify_sink_input already
         * returns our flags, so we can just have those in the flags_ret. */
        if ((group_name = pa_classify_sink_input(u, sinp, flags_ret)))
            group = get_group(u, group_name, sinp->proplist, NULL);
    }

    return group;
}
Exemplo n.º 19
0
static rc_t stats_data_write_all(stats_data_t *const self)
{
    unsigned i;

    RC_THROW(stats_data_write_table(self));
    if (self->count <= MAX_GROUP_COUNT) {
        if (self->deflt.spot_count != 0)
            RC_THROW(group_stats_write_default(&self->deflt, self));
        RC_THROW(group_stats_write_table(&self->table, self));
        for (i = 0; i < self->count; ++i) {
            RC_THROW(group_stats_write(get_group(self, i), self, self->names.base));
        }
    }
    return 0;
}
Exemplo n.º 20
0
		/**
		 * Returns the string generated by resolving the id-attributes into the
		 * name specified for the given id, separated by "/". The overall structure of the
		 * string would be "<group>/<element>/<type>" in unextended format or
		 * "Group=<group>/Element=<element>/Type=<type>" in extended format.
		 *
		 * @param id the id which should be resolved
		 * @param extended specified whether the extended version should be produced
		 * @return a string-representation of the id
		 *
		 * @see get_group
		 * @see get_element
		 * @see get_type
		 */
		std::wstring to_string(pid id, bool extended=false)
		{
			std::wstring res;

			if(extended) res.append(L"Group=");
			res.append(get_group(id)).append(L"/");

			if(extended) res.append(L"Element=");
			res.append(get_element(id)).append(L"/");

			if(extended) res.append(L"Type=");
			res.append(get_type(id));

			return res;
		}
void invocation(const ComType com, const uint8_t *data) {
	switch(((MessageHeader*)data)->fid) {
		case FID_SET_VALUE: {
			set_value(com, (SetValue*)data);
			break;
		}

		case FID_GET_VALUE: {
			get_value(com, (GetValue*)data);
			break;
		}

		case FID_SET_MONOFLOP: {
			set_monoflop(com, (SetMonoflop*)data);
			break;
		}

		case FID_GET_MONOFLOP: {
			get_monoflop(com, (GetMonoflop*)data);
			break;
		}

		case FID_SET_GROUP: {
			set_group(com, (SetGroup*)data);
			break;
		}

		case FID_GET_GROUP: {
			get_group(com, (GetGroup*)data);
			break;
		}

		case FID_GET_AVAILABLE_FOR_GROUP: {
			get_available_for_group(com, (GetAvailableForGroup*)data);
			break;
		}

		case FID_SET_SELECTED_VALUES: {
			set_selected_values(com, (SetSelectedValues*)data);
			break;
		}

		default: {
			BA->com_return_error(data, sizeof(MessageHeader), MESSAGE_ERROR_CODE_NOT_SUPPORTED, com);
			break;
		}
	}
}
Exemplo n.º 22
0
 void UNIFAQParameterLibrary::populate(rapidjson::Value &group_data, rapidjson::Value &interaction_data, rapidjson::Value &comp_data)
 {
     // Schema should have been used to validate the data already, so by this point we are can safely consume the data without checking ...
     for (rapidjson::Value::ValueIterator itr = group_data.Begin(); itr != group_data.End(); ++itr)
     {
         Group g;
         g.sgi = (*itr)["sgi"].GetInt();
         g.mgi = (*itr)["mgi"].GetInt();
         g.R_k = (*itr)["R_k"].GetDouble();
         g.Q_k = (*itr)["Q_k"].GetDouble();
         groups.push_back(g);
     }
     for (rapidjson::Value::ValueIterator itr = interaction_data.Begin(); itr != interaction_data.End(); ++itr)
     {
         InteractionParameters ip;
         ip.mgi1 = (*itr)["mgi1"].GetInt();
         ip.mgi2 = (*itr)["mgi2"].GetInt();
         ip.a_ij = (*itr)["a_ij"].GetDouble();
         ip.a_ji = (*itr)["a_ji"].GetDouble();
         ip.b_ij = (*itr)["b_ij"].GetDouble();
         ip.b_ji = (*itr)["b_ji"].GetDouble();
         ip.c_ij = (*itr)["c_ij"].GetDouble();
         ip.c_ji = (*itr)["c_ji"].GetDouble();
         interaction_parameters.push_back(ip);
     }
     for (rapidjson::Value::ValueIterator itr = comp_data.Begin(); itr != comp_data.End(); ++itr)
     {
         Component c;
         c.inchikey = (*itr)["inchikey"].GetString();
         c.registry_number = (*itr)["registry_number"].GetString();
         c.name = (*itr)["name"].GetString();
         // userid is an optional user identifier
         if ((*itr).HasMember("userid")){
             c.userid = (*itr)["userid"].GetString();
         }
         rapidjson::Value &groups = (*itr)["groups"];
         for (rapidjson::Value::ValueIterator itrg = groups.Begin(); itrg != groups.End(); ++itrg)
         {
             int count = (*itrg)["count"].GetInt();
             int sgi = (*itrg)["sgi"].GetInt();
             if  (has_group(sgi)){
                 ComponentGroup cg(count, get_group(sgi));
                 c.groups.push_back(cg);
             }
         }
         components.push_back(c);
     }
 }
Exemplo n.º 23
0
extern int acct_gather_profile_p_task_end(pid_t taskpid)
{
	hid_t   gid_task;
	char 	group_task[MAX_GROUP_NAME+1];
	uint32_t task_id;
	int rc = SLURM_SUCCESS;

	xassert(_run_in_daemon());
	xassert(g_job);

	if (g_job->stepid == NO_VAL)
		return rc;

	xassert(g_profile_running != ACCT_GATHER_PROFILE_NOT_SET);

	if (!_do_profile(ACCT_GATHER_PROFILE_NOT_SET, g_profile_running))
		return rc;

	if (_get_taskid_from_pid(taskpid, &task_id) != SLURM_SUCCESS)
		return SLURM_FAILURE;
	if (file_id == -1) {
		info("PROFILE: add_task_data, HDF5 file is not open");
		return SLURM_FAILURE;
	}
	if (gid_tasks < 0) {
		gid_tasks = make_group(gid_node, GRP_TASKS);
		if (gid_tasks < 1) {
			info("PROFILE: Failed to create Tasks group");
			return SLURM_FAILURE;
		}
	}
	sprintf(group_task, "%s_%d", GRP_TASK, task_id);
	gid_task = get_group(gid_tasks, group_task);
	if (gid_task == -1) {
		gid_task = make_group(gid_tasks, group_task);
		if (gid_task < 0) {
			info("Failed to open tasks %s", group_task);
			return SLURM_FAILURE;
		}
		put_int_attribute(gid_task, ATTR_TASKID, task_id);
	}
	put_int_attribute(gid_task, ATTR_CPUPERTASK, g_job->cpus_per_task);

	if (debug_flags & DEBUG_FLAG_PROFILE)
		info("PROFILE: task_end");
	return rc;
}
Exemplo n.º 24
0
static void test_group_readwrite_dead_faction(CuTest *tc) {
    gamedata data;
    storage store;
    faction *f, *f2;
    unit * u;
    group *g;
    ally *al;
    int fno;

    test_cleanup();
    f = test_create_faction(0);
    fno = f->no;
    CuAssertPtrEquals(tc, f, factions);
    CuAssertPtrEquals(tc, 0, f->next);
    f2 = test_create_faction(0);
    CuAssertPtrEquals(tc, f2, factions->next);
    u = test_create_unit(f2, test_create_region(0, 0, 0));
    CuAssertPtrNotNull(tc, u);
    g = join_group(u, "group");
    CuAssertPtrNotNull(tc, g);
    al = ally_add(&g->allies, f);
    CuAssertPtrNotNull(tc, al);

    CuAssertPtrEquals(tc, f, factions);
    destroyfaction(&factions);
    CuAssertTrue(tc, !f->_alive);
    CuAssertPtrEquals(tc, f2, factions);
    mstream_init(&data.strm);
    gamedata_init(&data, &store, RELEASE_VERSION);
    write_game(&data);
    free_gamedata();
    f = f2 = NULL;
    data.strm.api->rewind(data.strm.handle);
    read_game(&data);
    mstream_done(&data.strm);
    gamedata_done(&data);
    CuAssertPtrEquals(tc, 0, findfaction(fno));
    f2 = factions;
    CuAssertPtrNotNull(tc, f2);
    u = f2->units;
    CuAssertPtrNotNull(tc, u);
    g = get_group(u);
    CuAssertPtrNotNull(tc, g);
    CuAssertPtrEquals(tc, 0, g->allies);
    test_cleanup();
}
Exemplo n.º 25
0
	void WinSD::parse(PSECURITY_DESCRIPTOR sd) {
#ifdef ENABLE_LOGGER
		WORD ctrl = get_control(sd);
		LogInfo("Security descriptor:");
		LogInfo(L"SDDL: %s", WinSD::as_sddl(sd).c_str());
		LogInfo("Size: %Iu", size(sd));
		try {
			LogInfo(L"Owner: %s", Sid::get_name(get_owner(sd)).c_str());
		} catch (...) {
		}
		try {
			LogInfo(L"Group: %s", Sid::get_name(get_group(sd)).c_str());
		} catch (...) {
		}
		LogInfo(L"Control: 0x%x (%s) [%s]", (int)ctrl, bits::BitMask<WORD>::to_str_bin(ctrl).c_str(), bits::BitMask<WORD>::to_str_num(ctrl).c_str());
		if (bits::Flags::check(ctrl, (WORD)SE_OWNER_DEFAULTED))
			LogInfo(L"\tSE_OWNER_DEFAULTED (%s)", simstd::to_wstring(SE_OWNER_DEFAULTED).c_str());
		if (bits::Flags::check(ctrl, (WORD)SE_GROUP_DEFAULTED))
			LogInfo(L"\tSE_GROUP_DEFAULTED (%s)", simstd::to_wstring(SE_GROUP_DEFAULTED).c_str());
		if (bits::Flags::check(ctrl, (WORD)SE_DACL_PRESENT))
			LogInfo(L"\tSE_DACL_PRESENT (%s)", simstd::to_wstring(SE_DACL_PRESENT).c_str());
		if (bits::Flags::check(ctrl, (WORD)SE_DACL_DEFAULTED))
			LogInfo(L"\tSE_DACL_DEFAULTED (%s)", simstd::to_wstring(SE_DACL_DEFAULTED).c_str());
		if (bits::Flags::check(ctrl, (WORD)SE_SACL_PRESENT))
			LogInfo(L"\tSE_SACL_PRESENT (%s)", simstd::to_wstring(SE_SACL_PRESENT).c_str());
		if (bits::Flags::check(ctrl, (WORD)SE_SACL_DEFAULTED))
			LogInfo(L"\tSE_SACL_DEFAULTED (%s)", simstd::to_wstring(SE_SACL_DEFAULTED).c_str());
		if (bits::Flags::check(ctrl, (WORD)SE_DACL_AUTO_INHERIT_REQ))
			LogInfo(L"\tSE_DACL_AUTO_INHERIT_REQ (%s)", simstd::to_wstring(SE_DACL_AUTO_INHERIT_REQ).c_str());
		if (bits::Flags::check(ctrl, (WORD)SE_SACL_AUTO_INHERIT_REQ))
			LogInfo(L"\tSE_SACL_AUTO_INHERIT_REQ (%s)", simstd::to_wstring(SE_SACL_AUTO_INHERIT_REQ).c_str());
		if (bits::Flags::check(ctrl, (WORD)SE_DACL_AUTO_INHERITED))
			LogInfo(L"\tSE_DACL_AUTO_INHERITED (%s)", simstd::to_wstring(SE_DACL_AUTO_INHERITED).c_str());
		if (bits::Flags::check(ctrl, (WORD)SE_SACL_AUTO_INHERITED))
			LogInfo(L"\tSE_SACL_AUTO_INHERITED (%s)", simstd::to_wstring(SE_SACL_AUTO_INHERITED).c_str());
		if (bits::Flags::check(ctrl, (WORD)SE_DACL_PROTECTED))
			LogInfo(L"\tSE_DACL_PROTECTED (%s)", simstd::to_wstring(SE_DACL_PROTECTED).c_str());
		if (bits::Flags::check(ctrl, (WORD)SE_SACL_PROTECTED))
			LogInfo(L"\tSE_SACL_PROTECTED (%s)", simstd::to_wstring(SE_SACL_PROTECTED).c_str());
		if (bits::Flags::check(ctrl, (WORD)SE_SELF_RELATIVE))
			LogInfo(L"\tSE_SELF_RELATIVE (%s)", simstd::to_wstring(SE_SELF_RELATIVE).c_str());
#else
		(void)sd;
#endif
	}
Exemplo n.º 26
0
static Cmdret conf_op(List *args, Cmdarg *ca)
{
  log_msg("CONFIG", "conf_op");
  char *group  = list_arg(args, 1, VAR_STRING);
  char *before = list_arg(args, 2, VAR_STRING);
  char *after  = list_arg(args, 3, VAR_STRING);
  if (!group || !before)
    return NORET;
  if (!after)
    after = "";

  fn_group *grp = get_group(group);
  if (!grp)
    return NORET;

  grp->opgrp = op_newgrp(before, after);
  return NORET;
}
Exemplo n.º 27
0
/*
 * The loop process procedure.
 *
 * IN:
 * @count:               Loop count.
 * @flag :               Display flag.
 * @group_count:         The count of the groups.
 */
void rw_stats_loop(long count, int flag, int group_count) {

	int i = 0, cur = 0;
	cg_group* mem_group = NULL;
	unsigned long long itv = 0;
	setbuf(stdout, NULL );
	if (group_count > GROUP_COUNT_MAX)
		group_count = GROUP_COUNT_MAX;
	do {

		/** Display all of the groups statistics information. */
		for (i = 0; i < group_count; i++) {
			if (group_name[i] && !TAILQ_EMPTY(mem_groups)
					&& !get_group(mem_groups, &mem_group, group_name[i])) {
				if (read_cg_mem_stats(group_name[i], mem_group->mem_stats[cur])
						|| read_cg_cpu_stats(group_name[i],
								mem_group->cpuset_stats[cur])
						|| read_cg_io_stats(group_name[i],
								mem_group->blkio_stats[cur])) {
					fprintf(stderr,
							"cgvmstat: read the cpu, io and memory stats of group: %s failed.\n",
							group_name[i]);
					printf(
							"error: Read the cpu, io and memory stats of group: %s failed.\n",
							group_name[i]);
					return;
				}
				itv = get_total_interval(mem_group->cpuset_stats[cur],
						mem_group->cpuset_stats[!cur]);
				write_vm_stats(mem_group, cur, flag, itv);
			} else
				printf("no statistics information in group: %s\n",
						group_name[i]);
		}
		if (count > 0) {
			count--;
		}
		if (count) {
			cur ^= 1;
			pause();
		}
	} while (count);

}
Exemplo n.º 28
0
extern hid_t make_group(hid_t parent, const char *name)
{
    hid_t gid = -1;

    if (parent < 0) {
        debug3("PROFILE: parent is not HDF5 object");
        return -1;
    }
    gid = get_group(parent, name);
    if (gid > 0)
        return gid;
    gid = H5Gcreate(parent, name, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
    if (gid < 0) {
        debug3("PROFILE: failed to create HDF5 group=%s", name);
        return -1;
    }

    return gid;
}
Exemplo n.º 29
0
/*
 * The loop process procedure.
 *
 * IN:
 * @count:               Loop count.
 * @flag :               Display flag.
 * @group_count:         The count of the groups.
 */
void rw_stats_loop(long count, int flag, int group_count) {

	int i = 0, cur = 0;
	cg_group* mem_group = NULL;
	unsigned long long mem_usage, mem_swap_usage, mem_max_usage,
			mem_swap_max_usage;
	unsigned long long mem_limit, mem_swap_limit;
	setbuf(stdout, NULL );
	if (group_count > GROUP_COUNT_MAX)
		group_count = GROUP_COUNT_MAX;
	do {

		/** Display all of the groups statistics information. */
		for (i = 0; i < group_count; i++) {
			printf("------ %s ------\n", group_name[i]);
			if (group_name[i] && !TAILQ_EMPTY(mem_groups)
					&& !get_group(mem_groups, &mem_group, group_name[i])) {
				if (read_cg_mem_stats(group_name[i],
						mem_group->mem_stats[cur])) {
					fprintf(stderr,
							"cgiostat: read the memory stats of group: %s failed.\n",
							group_name[i]);
					printf(
							"error: Read the memory stats of group: %s failed.\n",
							group_name[i]);
					return;
				}

				write_mem_stats(mem_group->mem_stats[cur], flag);
			} else
				printf("no memory information in group: %s\n", group_name[i]);
		}
		if (count > 0) {
			count--;
		}
		if (count) {
			cur ^= 1;
			pause();
		}
	} while (count);

}
Exemplo n.º 30
0
void populate_group_table_from_file(int fd) {
  loff_t fsize = file_size(fd);
  int i;
  group *g;

  for (i = 0; i<fsize/sizeof(group); i++) {
    read_block(fd, (char*)(&groups[i]), sizeof(group));
    g = &groups[i];
    if (g->group_name) {
      g->numeric_nodes = NULL;
      g->thread_nodes = NULL;
      g->nodes_length = 0;
      get_group(get_string(g->group_name));
#ifdef DEBUG
      printf("%s (%d, %d)\n", get_string(g->group_name), g->total_articles,
	     g->max_article);
#endif
    }
  }
}