Print this page
10114 fmev_proxy_cb() doesn't need inval checks

Split Close
Expand all
Collapse all
          --- old/usr/src/lib/fm/libfmevent/common/fmev_subscribe.c
          +++ new/usr/src/lib/fm/libfmevent/common/fmev_subscribe.c
↓ open down ↓ 16 lines elided ↑ open up ↑
  17   17   * information: Portions Copyright [yyyy] [name of copyright owner]
  18   18   *
  19   19   * CDDL HEADER END
  20   20   */
  21   21  
  22   22  /*
  23   23   * Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
  24   24   */
  25   25  
  26   26  /*
       27 + * Copyright (c) 2018, Joyent, Inc.
       28 + */
       29 +
       30 +/*
  27   31   * FMA event subscription interfaces - subscribe to FMA protocol
  28   32   * from outside the fault manager.
  29   33   */
  30   34  
  31   35  #include <sys/types.h>
  32   36  #include <atomic.h>
  33   37  #include <libsysevent.h>
  34   38  #include <libuutil.h>
  35   39  #include <pthread.h>
  36   40  #include <stdarg.h>
↓ open down ↓ 161 lines elided ↑ open up ↑
 198  202  
 199  203          shdlctl_end(ihdl);
 200  204          return (fmev_seterr(FMEV_SUCCESS));
 201  205  }
 202  206  
 203  207  /*
 204  208   * Our door service function.  We return 0 regardless so that the kernel
 205  209   * does not keep either retrying (EAGAIN) or bleat to cmn_err.
 206  210   */
 207  211  
 208      -uint64_t fmev_proxy_cb_inval;
 209  212  uint64_t fmev_proxy_cb_enomem;
 210  213  
 211  214  int
 212  215  fmev_proxy_cb(sysevent_t *sep, void *arg)
 213  216  {
 214  217          struct fmev_subinfo *sip = arg;
 215  218          fmev_shdl_impl_t *ihdl = sip->si_ihdl;
 216  219          nvlist_t *nvl;
 217  220          char *class;
 218  221          fmev_t ev;
 219  222  
 220      -        if (sip == NULL || sip->si_cb == NULL) {
 221      -                fmev_proxy_cb_inval++;
 222      -                return (0);
 223      -        }
 224      -
 225  223          if ((ev = fmev_sysev2fmev(IHDL2HDL(ihdl), sep, &class, &nvl)) == NULL) {
 226  224                  fmev_proxy_cb_enomem++;
 227  225                  return (0);
 228  226          }
 229  227  
 230  228          if (ihdl->sh_flags & SHDL_FL_SERIALIZE)
 231  229                  (void) pthread_mutex_lock(&ihdl->sh_srlz_lock);
 232  230  
 233  231          sip->si_cb(ev, class, nvl, sip->si_cbarg);
 234  232  
↓ open down ↓ 482 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX