Print this page
3900 illumos will not build against gcc compiled perl

Split Close
Expand all
Collapse all
          --- old/usr/src/cmd/perl/contrib/Sun/Solaris/Kstat/Kstat.xs
          +++ new/usr/src/cmd/perl/contrib/Sun/Solaris/Kstat/Kstat.xs
↓ open down ↓ 13 lines elided ↑ open up ↑
  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  /*
  23   23   * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
       24 + * Copyright (c) 2014 Racktop Systems.
  24   25   */
  25   26  
  26   27  /*
  27   28   * Kstat.xs is a Perl XS (eXStension module) that makes the Solaris
  28   29   * kstat(3KSTAT) facility available to Perl scripts.  Kstat is a general-purpose
  29   30   * mechanism  for  providing kernel statistics to users.  The Solaris API is
  30   31   * function-based (see the manpage for details), but for ease of use in Perl
  31   32   * scripts this module presents the information as a nested hash data structure.
  32   33   * It would be too inefficient to read every kstat in the system, so this module
  33   34   * uses the Perl TIEHASH mechanism to implement a read-on-demand semantic, which
↓ open down ↓ 853 lines elided ↑ open up ↑
 887  888   * This is an iterator function used to traverse the hash hierarchy and apply
 888  889   * the passed function to the tied hashes at the bottom of the hierarchy.  If
 889  890   * any of the callback functions return 0, 0 is returned, otherwise 1
 890  891   */
 891  892  
 892  893  static int
 893  894  apply_to_ties(SV *self, ATTCb_t cb, void *arg)
 894  895  {
 895  896          HV      *hash1;
 896  897          HE      *entry1;
 897      -        long    s;
 898  898          int     ret;
 899  899  
 900  900          hash1 = (HV *)SvRV(self);
 901  901          hv_iterinit(hash1);
 902  902          ret = 1;
 903  903  
 904  904          /* Iterate over each module */
 905      -        while (entry1 = hv_iternext(hash1)) {
      905 +        while ((entry1 = hv_iternext(hash1))) {
 906  906                  HV *hash2;
 907  907                  HE *entry2;
 908  908  
 909  909                  hash2 = (HV *)SvRV(hv_iterval(hash1, entry1));
 910  910                  hv_iterinit(hash2);
 911  911  
 912  912                  /* Iterate over each module:instance */
 913      -                while (entry2 = hv_iternext(hash2)) {
      913 +                while ((entry2 = hv_iternext(hash2))) {
 914  914                          HV *hash3;
 915  915                          HE *entry3;
 916  916  
 917  917                          hash3 = (HV *)SvRV(hv_iterval(hash2, entry2));
 918  918                          hv_iterinit(hash3);
 919  919  
 920  920                          /* Iterate over each module:instance:name */
 921      -                        while (entry3 = hv_iternext(hash3)) {
      921 +                        while ((entry3 = hv_iternext(hash3))) {
 922  922                                  HV    *hash4;
 923  923                                  MAGIC *mg;
 924      -                                HV    *tie;
 925  924  
 926  925                                  /* Get the tie */
 927  926                                  hash4 = (HV *)SvRV(hv_iterval(hash3, entry3));
 928  927                                  mg = mg_find((SV *)hash4, 'P');
 929  928                                  PERL_ASSERTMSG(mg != 0,
 930  929                                      "apply_to_ties: lost P magic");
 931  930  
 932  931                                  /* Apply the callback */
 933  932                                  if (! cb((HV *)SvRV(mg->mg_obj), arg)) {
 934  933                                          ret = 0;
↓ open down ↓ 34 lines elided ↑ open up ↑
 969  968          HE      *entry1;
 970  969          STRLEN  klen;
 971  970          char    *module, *instance, *name, *key;
 972  971          int     ret;
 973  972  
 974  973          hash1 = (HV *)SvRV(self);
 975  974          hv_iterinit(hash1);
 976  975          ret = 0;
 977  976  
 978  977          /* Iterate over each module */
 979      -        while (entry1 = hv_iternext(hash1)) {
      978 +        while ((entry1 = hv_iternext(hash1))) {
 980  979                  HV *hash2;
 981  980                  HE *entry2;
 982  981  
 983  982                  module = HePV(entry1, PL_na);
 984  983                  hash2 = (HV *)SvRV(hv_iterval(hash1, entry1));
 985  984                  hv_iterinit(hash2);
 986  985  
 987  986                  /* Iterate over each module:instance */
 988      -                while (entry2 = hv_iternext(hash2)) {
      987 +                while ((entry2 = hv_iternext(hash2))) {
 989  988                          HV *hash3;
 990  989                          HE *entry3;
 991  990  
 992  991                          instance = HePV(entry2, PL_na);
 993  992                          hash3 = (HV *)SvRV(hv_iterval(hash2, entry2));
 994  993                          hv_iterinit(hash3);
 995  994  
 996  995                          /* Iterate over each module:instance:name */
 997      -                        while (entry3 = hv_iternext(hash3)) {
      996 +                        while ((entry3 = hv_iternext(hash3))) {
 998  997                                  HV    *hash4;
 999  998                                  MAGIC *mg;
1000  999                                  HV    *tie;
1001 1000  
1002 1001                                  name = HePV(entry3, PL_na);
1003 1002                                  hash4 = (HV *)SvRV(hv_iterval(hash3, entry3));
1004 1003                                  mg = mg_find((SV *)hash4, 'P');
1005 1004                                  PERL_ASSERTMSG(mg != 0,
1006 1005                                      "prune_invalid: lost P magic");
1007 1006                                  tie = (HV *)SvRV(mg->mg_obj);
↓ open down ↓ 69 lines elided ↑ open up ↑
1077 1076                          break;
1078 1077                  case KSTAT_DATA_STRING:
1079 1078                          if (KSTAT_NAMED_STR_PTR(knp) == NULL)
1080 1079                                  value = newSVpv("null", sizeof ("null") - 1);
1081 1080                          else
1082 1081                                  value = newSVpv(KSTAT_NAMED_STR_PTR(knp),
1083 1082                                                  KSTAT_NAMED_STR_BUFLEN(knp) -1);
1084 1083                          break;
1085 1084                  default:
1086 1085                          PERL_ASSERTMSG(0, "kstat_read: invalid data type");
1087      -                        break;
     1086 +                        continue;
1088 1087                  }
1089 1088                  hv_store(self, knp->name, strlen(knp->name), value, 0);
1090 1089          }
1091 1090  }
1092 1091  
1093 1092  /*
1094 1093   * Save kstat interrupt statistics
1095 1094   */
1096 1095  
1097 1096  static void
↓ open down ↓ 520 lines elided ↑ open up ↑
1618 1617  
1619 1618  SV*
1620 1619  FIRSTKEY(self)
1621 1620          SV* self;
1622 1621  PREINIT:
1623 1622          HE *he;
1624 1623  PPCODE:
1625 1624          self = SvRV(self);
1626 1625          read_kstats((HV *)self, FALSE);
1627 1626          hv_iterinit((HV *)self);
1628      -        if (he = hv_iternext((HV *)self)) {
     1627 +        if ((he = hv_iternext((HV *)self))) {
1629 1628                  EXTEND(SP, 1);
1630 1629                  PUSHs(hv_iterkeysv(he));
1631 1630          }
1632 1631  
1633 1632   #
1634 1633   # Return hash iterator next value.  Read the kstats if necessary.
1635 1634   #
1636 1635  
1637 1636  SV*
1638 1637  NEXTKEY(self, lastkey)
1639 1638          SV* self;
1640 1639          SV* lastkey;
1641 1640  PREINIT:
1642 1641          HE *he;
1643 1642  PPCODE:
1644 1643          self = SvRV(self);
1645      -        if (he = hv_iternext((HV *)self)) {
     1644 +        if ((he = hv_iternext((HV *)self))) {
1646 1645                  EXTEND(SP, 1);
1647 1646                  PUSHs(hv_iterkeysv(he));
1648 1647          }
1649 1648  
1650 1649  
1651 1650   #
1652 1651   # Delete the specified hash entry.
1653 1652   #
1654 1653  
1655 1654  SV*
↓ open down ↓ 35 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX