10Sstevel@tonic-gate /* 20Sstevel@tonic-gate * CDDL HEADER START 30Sstevel@tonic-gate * 40Sstevel@tonic-gate * The contents of this file are subject to the terms of the 5*12967Sgavin.maltby@oracle.com * Common Development and Distribution License (the "License"). 6*12967Sgavin.maltby@oracle.com * You may not use this file except in compliance with the License. 70Sstevel@tonic-gate * 80Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 90Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 100Sstevel@tonic-gate * See the License for the specific language governing permissions 110Sstevel@tonic-gate * and limitations under the License. 120Sstevel@tonic-gate * 130Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 140Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 150Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 160Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 170Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 180Sstevel@tonic-gate * 190Sstevel@tonic-gate * CDDL HEADER END 200Sstevel@tonic-gate */ 210Sstevel@tonic-gate /* 22*12967Sgavin.maltby@oracle.com * Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved. 230Sstevel@tonic-gate */ 240Sstevel@tonic-gate 250Sstevel@tonic-gate #ifndef _FMD_THREAD_H 260Sstevel@tonic-gate #define _FMD_THREAD_H 270Sstevel@tonic-gate 280Sstevel@tonic-gate #ifdef __cplusplus 290Sstevel@tonic-gate extern "C" { 300Sstevel@tonic-gate #endif 310Sstevel@tonic-gate 320Sstevel@tonic-gate #include <fmd_list.h> 330Sstevel@tonic-gate #include <fmd_trace.h> 340Sstevel@tonic-gate 350Sstevel@tonic-gate struct fmd_module; /* see <fmd_module.h> */ 360Sstevel@tonic-gate 370Sstevel@tonic-gate typedef void fmd_thread_f(void *); /* signature of thread startup func */ 380Sstevel@tonic-gate 390Sstevel@tonic-gate typedef struct fmd_thread { 400Sstevel@tonic-gate fmd_list_t thr_list; /* linked-list next/prev pointers */ 410Sstevel@tonic-gate struct fmd_module *thr_mod; /* module associated with this thread */ 420Sstevel@tonic-gate pthread_t thr_tid; /* thread identifier */ 430Sstevel@tonic-gate fmd_thread_f *thr_func; /* thread startup function */ 440Sstevel@tonic-gate void *thr_arg; /* argument for startup function */ 450Sstevel@tonic-gate fmd_tracebuf_t *thr_trdata; /* thread trace buffer */ 460Sstevel@tonic-gate fmd_tracebuf_f *thr_trfunc; /* thread trace function */ 470Sstevel@tonic-gate uint_t thr_errdepth; /* fmd_verror() nesting depth */ 48*12967Sgavin.maltby@oracle.com int thr_isdoor; /* a private door server thread */ 490Sstevel@tonic-gate } fmd_thread_t; 500Sstevel@tonic-gate 510Sstevel@tonic-gate extern fmd_thread_t *fmd_thread_xcreate(struct fmd_module *, pthread_t); 520Sstevel@tonic-gate extern fmd_thread_t *fmd_thread_create(struct fmd_module *, 530Sstevel@tonic-gate fmd_thread_f *, void *); 54*12967Sgavin.maltby@oracle.com extern fmd_thread_t *fmd_doorthread_create(struct fmd_module *, 55*12967Sgavin.maltby@oracle.com fmd_thread_f *, void *); 560Sstevel@tonic-gate 570Sstevel@tonic-gate #define FMD_THREAD_NOJOIN 0 /* do not attempt to join with thread */ 580Sstevel@tonic-gate #define FMD_THREAD_JOIN 1 /* wait for and join with thread */ 590Sstevel@tonic-gate 600Sstevel@tonic-gate extern void fmd_thread_destroy(fmd_thread_t *, int); 610Sstevel@tonic-gate 620Sstevel@tonic-gate #ifdef __cplusplus 630Sstevel@tonic-gate } 640Sstevel@tonic-gate #endif 650Sstevel@tonic-gate 660Sstevel@tonic-gate #endif /* _FMD_THREAD_H */ 67