Home | History | Annotate | Download | only in common
      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 (the "License").
      6  * You may not use this file except in compliance with the License.
      7  *
      8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
      9  * or http://www.opensolaris.org/os/licensing.
     10  * See the License for the specific language governing permissions
     11  * and limitations under the License.
     12  *
     13  * When distributing Covered Code, include this CDDL HEADER in each
     14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
     15  * If applicable, add the following below this CDDL HEADER, with the
     16  * fields enclosed by brackets "[]" replaced with your own identifying
     17  * information: Portions Copyright [yyyy] [name of copyright owner]
     18  *
     19  * CDDL HEADER END
     20  *
     21  * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
     22  * Use is subject to license terms.
     23  */
     24 
     25 #ifndef	__DM_MSG_H
     26 #define	__DM_MSG_H
     27 
     28 
     29 #ifdef	__cplusplus
     30 extern "C" {
     31 #endif
     32 
     33 #include <mms_sym.h>
     34 #include <mms_list.h>
     35 #include <mms_dm_msg.h>
     36 
     37 extern	mms_list_t	dm_msg_hdr_list;
     38 
     39 #define	DM_MSG_DM	"dm"
     40 #define	DM_MSG_ERROR	"error"
     41 
     42 /*
     43  * There is a dm_msghdr_t for every pthread.
     44  */
     45 typedef	struct	dm_msg_hdr {
     46 	mms_list_node_t	msg_next;
     47 	mms_list_t	msg_msglist;
     48 	pthread_t	msg_tid;		/* pthread id */
     49 }	dm_msg_hdr_t;
     50 
     51 typedef	struct	dm_msg {
     52 	mms_list_node_t	msg_next;
     53 	char		*msg_text;		/* could be NULL */
     54 	int		msg_class;		/* error class */
     55 	int		msg_code;		/* error code */
     56 }	dm_msg_t;
     57 
     58 #define	DM_MSG_ADD(x)		TRACE((MMS_ERR, dm_msg_add x))
     59 #define	DM_MSG_ADD_HEAD(x)	TRACE((MMS_ERR, dm_msg_add_head x))
     60 #define	DM_MSG_PREPEND(x)	TRACE((MMS_ERR, dm_msg_prepend x))
     61 #define	DM_ADM_ERR		"administrator", "error"
     62 #define	DM_MSG_SEND(x)		dm_send_message x
     63 #define	DM_MSG_REASON		"dm", DMNAME, "error", dm_msg_text(), NULL
     64 
     65 #ifdef	__cplusplus
     66 }
     67 #endif
     68 
     69 #endif	/* __DM_MSG_H */
     70