Exemple #1
0
/*
 * mon_stop - stop the monitoring software
 */
void
mon_stop(
    int mode
)
{
    mon_entry *mon;

    if (MON_OFF == mon_enabled)
        return;
    if ((mon_enabled & mode) == 0 || mode == MON_OFF)
        return;

    mon_enabled &= ~mode;
    if (mon_enabled != MON_OFF)
        return;

    /*
     * Move everything on the MRU list to the free list quickly,
     * without bothering to remove each from either the MRU list or
     * the hash table.
     */
    ITER_DLIST_BEGIN(mon_mru_list, mon, mru, mon_entry)
    mon_free_entry(mon);
    ITER_DLIST_END()

    /* empty the MRU list and hash table. */
    mru_entries = 0;
    INIT_DLIST(mon_mru_list, mru);
    zero_mem(mon_hash, sizeof(*mon_hash) * MON_HASH_SIZE);
}
Exemple #2
0
/*
 * init_mon - initialize monitoring global data
 */
void
init_mon(void)
{
    /*
     * Don't do much of anything here.  We don't allocate memory
     * until mon_start().
     */
    mon_enabled = MON_OFF;
    INIT_DLIST(mon_mru_list, mru);
}
Exemple #3
0
/*
 * init_auth - initialize internal data
 */
void
init_auth(void)
{
	size_t newalloc;

	/*
	 * Initialize hash table and free list
	 */
	newalloc = authhashbuckets * sizeof(key_hash[0]);

	key_hash = erealloc(key_hash, newalloc);
	memset(key_hash, '\0', newalloc);

	INIT_DLIST(key_listhead, llink);

#ifdef DEBUG
	atexit(&free_auth_mem);
#endif
}
Exemple #4
0
static void simple_http_handle_write(hixo_socket_t *p_sock);
static void simple_http_handle_disconnect(hixo_socket_t *p_sock);

static hixo_listen_conf_t sa_simple_http_srvs[] = {
    {"0.0.0.0", 8002, 0},
    {"0.0.0.0", 8003, 0},
};

static hixo_app_module_ctx_t s_simple_http_ctx = {
    &simple_http_handle_connect,
    &simple_http_handle_read,
    &simple_http_handle_write,
    &simple_http_handle_disconnect,
    sa_simple_http_srvs,
    ARRAY_COUNT(sa_simple_http_srvs),
    INIT_DLIST(s_simple_http_ctx.m_node),
};

hixo_module_t g_simple_http_module = {
    NULL,
    &simple_http_init_worker,
    NULL,
    NULL,
    NULL,
    NULL,

    HIXO_MODULE_APP,
    &s_simple_http_ctx,
};