Print this page
OS-1840 fmdump shall emit JSON

Split Close
Expand all
Collapse all
          --- old/usr/src/cmd/fm/fmdump/common/fault.c
          +++ new/usr/src/cmd/fm/fmdump/common/fault.c
↓ open down ↓ 12 lines elided ↑ open up ↑
  13   13   * When distributing Covered Code, include this CDDL HEADER in each
  14   14   * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15   15   * If applicable, add the following below this CDDL HEADER, with the
  16   16   * fields enclosed by brackets "[]" replaced with your own identifying
  17   17   * information: Portions Copyright [yyyy] [name of copyright owner]
  18   18   *
  19   19   * CDDL HEADER END
  20   20   */
  21   21  /*
  22   22   * Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved.
       23 + * Copyright (c) 2013, Joyent, Inc. All rights reserved.
  23   24   */
  24   25  
  25   26  #include <fmdump.h>
  26   27  #include <stdio.h>
  27   28  #include <strings.h>
       29 +#include <alloca.h>
  28   30  
  29   31  /*ARGSUSED*/
  30   32  static int
  31   33  flt_short(fmd_log_t *lp, const fmd_log_record_t *rp, FILE *fp)
  32   34  {
  33   35          char buf[32], str[32];
  34   36          char *class = NULL, *uuid = "-", *code = "-";
  35   37  
  36   38          static const struct {
  37   39                  const char *class;
↓ open down ↓ 156 lines elided ↑ open up ↑
 194  196  
 195  197          return (0);
 196  198  }
 197  199  
 198  200  static int
 199  201  flt_verb2(fmd_log_t *lp, const fmd_log_record_t *rp, FILE *fp)
 200  202  {
 201  203          return (flt_verb23_cmn(lp, rp, fp, NULL));
 202  204  }
 203  205  
 204      -
 205  206  static int
 206  207  flt_pretty(fmd_log_t *lp, const fmd_log_record_t *rp, FILE *fp)
 207  208  {
 208  209          nvlist_prtctl_t pctl;
 209  210          int rc;
 210  211  
 211  212          if ((pctl = nvlist_prtctl_alloc()) != NULL) {
 212  213                  nvlist_prtctl_setdest(pctl, fp);
 213  214                  nvlist_prtctlop_nvlist(pctl, fmdump_render_nvlist, NULL);
 214  215          }
↓ open down ↓ 63 lines elided ↑ open up ↑
 278  279  "TIME                           UUID"
 279  280  "                                 SUNW-MSG-ID",
 280  281  (fmd_log_rec_f *)flt_verb2
 281  282  }, {
 282  283  "TIME                           UUID"
 283  284  "                                 SUNW-MSG-ID",
 284  285  (fmd_log_rec_f *)flt_pretty
 285  286  }, {
 286  287  NULL,
 287  288  (fmd_log_rec_f *)flt_msg
      289 +}, {
      290 +NULL,
      291 +(fmd_log_rec_f *)fmdump_print_json
 288  292  } }
 289  293  };
    
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX