Exemplo n.º 1
0
static int capfile_ctor(struct capfile *capfile, struct capfile_ops const *ops, char const *path, unsigned max_pkts, size_t max_size, unsigned max_secs, size_t cap_len, unsigned rotation, struct timeval const *now)
{
    mutex_ctor_with_type(&capfile->lock, "capfile", PTHREAD_MUTEX_RECURSIVE);
    capfile->ops       = ops;
    capfile->path      = objalloc_strdup(path);
    if (! capfile->path) goto err1;
    capfile->max_pkts  = max_pkts;
    capfile->max_size  = max_size;
    capfile->max_secs  = max_secs;
    capfile->cap_len   = cap_len;
    capfile->rotation  = rotation;
    capfile->file_num  = 0;
    capfile->fd        = -1;

    if (0 != capfile->ops->open(capfile, capfile_path(capfile), now)) goto err2;

    mutex_lock(&capfiles_lock);
    LIST_INSERT_HEAD(&capfiles, capfile, entry);
    mutex_unlock(&capfiles_lock);
    return 0;

err2:
    objfree(capfile->path);
err1:
    mutex_dtor(&capfile->lock);
    return -1;
}
Exemplo n.º 2
0
void eth_fini(void)
{
    assert(LIST_EMPTY(&eth_subprotos));
    mux_proto_dtor(&mux_proto_eth);
    mutex_dtor(&eth_subprotos_mutex);
    ext_param_collapse_vlans_fini();
    log_category_proto_eth_fini();
}
Exemplo n.º 3
0
void eth_fini(void)
{
#   ifdef DELETE_ALL_AT_EXIT
    assert(LIST_EMPTY(&eth_subprotos));
    mux_proto_dtor(&mux_proto_eth);
    mutex_dtor(&eth_subprotos_mutex);
#   endif
    ext_param_collapse_vlans_fini();
    log_category_proto_eth_fini();
}
Exemplo n.º 4
0
void ref_fini(void)
{
    if (--inited) return;

#   ifdef DELETE_ALL_AT_EXIT
    rwlock_dtor(&rwlock);
    mutex_dtor(&death_row_mutex);
#   endif
    log_category_ref_fini();
    bench_event_dtor(&dooming);

    bench_fini();
    mutex_fini();
}
Exemplo n.º 5
0
static void capfile_dtor(struct capfile *capfile)
{
    mutex_lock(&capfiles_lock);
    LIST_REMOVE(capfile, entry);
    mutex_unlock(&capfiles_lock);

    if (capfile->fd >= 0) {
        file_close(capfile->fd);
        capfile->fd = -1;
        dec_capture_files();
    }

    if (capfile->path) {
        objfree(capfile->path);
        capfile->path = NULL;
    }

    mutex_dtor(&capfile->lock);
}
Exemplo n.º 6
0
void _cmp_groupcounter_deinit()
{
  mutex_dtor(_cmp_groupcounter->mutex);
}