1 /* 2 * CDDL HEADER START 3 * 4 * The contents of this file are subject to the terms of the 5 * Common Development and Distribution License, Version 1.0 only 6 * (the "License"). You may not use this file except in compliance 7 * with the License. 8 * 9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 10 * or http://www.opensolaris.org/os/licensing. 11 * See the License for the specific language governing permissions 12 * and limitations under the License. 13 * 14 * When distributing Covered Code, include this CDDL HEADER in each 15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 16 * If applicable, add the following below this CDDL HEADER, with the 17 * fields enclosed by brackets "[]" replaced with your own identifying 18 * information: Portions Copyright [yyyy] [name of copyright owner] 19 * 20 * CDDL HEADER END 21 */ 22 /* 23 * Copyright 2004 Sun Microsystems, Inc. All rights reserved. 24 * Use is subject to license terms. 25 */ 26 27 #ifndef _FMD_EVENTQ_H 28 #define _FMD_EVENTQ_H 29 30 #pragma ident "%Z%%M% %I% %E% SMI" 31 32 #include <pthread.h> 33 34 #ifdef __cplusplus 35 extern "C" { 36 #endif 37 38 #include <fmd_event.h> 39 #include <fmd_list.h> 40 41 typedef struct fmd_eventqelem { 42 fmd_list_t eqe_list; /* linked-list prev/next pointers */ 43 fmd_event_t *eqe_event; /* pointer to event */ 44 } fmd_eventqelem_t; 45 46 struct fmd_module; /* see <fmd_module.h> */ 47 48 typedef struct fmd_eventq { 49 pthread_mutex_t eq_lock; /* lock protecting queue contents */ 50 pthread_cond_t eq_cv; /* condition variable for waiters */ 51 fmd_list_t eq_list; /* list head/tail pointers for queue */ 52 struct fmd_module *eq_mod; /* module associated with this queue */ 53 uint_t eq_limit; /* limit on number of queue elements */ 54 uint_t eq_size; /* number of elements on queue */ 55 uint_t eq_abort; /* flag for fmd_eventq_abort() */ 56 } fmd_eventq_t; 57 58 extern fmd_eventq_t *fmd_eventq_create(struct fmd_module *, uint_t); 59 extern void fmd_eventq_destroy(fmd_eventq_t *); 60 extern void fmd_eventq_insert_at_head(fmd_eventq_t *, fmd_event_t *); 61 extern void fmd_eventq_insert_at_time(fmd_eventq_t *, fmd_event_t *); 62 extern fmd_event_t *fmd_eventq_delete(fmd_eventq_t *); 63 extern void fmd_eventq_cancel(fmd_eventq_t *, uint_t, void *); 64 extern void fmd_eventq_abort(fmd_eventq_t *); 65 66 #ifdef __cplusplus 67 } 68 #endif 69 70 #endif /* _FMD_EVENTQ_H */ 71