1*7c478bd9Sstevel@tonic-gate /* 2*7c478bd9Sstevel@tonic-gate * CDDL HEADER START 3*7c478bd9Sstevel@tonic-gate * 4*7c478bd9Sstevel@tonic-gate * The contents of this file are subject to the terms of the 5*7c478bd9Sstevel@tonic-gate * Common Development and Distribution License, Version 1.0 only 6*7c478bd9Sstevel@tonic-gate * (the "License"). You may not use this file except in compliance 7*7c478bd9Sstevel@tonic-gate * with the License. 8*7c478bd9Sstevel@tonic-gate * 9*7c478bd9Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 10*7c478bd9Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 11*7c478bd9Sstevel@tonic-gate * See the License for the specific language governing permissions 12*7c478bd9Sstevel@tonic-gate * and limitations under the License. 13*7c478bd9Sstevel@tonic-gate * 14*7c478bd9Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 15*7c478bd9Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 16*7c478bd9Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 17*7c478bd9Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 18*7c478bd9Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 19*7c478bd9Sstevel@tonic-gate * 20*7c478bd9Sstevel@tonic-gate * CDDL HEADER END 21*7c478bd9Sstevel@tonic-gate */ 22*7c478bd9Sstevel@tonic-gate /* 23*7c478bd9Sstevel@tonic-gate * Copyright 2004 Sun Microsystems, Inc. All rights reserved. 24*7c478bd9Sstevel@tonic-gate * Use is subject to license terms. 25*7c478bd9Sstevel@tonic-gate */ 26*7c478bd9Sstevel@tonic-gate 27*7c478bd9Sstevel@tonic-gate #pragma ident "%Z%%M% %I% %E% SMI" 28*7c478bd9Sstevel@tonic-gate 29*7c478bd9Sstevel@tonic-gate /* Copyright (c) 1988 AT&T */ 30*7c478bd9Sstevel@tonic-gate /* All Rights Reserved */ 31*7c478bd9Sstevel@tonic-gate 32*7c478bd9Sstevel@tonic-gate 33*7c478bd9Sstevel@tonic-gate #include "lint.h" 34*7c478bd9Sstevel@tonic-gate #include "thr_uberdata.h" 35*7c478bd9Sstevel@tonic-gate #include "libc_int.h" 36*7c478bd9Sstevel@tonic-gate #include "atexit.h" 37*7c478bd9Sstevel@tonic-gate #include "stdiom.h" 38*7c478bd9Sstevel@tonic-gate 39*7c478bd9Sstevel@tonic-gate /* 40*7c478bd9Sstevel@tonic-gate * Note that memory is managed by lmalloc()/lfree(). 41*7c478bd9Sstevel@tonic-gate * 42*7c478bd9Sstevel@tonic-gate * Among other reasons, this is occasioned by the insistence of our 43*7c478bd9Sstevel@tonic-gate * brothers sh(1) and csh(1) that they can do malloc, etc., better than 44*7c478bd9Sstevel@tonic-gate * libc can. Those programs define their own malloc routines, and 45*7c478bd9Sstevel@tonic-gate * initialize the underlying mechanism in main(). This means that calls 46*7c478bd9Sstevel@tonic-gate * to malloc occuring before main will crash. The loader calls atexit(3C) 47*7c478bd9Sstevel@tonic-gate * before calling main, so we'd better avoid malloc() when it does. 48*7c478bd9Sstevel@tonic-gate * 49*7c478bd9Sstevel@tonic-gate * Another reason for using lmalloc()/lfree() is that the atexit() 50*7c478bd9Sstevel@tonic-gate * list must transcend all link maps. See the Linker and Libraries 51*7c478bd9Sstevel@tonic-gate * Guide for information on alternate link maps. 52*7c478bd9Sstevel@tonic-gate * 53*7c478bd9Sstevel@tonic-gate * See "thr_uberdata.h" for the definitions of structures used here. 54*7c478bd9Sstevel@tonic-gate */ 55*7c478bd9Sstevel@tonic-gate 56*7c478bd9Sstevel@tonic-gate static int in_range(_exithdlr_func_t, Lc_addr_range_t[], uint_t count); 57*7c478bd9Sstevel@tonic-gate 58*7c478bd9Sstevel@tonic-gate extern caddr_t _getfp(void); 59*7c478bd9Sstevel@tonic-gate 60*7c478bd9Sstevel@tonic-gate /* 61*7c478bd9Sstevel@tonic-gate * exitfns_lock is declared to be a recursive mutex so that we 62*7c478bd9Sstevel@tonic-gate * can hold it while calling out to the registered functions. 63*7c478bd9Sstevel@tonic-gate * If they call back to us, we are self-consistent and everything 64*7c478bd9Sstevel@tonic-gate * works, even the case of calling exit() from functions called 65*7c478bd9Sstevel@tonic-gate * by _exithandle() (recursive exit()). All that is required is 66*7c478bd9Sstevel@tonic-gate * that the registered functions actually return (no longjmp()s). 67*7c478bd9Sstevel@tonic-gate * 68*7c478bd9Sstevel@tonic-gate * Because exitfns_lock is declared to be a recursive mutex, we 69*7c478bd9Sstevel@tonic-gate * cannot use it with lmutex_lock()/lmutex_unlock() and we must use 70*7c478bd9Sstevel@tonic-gate * rmutex_lock()/rmutex_unlock() (which are defined to be simply 71*7c478bd9Sstevel@tonic-gate * mutex_lock()/mutex_unlock()). This means that atexit() and 72*7c478bd9Sstevel@tonic-gate * exit() are not async-signal-safe. We make them fork1-safe 73*7c478bd9Sstevel@tonic-gate * via the atexit_locks()/atexit_unlocks() functions, called from 74*7c478bd9Sstevel@tonic-gate * libc_prepare_atfork()/libc_child_atfork()/libc_parent_atfork() 75*7c478bd9Sstevel@tonic-gate */ 76*7c478bd9Sstevel@tonic-gate 77*7c478bd9Sstevel@tonic-gate /* 78*7c478bd9Sstevel@tonic-gate * atexit_locks() and atexit_unlocks() are called on every link map. 79*7c478bd9Sstevel@tonic-gate * Do not use curthread->ul_uberdata->atexit_root for these. 80*7c478bd9Sstevel@tonic-gate */ 81*7c478bd9Sstevel@tonic-gate void 82*7c478bd9Sstevel@tonic-gate atexit_locks() 83*7c478bd9Sstevel@tonic-gate { 84*7c478bd9Sstevel@tonic-gate (void) rmutex_lock(&__uberdata.atexit_root.exitfns_lock); 85*7c478bd9Sstevel@tonic-gate } 86*7c478bd9Sstevel@tonic-gate 87*7c478bd9Sstevel@tonic-gate void 88*7c478bd9Sstevel@tonic-gate atexit_unlocks() 89*7c478bd9Sstevel@tonic-gate { 90*7c478bd9Sstevel@tonic-gate (void) rmutex_unlock(&__uberdata.atexit_root.exitfns_lock); 91*7c478bd9Sstevel@tonic-gate } 92*7c478bd9Sstevel@tonic-gate 93*7c478bd9Sstevel@tonic-gate /* 94*7c478bd9Sstevel@tonic-gate * atexit() is called before the primordial thread is fully set up. 95*7c478bd9Sstevel@tonic-gate * Be careful about dereferencing self->ul_uberdata->atexit_root. 96*7c478bd9Sstevel@tonic-gate */ 97*7c478bd9Sstevel@tonic-gate #pragma weak atexit = _atexit 98*7c478bd9Sstevel@tonic-gate int 99*7c478bd9Sstevel@tonic-gate _atexit(void (*func)(void)) 100*7c478bd9Sstevel@tonic-gate { 101*7c478bd9Sstevel@tonic-gate ulwp_t *self; 102*7c478bd9Sstevel@tonic-gate atexit_root_t *arp; 103*7c478bd9Sstevel@tonic-gate _exthdlr_t *p; 104*7c478bd9Sstevel@tonic-gate 105*7c478bd9Sstevel@tonic-gate if ((p = lmalloc(sizeof (_exthdlr_t))) == NULL) 106*7c478bd9Sstevel@tonic-gate return (-1); 107*7c478bd9Sstevel@tonic-gate 108*7c478bd9Sstevel@tonic-gate if ((self = __curthread()) == NULL) 109*7c478bd9Sstevel@tonic-gate arp = &__uberdata.atexit_root; 110*7c478bd9Sstevel@tonic-gate else { 111*7c478bd9Sstevel@tonic-gate arp = &self->ul_uberdata->atexit_root; 112*7c478bd9Sstevel@tonic-gate (void) rmutex_lock(&arp->exitfns_lock); 113*7c478bd9Sstevel@tonic-gate } 114*7c478bd9Sstevel@tonic-gate p->hdlr = func; 115*7c478bd9Sstevel@tonic-gate p->next = arp->head; 116*7c478bd9Sstevel@tonic-gate arp->head = p; 117*7c478bd9Sstevel@tonic-gate if (self != NULL) 118*7c478bd9Sstevel@tonic-gate (void) rmutex_unlock(&arp->exitfns_lock); 119*7c478bd9Sstevel@tonic-gate return (0); 120*7c478bd9Sstevel@tonic-gate } 121*7c478bd9Sstevel@tonic-gate 122*7c478bd9Sstevel@tonic-gate void 123*7c478bd9Sstevel@tonic-gate _exithandle(void) 124*7c478bd9Sstevel@tonic-gate { 125*7c478bd9Sstevel@tonic-gate atexit_root_t *arp = &curthread->ul_uberdata->atexit_root; 126*7c478bd9Sstevel@tonic-gate _exthdlr_t *p; 127*7c478bd9Sstevel@tonic-gate 128*7c478bd9Sstevel@tonic-gate (void) rmutex_lock(&arp->exitfns_lock); 129*7c478bd9Sstevel@tonic-gate arp->exit_frame_monitor = _getfp() + STACK_BIAS; 130*7c478bd9Sstevel@tonic-gate p = arp->head; 131*7c478bd9Sstevel@tonic-gate while (p != NULL) { 132*7c478bd9Sstevel@tonic-gate arp->head = p->next; 133*7c478bd9Sstevel@tonic-gate p->hdlr(); 134*7c478bd9Sstevel@tonic-gate lfree(p, sizeof (_exthdlr_t)); 135*7c478bd9Sstevel@tonic-gate p = arp->head; 136*7c478bd9Sstevel@tonic-gate } 137*7c478bd9Sstevel@tonic-gate (void) rmutex_unlock(&arp->exitfns_lock); 138*7c478bd9Sstevel@tonic-gate } 139*7c478bd9Sstevel@tonic-gate 140*7c478bd9Sstevel@tonic-gate /* 141*7c478bd9Sstevel@tonic-gate * _get_exit_frame_monitor is called by the C++ runtimes. 142*7c478bd9Sstevel@tonic-gate */ 143*7c478bd9Sstevel@tonic-gate void * 144*7c478bd9Sstevel@tonic-gate _get_exit_frame_monitor(void) 145*7c478bd9Sstevel@tonic-gate { 146*7c478bd9Sstevel@tonic-gate atexit_root_t *arp = &curthread->ul_uberdata->atexit_root; 147*7c478bd9Sstevel@tonic-gate return (&arp->exit_frame_monitor); 148*7c478bd9Sstevel@tonic-gate } 149*7c478bd9Sstevel@tonic-gate 150*7c478bd9Sstevel@tonic-gate /* 151*7c478bd9Sstevel@tonic-gate * The following is a routine which the loader (ld.so.1) calls when it 152*7c478bd9Sstevel@tonic-gate * processes a dlclose call on an object. It resets all signal handlers 153*7c478bd9Sstevel@tonic-gate * which fall within the union of the ranges specified by the elements 154*7c478bd9Sstevel@tonic-gate * of the array range to SIG_DFL. 155*7c478bd9Sstevel@tonic-gate */ 156*7c478bd9Sstevel@tonic-gate static void 157*7c478bd9Sstevel@tonic-gate _preexec_sig_unload(Lc_addr_range_t range[], uint_t count) 158*7c478bd9Sstevel@tonic-gate { 159*7c478bd9Sstevel@tonic-gate uberdata_t *udp = curthread->ul_uberdata; 160*7c478bd9Sstevel@tonic-gate int sig; 161*7c478bd9Sstevel@tonic-gate mutex_t *mp; 162*7c478bd9Sstevel@tonic-gate struct sigaction *sap; 163*7c478bd9Sstevel@tonic-gate struct sigaction oact; 164*7c478bd9Sstevel@tonic-gate void (*handler)(); 165*7c478bd9Sstevel@tonic-gate 166*7c478bd9Sstevel@tonic-gate for (sig = 1; sig < NSIG; sig++) { 167*7c478bd9Sstevel@tonic-gate sap = (struct sigaction *)&udp->siguaction[sig].sig_uaction; 168*7c478bd9Sstevel@tonic-gate again: 169*7c478bd9Sstevel@tonic-gate handler = sap->sa_handler; 170*7c478bd9Sstevel@tonic-gate if (handler != SIG_DFL && handler != SIG_IGN && 171*7c478bd9Sstevel@tonic-gate in_range(handler, range, count)) { 172*7c478bd9Sstevel@tonic-gate mp = &udp->siguaction[sig].sig_lock; 173*7c478bd9Sstevel@tonic-gate lmutex_lock(mp); 174*7c478bd9Sstevel@tonic-gate if (handler != sap->sa_handler) { 175*7c478bd9Sstevel@tonic-gate lmutex_unlock(mp); 176*7c478bd9Sstevel@tonic-gate goto again; 177*7c478bd9Sstevel@tonic-gate } 178*7c478bd9Sstevel@tonic-gate sap->sa_handler = SIG_DFL; 179*7c478bd9Sstevel@tonic-gate sap->sa_flags = SA_SIGINFO; 180*7c478bd9Sstevel@tonic-gate (void) sigemptyset(&sap->sa_mask); 181*7c478bd9Sstevel@tonic-gate if (__sigaction(sig, NULL, &oact) == 0 && 182*7c478bd9Sstevel@tonic-gate oact.sa_handler != SIG_DFL && 183*7c478bd9Sstevel@tonic-gate oact.sa_handler != SIG_IGN) 184*7c478bd9Sstevel@tonic-gate (void) __sigaction(sig, sap, NULL); 185*7c478bd9Sstevel@tonic-gate lmutex_unlock(mp); 186*7c478bd9Sstevel@tonic-gate } 187*7c478bd9Sstevel@tonic-gate } 188*7c478bd9Sstevel@tonic-gate } 189*7c478bd9Sstevel@tonic-gate 190*7c478bd9Sstevel@tonic-gate /* 191*7c478bd9Sstevel@tonic-gate * The following is a routine which the loader (ld.so.1) calls when it 192*7c478bd9Sstevel@tonic-gate * processes a dlclose call on an object. It cancels all atfork() entries 193*7c478bd9Sstevel@tonic-gate * whose prefork, parent postfork, or child postfork functions fall within 194*7c478bd9Sstevel@tonic-gate * the union of the ranges specified by the elements of the array range. 195*7c478bd9Sstevel@tonic-gate */ 196*7c478bd9Sstevel@tonic-gate static void 197*7c478bd9Sstevel@tonic-gate _preexec_atfork_unload(Lc_addr_range_t range[], uint_t count) 198*7c478bd9Sstevel@tonic-gate { 199*7c478bd9Sstevel@tonic-gate uberdata_t *udp = curthread->ul_uberdata; 200*7c478bd9Sstevel@tonic-gate atfork_t *atfork_q; 201*7c478bd9Sstevel@tonic-gate atfork_t *atfp; 202*7c478bd9Sstevel@tonic-gate atfork_t *next; 203*7c478bd9Sstevel@tonic-gate void (*func)(void); 204*7c478bd9Sstevel@tonic-gate int start_again; 205*7c478bd9Sstevel@tonic-gate int error; 206*7c478bd9Sstevel@tonic-gate 207*7c478bd9Sstevel@tonic-gate error = fork_lock_enter(NULL); 208*7c478bd9Sstevel@tonic-gate if ((atfork_q = udp->atforklist) != NULL) { 209*7c478bd9Sstevel@tonic-gate atfp = atfork_q; 210*7c478bd9Sstevel@tonic-gate do { 211*7c478bd9Sstevel@tonic-gate next = atfp->forw; 212*7c478bd9Sstevel@tonic-gate start_again = 0; 213*7c478bd9Sstevel@tonic-gate 214*7c478bd9Sstevel@tonic-gate if (((func = atfp->prepare) != NULL && 215*7c478bd9Sstevel@tonic-gate in_range(func, range, count)) || 216*7c478bd9Sstevel@tonic-gate ((func = atfp->parent) != NULL && 217*7c478bd9Sstevel@tonic-gate in_range(func, range, count)) || 218*7c478bd9Sstevel@tonic-gate ((func = atfp->child) != NULL && 219*7c478bd9Sstevel@tonic-gate in_range(func, range, count))) { 220*7c478bd9Sstevel@tonic-gate if (error) { 221*7c478bd9Sstevel@tonic-gate /* 222*7c478bd9Sstevel@tonic-gate * dlclose() called from a fork handler. 223*7c478bd9Sstevel@tonic-gate * Deleting the entry would wreak havoc. 224*7c478bd9Sstevel@tonic-gate * Just null out the function pointers 225*7c478bd9Sstevel@tonic-gate * and leave the entry in place. 226*7c478bd9Sstevel@tonic-gate */ 227*7c478bd9Sstevel@tonic-gate atfp->prepare = NULL; 228*7c478bd9Sstevel@tonic-gate atfp->parent = NULL; 229*7c478bd9Sstevel@tonic-gate atfp->child = NULL; 230*7c478bd9Sstevel@tonic-gate continue; 231*7c478bd9Sstevel@tonic-gate } 232*7c478bd9Sstevel@tonic-gate if (atfp == atfork_q) { 233*7c478bd9Sstevel@tonic-gate /* deleting the list head member */ 234*7c478bd9Sstevel@tonic-gate udp->atforklist = atfork_q = next; 235*7c478bd9Sstevel@tonic-gate start_again = 1; 236*7c478bd9Sstevel@tonic-gate } 237*7c478bd9Sstevel@tonic-gate atfp->forw->back = atfp->back; 238*7c478bd9Sstevel@tonic-gate atfp->back->forw = atfp->forw; 239*7c478bd9Sstevel@tonic-gate lfree(atfp, sizeof (atfork_t)); 240*7c478bd9Sstevel@tonic-gate if (atfp == atfork_q) { 241*7c478bd9Sstevel@tonic-gate /* we deleted the whole list */ 242*7c478bd9Sstevel@tonic-gate udp->atforklist = NULL; 243*7c478bd9Sstevel@tonic-gate break; 244*7c478bd9Sstevel@tonic-gate } 245*7c478bd9Sstevel@tonic-gate } 246*7c478bd9Sstevel@tonic-gate } while ((atfp = next) != atfork_q || start_again); 247*7c478bd9Sstevel@tonic-gate } 248*7c478bd9Sstevel@tonic-gate fork_lock_exit(); 249*7c478bd9Sstevel@tonic-gate } 250*7c478bd9Sstevel@tonic-gate 251*7c478bd9Sstevel@tonic-gate /* 252*7c478bd9Sstevel@tonic-gate * The following is a routine which the loader (ld.so.1) calls when it 253*7c478bd9Sstevel@tonic-gate * processes a dlclose call on an object. It sets the destructor 254*7c478bd9Sstevel@tonic-gate * function pointer to NULL for all keys whose destructors fall within 255*7c478bd9Sstevel@tonic-gate * the union of the ranges specified by the elements of the array range. 256*7c478bd9Sstevel@tonic-gate * We don't assign TSD_UNALLOCATED (the equivalent of pthread_key_destroy()) 257*7c478bd9Sstevel@tonic-gate * because the thread may use the key's TSD further on in fini processing. 258*7c478bd9Sstevel@tonic-gate */ 259*7c478bd9Sstevel@tonic-gate static void 260*7c478bd9Sstevel@tonic-gate _preexec_tsd_unload(Lc_addr_range_t range[], uint_t count) 261*7c478bd9Sstevel@tonic-gate { 262*7c478bd9Sstevel@tonic-gate tsd_metadata_t *tsdm = &curthread->ul_uberdata->tsd_metadata; 263*7c478bd9Sstevel@tonic-gate void (*func)(void *); 264*7c478bd9Sstevel@tonic-gate int key; 265*7c478bd9Sstevel@tonic-gate 266*7c478bd9Sstevel@tonic-gate lmutex_lock(&tsdm->tsdm_lock); 267*7c478bd9Sstevel@tonic-gate for (key = 1; key < tsdm->tsdm_nused; key++) { 268*7c478bd9Sstevel@tonic-gate if ((func = tsdm->tsdm_destro[key]) != NULL && 269*7c478bd9Sstevel@tonic-gate func != TSD_UNALLOCATED && 270*7c478bd9Sstevel@tonic-gate in_range((_exithdlr_func_t)func, range, count)) 271*7c478bd9Sstevel@tonic-gate tsdm->tsdm_destro[key] = NULL; 272*7c478bd9Sstevel@tonic-gate } 273*7c478bd9Sstevel@tonic-gate lmutex_unlock(&tsdm->tsdm_lock); 274*7c478bd9Sstevel@tonic-gate } 275*7c478bd9Sstevel@tonic-gate 276*7c478bd9Sstevel@tonic-gate /* 277*7c478bd9Sstevel@tonic-gate * The following is a routine which the loader (ld.so.1) calls when it 278*7c478bd9Sstevel@tonic-gate * processes dlclose calls on objects with atexit registrations. It 279*7c478bd9Sstevel@tonic-gate * executes the exit handlers that fall within the union of the ranges 280*7c478bd9Sstevel@tonic-gate * specified by the elements of the array range in the REVERSE ORDER of 281*7c478bd9Sstevel@tonic-gate * their registration. Do not change this characteristic; it is REQUIRED 282*7c478bd9Sstevel@tonic-gate * BEHAVIOR. 283*7c478bd9Sstevel@tonic-gate */ 284*7c478bd9Sstevel@tonic-gate int 285*7c478bd9Sstevel@tonic-gate _preexec_exit_handlers(Lc_addr_range_t range[], uint_t count) 286*7c478bd9Sstevel@tonic-gate { 287*7c478bd9Sstevel@tonic-gate atexit_root_t *arp = &curthread->ul_uberdata->atexit_root; 288*7c478bd9Sstevel@tonic-gate _exthdlr_t *o; /* previous node */ 289*7c478bd9Sstevel@tonic-gate _exthdlr_t *p; /* this node */ 290*7c478bd9Sstevel@tonic-gate 291*7c478bd9Sstevel@tonic-gate (void) rmutex_lock(&arp->exitfns_lock); 292*7c478bd9Sstevel@tonic-gate o = NULL; 293*7c478bd9Sstevel@tonic-gate p = arp->head; 294*7c478bd9Sstevel@tonic-gate while (p != NULL) { 295*7c478bd9Sstevel@tonic-gate if (in_range(p->hdlr, range, count)) { 296*7c478bd9Sstevel@tonic-gate /* We need to execute this one */ 297*7c478bd9Sstevel@tonic-gate if (o != NULL) 298*7c478bd9Sstevel@tonic-gate o->next = p->next; 299*7c478bd9Sstevel@tonic-gate else 300*7c478bd9Sstevel@tonic-gate arp->head = p->next; 301*7c478bd9Sstevel@tonic-gate p->hdlr(); 302*7c478bd9Sstevel@tonic-gate lfree(p, sizeof (_exthdlr_t)); 303*7c478bd9Sstevel@tonic-gate o = NULL; 304*7c478bd9Sstevel@tonic-gate p = arp->head; 305*7c478bd9Sstevel@tonic-gate } else { 306*7c478bd9Sstevel@tonic-gate o = p; 307*7c478bd9Sstevel@tonic-gate p = p->next; 308*7c478bd9Sstevel@tonic-gate } 309*7c478bd9Sstevel@tonic-gate } 310*7c478bd9Sstevel@tonic-gate (void) rmutex_unlock(&arp->exitfns_lock); 311*7c478bd9Sstevel@tonic-gate 312*7c478bd9Sstevel@tonic-gate _preexec_tsd_unload(range, count); 313*7c478bd9Sstevel@tonic-gate _preexec_atfork_unload(range, count); 314*7c478bd9Sstevel@tonic-gate _preexec_sig_unload(range, count); 315*7c478bd9Sstevel@tonic-gate 316*7c478bd9Sstevel@tonic-gate return (0); 317*7c478bd9Sstevel@tonic-gate } 318*7c478bd9Sstevel@tonic-gate 319*7c478bd9Sstevel@tonic-gate static int 320*7c478bd9Sstevel@tonic-gate in_range(_exithdlr_func_t addr, Lc_addr_range_t ranges[], uint_t count) 321*7c478bd9Sstevel@tonic-gate { 322*7c478bd9Sstevel@tonic-gate uint_t idx; 323*7c478bd9Sstevel@tonic-gate 324*7c478bd9Sstevel@tonic-gate for (idx = 0; idx < count; idx++) { 325*7c478bd9Sstevel@tonic-gate if ((void *)addr >= ranges[idx].lb && 326*7c478bd9Sstevel@tonic-gate (void *)addr < ranges[idx].ub) { 327*7c478bd9Sstevel@tonic-gate return (1); 328*7c478bd9Sstevel@tonic-gate } 329*7c478bd9Sstevel@tonic-gate } 330*7c478bd9Sstevel@tonic-gate 331*7c478bd9Sstevel@tonic-gate return (0); 332*7c478bd9Sstevel@tonic-gate } 333