components/top/patches/02.hash-c.patch
author John Beck <John.Beck@Oracle.COM>
Tue, 11 Nov 2014 07:47:24 -0800
changeset 2201 861310b6f3b2
parent 127 3e3c266b3a81
permissions -rw-r--r--
20009471 mailman binaries are 32-bit despite $(BUILD_64) in its Makefile

#
# This patch was included to address
#    6893978 top segfaults with high thread ids
#
*** top-3.8beta1/hash.c-old  Thu Jul  2 15:30:55 2009
--- top-3.8beta1/hash.c      Thu Jul  2 15:48:39 2009
***************
*** 1354,1360 ****
      hi->value = value;

      /* hash to the bucket */
!     bucket = &(ht->buckets[((key.k_thr * 10000 + key.k_pid) % ht->num_buckets)]);

      /* walk the list to make sure we do not have a duplicate */
      ll = &(bucket->list);
--- 1354,1360 ----
      hi->value = value;

      /* hash to the bucket */
!     bucket = &(ht->buckets[(((unsigned long)(key.k_thr) * 10000U + (unsigned long)(key.k_pid)) % ht->num_buckets)]);

      /* walk the list to make sure we do not have a duplicate */
      ll = &(bucket->list);
***************
*** 1408,1414 ****
      pidthr_t k1;

      /* find the bucket */
!     bucket = &(ht->buckets[((key.k_thr * 10000 + key.k_pid) % ht->num_buckets)]);

      /* walk the list until we find the existing item */
      ll = &(bucket->list);
--- 1408,1414 ----
      pidthr_t k1;

      /* find the bucket */
!     bucket = &(ht->buckets[(((unsigned long)(key.k_thr) * 10000U + (unsigned long)(key.k_pid)) % ht->num_buckets)]);

      /* walk the list until we find the existing item */
      ll = &(bucket->list);
***************
*** 1460,1466 ****
      pidthr_t k1;

      result = NULL;
!     if ((bucket = &(ht->buckets[((key.k_thr * 10000 + key.k_pid) % ht->num_buckets)])) != NULL)
      {
        ll = &(bucket->list);
        li = LL_FIRST(ll);
--- 1460,1466 ----
      pidthr_t k1;

      result = NULL;
!     if ((bucket = &(ht->buckets[(((unsigned long)(key.k_thr) * 10000U + (unsigned long)(key.k_pid)) % ht->num_buckets)])) != NULL)
      {
        ll = &(bucket->list);
        li = LL_FIRST(ll);
***************
*** 1499,1505 ****
      pidthr_t k1;

      result = NULL;
!     if ((bucket = &(ht->buckets[((key.k_thr * 10000 + key.k_pid) % ht->num_buckets)])) != NULL)
      {
        ll = &(bucket->list);
        li = LL_FIRST(ll);
--- 1499,1505 ----
      pidthr_t k1;

      result = NULL;
!     if ((bucket = &(ht->buckets[(((unsigned long)(key.k_thr) * 10000U + (unsigned long)(key.k_pid)) % ht->num_buckets)])) != NULL)
      {
        ll = &(bucket->list);
        li = LL_FIRST(ll);