xref: /onnv-gate/usr/src/cmd/fm/fmdump/common/error.c (revision 9501:f84d3cc28d24)
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
55609Scy152378  * Common Development and Distribution License (the "License").
65609Scy152378  * 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*9501SRobert.Johnston@Sun.COM  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
230Sstevel@tonic-gate  * Use is subject to license terms.
240Sstevel@tonic-gate  */
250Sstevel@tonic-gate 
260Sstevel@tonic-gate #include <fmdump.h>
270Sstevel@tonic-gate #include <stdio.h>
280Sstevel@tonic-gate #include <time.h>
290Sstevel@tonic-gate 
300Sstevel@tonic-gate /*ARGSUSED*/
310Sstevel@tonic-gate static int
320Sstevel@tonic-gate err_short(fmd_log_t *lp, const fmd_log_record_t *rp, FILE *fp)
330Sstevel@tonic-gate {
340Sstevel@tonic-gate 	char buf[32];
350Sstevel@tonic-gate 
365609Scy152378 	fmdump_printf(fp, "%-20s %-32s\n",
375609Scy152378 	    fmdump_date(buf, sizeof (buf), rp), rp->rec_class);
380Sstevel@tonic-gate 
390Sstevel@tonic-gate 	return (0);
400Sstevel@tonic-gate }
410Sstevel@tonic-gate 
420Sstevel@tonic-gate /*ARGSUSED*/
430Sstevel@tonic-gate static int
440Sstevel@tonic-gate err_verb1(fmd_log_t *lp, const fmd_log_record_t *rp, FILE *fp)
450Sstevel@tonic-gate {
460Sstevel@tonic-gate 	uint64_t ena = 0;
470Sstevel@tonic-gate 	char buf[32];
480Sstevel@tonic-gate 
490Sstevel@tonic-gate 	(void) nvlist_lookup_uint64(rp->rec_nvl, FM_EREPORT_ENA, &ena);
500Sstevel@tonic-gate 
515609Scy152378 	fmdump_printf(fp, "%-20s %-37s 0x%016llx\n",
525609Scy152378 	    fmdump_date(buf, sizeof (buf), rp), rp->rec_class, ena);
530Sstevel@tonic-gate 
540Sstevel@tonic-gate 	return (0);
550Sstevel@tonic-gate }
560Sstevel@tonic-gate 
570Sstevel@tonic-gate /*ARGSUSED*/
580Sstevel@tonic-gate static int
590Sstevel@tonic-gate err_verb2(fmd_log_t *lp, const fmd_log_record_t *rp, FILE *fp)
600Sstevel@tonic-gate {
610Sstevel@tonic-gate 	char buf[32];
620Sstevel@tonic-gate 
630Sstevel@tonic-gate 	fmdump_printf(fp, "%-20s.%9.9llu %s\n",
640Sstevel@tonic-gate 	    fmdump_year(buf, sizeof (buf), rp), rp->rec_nsec, rp->rec_class);
650Sstevel@tonic-gate 
660Sstevel@tonic-gate 	nvlist_print(fp, rp->rec_nvl);
670Sstevel@tonic-gate 	fmdump_printf(fp, "\n");
680Sstevel@tonic-gate 	return (0);
690Sstevel@tonic-gate }
700Sstevel@tonic-gate 
710Sstevel@tonic-gate const fmdump_ops_t fmdump_err_ops = {
720Sstevel@tonic-gate "error", {
730Sstevel@tonic-gate {
740Sstevel@tonic-gate "TIME                 CLASS",
750Sstevel@tonic-gate (fmd_log_rec_f *)err_short
760Sstevel@tonic-gate }, {
770Sstevel@tonic-gate "TIME                 CLASS                                 ENA",
780Sstevel@tonic-gate (fmd_log_rec_f *)err_verb1
790Sstevel@tonic-gate }, {
800Sstevel@tonic-gate "TIME                           CLASS",
810Sstevel@tonic-gate (fmd_log_rec_f *)err_verb2
82*9501SRobert.Johnston@Sun.COM }, {
83*9501SRobert.Johnston@Sun.COM NULL, NULL
840Sstevel@tonic-gate } }
850Sstevel@tonic-gate };
86