Esempio n. 1
0
File: ioctx.c Progetto: chaos/diod
static char *
_ppool_dump (char *name, void *a)
{
    Npsrv *srv = a;
    PathPool pp = srv->srvaux;
    DynStr ds = { .s = NULL, .len = 0 };

    xpthread_mutex_lock (&pp->lock);
    hash_for_each (pp->hash, (hash_arg_f)_get_one_file, &ds);
    xpthread_mutex_unlock (&pp->lock);

    return ds.s;
}

void
ppool_fini (Npsrv *srv)
{
    PathPool pp = srv->srvaux;

    if (pp) {
        if (pp->hash) {
            /* issue 99: this triggers when shutting down with active clients */
            /*NP_ASSERT (hash_is_empty (pp->hash));*/
            hash_destroy (pp->hash);
        }
        pthread_mutex_destroy (&pp->lock);
        free (pp);
    }
    srv->srvaux = NULL;
}
Esempio n. 2
0
int 
wrap_hash_for_each(WRAPPERS_ARGS, hash_t h, hash_arg_f argf, void *arg)
{
  int rv;

  assert(file && function);

  if (!h || !argf)
    WRAPPERS_ERR_INVALID_PARAMETERS("hash_for_each");

  if ((rv = hash_for_each(h, argf, arg)) < 0)
    WRAPPERS_ERR_ERRNO("hash_for_each");

  return rv;
}
Esempio n. 3
0
int
lmt_db_server_map (lmt_db_t db, char *svctype, lmt_db_map_f mf, void *arg)
{
    struct map_struct m;
    
    assert (db->magic == LMT_DBHANDLE_MAGIC);

    m.svctype = svctype;
    m.mf = mf;
    m.arg = arg;
    m.error = 0;

    hash_for_each (db->idhash, (hash_arg_f)_mapfun, &m);
    return (m.error ? -1 : 0);
}
Esempio n. 4
0
void cf_list (struct cf_file *cf, FILE *f)
{
    hash_for_each (cf->db, (hash_arg_f)cfi_list, f);
}