Print this page
11626 introduce /etc/versions/build
11627 clean up UUID code for ::status

Split Close
Expand all
Collapse all
          --- old/usr/src/cmd/mdb/common/modules/mdb_ks/mdb_ks.c
          +++ new/usr/src/cmd/mdb/common/modules/mdb_ks/mdb_ks.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) 1990, 2010, Oracle and/or its affiliates. All rights reserved.
  23      - * Copyright 2017 Joyent, Inc.
       23 + * Copyright 2019 Joyent, Inc.
  24   24   */
  25   25  
  26   26  /*
  27   27   * Mdb kernel support module.  This module is loaded automatically when the
  28   28   * kvm target is initialized.  Any global functions declared here are exported
  29   29   * for the resolution of symbols in subsequently loaded modules.
  30   30   *
  31   31   * WARNING: Do not assume that static variables in mdb_ks will be initialized
  32   32   * to zero.
  33   33   */
↓ open down ↓ 971 lines elided ↑ open up ↑
1005 1005                          break;
1006 1006  
1007 1007                  mb = (uintptr_t)mb_local.b_next;
1008 1008          }
1009 1009          return (mb);
1010 1010  }
1011 1011  
1012 1012  int
1013 1013  mdb_name_to_major(const char *name, major_t *major)
1014 1014  {
1015      -        uintptr_t       mbind;
1016      -        uintptr_t       mb_hashtab[MOD_BIND_HASHSIZE];
1017      -        struct bind     mbind_local;
     1015 +        uintptr_t mbind;
     1016 +        uintptr_t mb_hashtab[MOD_BIND_HASHSIZE];
     1017 +        struct bind mbind_local;
1018 1018  
1019 1019  
1020 1020          if (mdb_readsym(mb_hashtab, sizeof (mb_hashtab), "mb_hashtab") == -1) {
1021 1021                  mdb_warn("failed to read symbol 'mb_hashtab'");
1022 1022                  return (-1);
1023 1023          }
1024 1024  
1025 1025          if ((mbind = find_mbind(name, mb_hashtab)) != 0) {
1026 1026                  if (mdb_vread(&mbind_local, sizeof (mbind_local), mbind) ==
1027 1027                      -1) {
↓ open down ↓ 774 lines elided ↑ open up ↑
1802 1802          if (mdb_vread(&lbi, sizeof (lbolt_info_t), ptr) !=
1803 1803              sizeof (lbolt_info_t))
1804 1804                  return (0);
1805 1805  
1806 1806          if (mdb_readvar(&nsec, "nsec_per_tick") == -1 || nsec == 0) {
1807 1807                  mdb_warn("failed to read 'nsec_per_tick'");
1808 1808                  return (-1);
1809 1809          }
1810 1810  
1811 1811          return ((ts/nsec) - lbi.lbi_debug_time);
     1812 +}
     1813 +
     1814 +void
     1815 +mdb_print_buildversion(void)
     1816 +{
     1817 +        GElf_Sym sym;
     1818 +
     1819 +        if (mdb_lookup_by_name("buildversion", &sym) != 0)
     1820 +                return;
     1821 +
     1822 +        char *str = mdb_zalloc(4096, UM_SLEEP | UM_GC);
     1823 +
     1824 +        if (mdb_readstr(str, 4096, sym.st_value) < 1)
     1825 +                return;
     1826 +
     1827 +        mdb_printf("build version: %s\n", str);
1812 1828  }
    
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX