Path: blob/main/cddl/contrib/opensolaris/lib/libdtrace/common/dt_pq.h
39562 views
/*1* CDDL HEADER START2*3* This file and its contents are supplied under the terms of the4* Common Development and Distribution License ("CDDL"), version 1.0.5* You may only use this file in accordance with the terms of version6* 1.0 of the CDDL.7*8* A full copy of the text of the CDDL should have accompanied this9* source. A copy of the CDDL is also available via the Internet at10* http://www.illumos.org/license/CDDL.11*12* CDDL HEADER END13*/1415/*16* Copyright (c) 2012 by Delphix. All rights reserved.17*/1819#ifndef _DT_PQ_H20#define _DT_PQ_H2122#include <dtrace.h>2324#ifdef __cplusplus25extern "C" {26#endif2728typedef uint64_t (*dt_pq_value_f)(void *, void *);2930typedef struct dt_pq {31dtrace_hdl_t *dtpq_hdl; /* dtrace handle */32void **dtpq_items; /* array of elements */33uint_t dtpq_size; /* count of allocated elements */34uint_t dtpq_last; /* next free slot */35dt_pq_value_f dtpq_value; /* callback to get the value */36void *dtpq_arg; /* callback argument */37} dt_pq_t;3839extern dt_pq_t *dt_pq_init(dtrace_hdl_t *, uint_t size, dt_pq_value_f, void *);40extern void dt_pq_fini(dt_pq_t *);4142extern void dt_pq_insert(dt_pq_t *, void *);43extern void *dt_pq_pop(dt_pq_t *);44extern void *dt_pq_walk(dt_pq_t *, uint_t *);4546#ifdef __cplusplus47}48#endif4950#endif /* _DT_PQ_H */515253