<commit_before>#include <sys/types.h>
#include <stdlib.h>
#include <stdio.h>
#include <sys/select.h>
#include <sys/socket.h>
#include <netinet/in.h>

#include "condor_types.h"
#include "condor_debug.h"
#include "condor_expressions.h"
#include "sched.h"

#include "cdefs.h"
#include "event.h"
#include "state.h"
#include "resource.h"
#include "resmgr.h"

extern CONTEXT *template_context;
static char *_FileName_;

extern EXPR *build_expr();

/*
 * Higher level routines to manage a collection of resources.
 * XXX - DON'T do this using lineair searches..
 */

static resource_info_t *resources;
static int nresources;
static fd_set cur_fds;

static int resmgr_vacateone	__P((resource_info_t *));
static int resmgr_addfd		__P((resource_info_t *));
static int resmgr_command	__P((resource_info_t *));

int
resmgr_init()
{
	int nres, i, index;
	resource_name_t *rnames;
	resource_id_t rid;
	resource_param_t param;

	resource_names(&rnames, &nres);
	dprintf(D_ALWAYS, "resmgr_init: %d resources.\n", nres);
	resources = (resource_info_t *)calloc(nres, (sizeof (resource_info_t)));
	for (i = index = 0; i < nres; i++) {
		dprintf(D_ALWAYS, "opening resource '%s'\n", rnames[i]);
		if (resource_open(rnames[i], &rid) < 0)
			continue;
		resources[index].r_rid = rid;
		dprintf(D_ALWAYS, "resource %d has id '%s'\n", index,
			resources[index].r_rid);
		resources[index].r_state = NO_JOB;
		if (resource_params(rid, NO_JID, NO_TID,
		    &resources[index].r_param, NULL) < 0)
			continue;
		resources[index].r_name = rnames[i];
		resources[index].r_pid = NO_PID;
		resources[index].r_claimed = FALSE;
		resources[index].r_context = create_context();
		resources[index].r_jobcontext = NULL;
		resources[index].r_capab = NULL;
		resources[index].r_interval = 0;
		resources[index].r_receivetime = 0;<commit_msg>This file seems to have some comments added.<commit_after>#include <sys/types.h>
#include <stdlib.h>
#include <stdio.h>
#include <sys/select.h>
#include <sys/socket.h>
#include <netinet/in.h>

#include "condor_types.h"
#include "condor_debug.h"
#include "condor_expressions.h"
#include "sched.h"

#include "cdefs.h"
#include "event.h"
#include "state.h"
#include "resource.h"
#include "resmgr.h"

extern CONTEXT *template_context;
static char *_FileName_;

extern EXPR *build_expr();

/*
 * Higher level routines to manage a collection of resources.
 * XXX - DON'T do this using lineair searches..
 */

static resource_info_t *resources;
static int nresources;
static fd_set cur_fds;

static int resmgr_vacateone	__P((resource_info_t *));
static int resmgr_addfd		__P((resource_info_t *));
static int resmgr_command	__P((resource_info_t *));

int
resmgr_init()
{
	int nres, i, index;
	resource_name_t *rnames;
	resource_id_t rid;
	resource_param_t param;

	// collect all resources that were listed in the config file
	// and their number
	resource_names(&rnames, &nres);
	dprintf(D_ALWAYS, "resmgr_init: %d resources.\n", nres);
	resources = (resource_info_t *)calloc(nres, (sizeof (resource_info_t)));
	for (i = index = 0; i < nres; i++) {
		dprintf(D_ALWAYS, "opening resource '%s'\n", rnames[i]);
		if (resource_open(rnames[i], &rid) < 0)
			continue;
		resources[index].r_rid = rid;
		dprintf(D_ALWAYS, "resource %d has id '%s'\n", index,
			resources[index].r_rid);
		resources[index].r_state = NO_JOB;
		if (resource_params(rid, NO_JID, NO_TID,
		    &resources[index].r_param, NULL) < 0)
			continue;
		resources[index].r_name = rnames[i];
		resources[index].r_pid = NO_PID;
		resources[index].r_claimed = FALSE;
		resources[index].r_context = create_context();
		resources[index].r_jobcontext = NULL;
		resources[index].r_capab = NULL;
		resources[index].r_interval = 0;
		resources[index].r_receivetime = 0;
{'fraction_non_alphanumeric': 0.14327956989247312, 'fraction_numerical': 0.002688172043010753, 'mean_word_length': 5.243288590604027, 'pattern_counts': {'":': 0, '<': 21, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1757618', 'n_tokens_mistral': 1473, 'n_tokens_neox': 1397, 'n_words': 325}