Print this page
5255 uts shouldn't open-code ISP2


2139         /*
2140          * Install our hooks into fork(2), exec(2), and exit(2).
2141          */
2142         dtrace_fasttrap_fork_ptr = &fasttrap_fork;
2143         dtrace_fasttrap_exit_ptr = &fasttrap_exec_exit;
2144         dtrace_fasttrap_exec_ptr = &fasttrap_exec_exit;
2145 
2146         fasttrap_max = ddi_getprop(DDI_DEV_T_ANY, devi, DDI_PROP_DONTPASS,
2147             "fasttrap-max-probes", FASTTRAP_MAX_DEFAULT);
2148         fasttrap_total = 0;
2149 
2150         /*
2151          * Conjure up the tracepoints hashtable...
2152          */
2153         nent = ddi_getprop(DDI_DEV_T_ANY, devi, DDI_PROP_DONTPASS,
2154             "fasttrap-hash-size", FASTTRAP_TPOINTS_DEFAULT_SIZE);
2155 
2156         if (nent == 0 || nent > 0x1000000)
2157                 nent = FASTTRAP_TPOINTS_DEFAULT_SIZE;
2158 
2159         if ((nent & (nent - 1)) == 0)
2160                 fasttrap_tpoints.fth_nent = nent;
2161         else
2162                 fasttrap_tpoints.fth_nent = 1 << fasttrap_highbit(nent);
2163         ASSERT(fasttrap_tpoints.fth_nent > 0);
2164         fasttrap_tpoints.fth_mask = fasttrap_tpoints.fth_nent - 1;
2165         fasttrap_tpoints.fth_table = kmem_zalloc(fasttrap_tpoints.fth_nent *
2166             sizeof (fasttrap_bucket_t), KM_SLEEP);
2167 
2168         /*
2169          * ... and the providers hash table...
2170          */
2171         nent = FASTTRAP_PROVIDERS_DEFAULT_SIZE;
2172         if ((nent & (nent - 1)) == 0)
2173                 fasttrap_provs.fth_nent = nent;
2174         else
2175                 fasttrap_provs.fth_nent = 1 << fasttrap_highbit(nent);
2176         ASSERT(fasttrap_provs.fth_nent > 0);
2177         fasttrap_provs.fth_mask = fasttrap_provs.fth_nent - 1;
2178         fasttrap_provs.fth_table = kmem_zalloc(fasttrap_provs.fth_nent *
2179             sizeof (fasttrap_bucket_t), KM_SLEEP);
2180 
2181         /*
2182          * ... and the procs hash table.
2183          */
2184         nent = FASTTRAP_PROCS_DEFAULT_SIZE;
2185         if ((nent & (nent - 1)) == 0)
2186                 fasttrap_procs.fth_nent = nent;
2187         else
2188                 fasttrap_procs.fth_nent = 1 << fasttrap_highbit(nent);
2189         ASSERT(fasttrap_procs.fth_nent > 0);
2190         fasttrap_procs.fth_mask = fasttrap_procs.fth_nent - 1;
2191         fasttrap_procs.fth_table = kmem_zalloc(fasttrap_procs.fth_nent *
2192             sizeof (fasttrap_bucket_t), KM_SLEEP);
2193 
2194         (void) dtrace_meta_register("fasttrap", &fasttrap_mops, NULL,
2195             &fasttrap_meta_id);
2196 
2197         return (DDI_SUCCESS);
2198 }
2199 
2200 static int
2201 fasttrap_detach(dev_info_t *devi, ddi_detach_cmd_t cmd)
2202 {
2203         int i, fail = 0;
2204         timeout_id_t tmp;
2205 




2139         /*
2140          * Install our hooks into fork(2), exec(2), and exit(2).
2141          */
2142         dtrace_fasttrap_fork_ptr = &fasttrap_fork;
2143         dtrace_fasttrap_exit_ptr = &fasttrap_exec_exit;
2144         dtrace_fasttrap_exec_ptr = &fasttrap_exec_exit;
2145 
2146         fasttrap_max = ddi_getprop(DDI_DEV_T_ANY, devi, DDI_PROP_DONTPASS,
2147             "fasttrap-max-probes", FASTTRAP_MAX_DEFAULT);
2148         fasttrap_total = 0;
2149 
2150         /*
2151          * Conjure up the tracepoints hashtable...
2152          */
2153         nent = ddi_getprop(DDI_DEV_T_ANY, devi, DDI_PROP_DONTPASS,
2154             "fasttrap-hash-size", FASTTRAP_TPOINTS_DEFAULT_SIZE);
2155 
2156         if (nent == 0 || nent > 0x1000000)
2157                 nent = FASTTRAP_TPOINTS_DEFAULT_SIZE;
2158 
2159         if (ISP2(nent))
2160                 fasttrap_tpoints.fth_nent = nent;
2161         else
2162                 fasttrap_tpoints.fth_nent = 1 << fasttrap_highbit(nent);
2163         ASSERT(fasttrap_tpoints.fth_nent > 0);
2164         fasttrap_tpoints.fth_mask = fasttrap_tpoints.fth_nent - 1;
2165         fasttrap_tpoints.fth_table = kmem_zalloc(fasttrap_tpoints.fth_nent *
2166             sizeof (fasttrap_bucket_t), KM_SLEEP);
2167 
2168         /*
2169          * ... and the providers hash table...
2170          */
2171         nent = FASTTRAP_PROVIDERS_DEFAULT_SIZE;
2172         if (ISP2(nent))
2173                 fasttrap_provs.fth_nent = nent;
2174         else
2175                 fasttrap_provs.fth_nent = 1 << fasttrap_highbit(nent);
2176         ASSERT(fasttrap_provs.fth_nent > 0);
2177         fasttrap_provs.fth_mask = fasttrap_provs.fth_nent - 1;
2178         fasttrap_provs.fth_table = kmem_zalloc(fasttrap_provs.fth_nent *
2179             sizeof (fasttrap_bucket_t), KM_SLEEP);
2180 
2181         /*
2182          * ... and the procs hash table.
2183          */
2184         nent = FASTTRAP_PROCS_DEFAULT_SIZE;
2185         if (ISP2(nent))
2186                 fasttrap_procs.fth_nent = nent;
2187         else
2188                 fasttrap_procs.fth_nent = 1 << fasttrap_highbit(nent);
2189         ASSERT(fasttrap_procs.fth_nent > 0);
2190         fasttrap_procs.fth_mask = fasttrap_procs.fth_nent - 1;
2191         fasttrap_procs.fth_table = kmem_zalloc(fasttrap_procs.fth_nent *
2192             sizeof (fasttrap_bucket_t), KM_SLEEP);
2193 
2194         (void) dtrace_meta_register("fasttrap", &fasttrap_mops, NULL,
2195             &fasttrap_meta_id);
2196 
2197         return (DDI_SUCCESS);
2198 }
2199 
2200 static int
2201 fasttrap_detach(dev_info_t *devi, ddi_detach_cmd_t cmd)
2202 {
2203         int i, fail = 0;
2204         timeout_id_t tmp;
2205