FreeBSD/libexec/rtld-elf/rtld.c
/*
 * Allocate TLS block for module with given index.
 */
Allocate TLS block for module with given index.
Allocate TLS block for module with given index .
void *
allocate_module_tls(int index)
{
    Obj_Entry* obj;
    char* p;
    TAILQ_FOREACH(obj, &obj_list, next) {
	if (obj->marker)
	    continue;
	if (obj->tlsindex == index)
	    break;
    }
    if (!obj) {
	_rtld_error("Can't find module with TLS index %d", index);
	rtld_die();
    }
    p = malloc_aligned(obj->tlssize, obj->tlsalign);
    memcpy(p, obj->tlsinit, obj->tlsinitsize);
    memset(p + obj->tlsinitsize, 0, obj->tlssize - obj->tlsinitsize);
    return p;
}
void * allocate_module_tls ( int index ) { Obj_Entry * obj ; char * p ; TAILQ_FOREACH ( obj , & obj_list , next ) { if ( obj -> marker ) continue ; if ( obj -> tlsindex == index ) break ; } if ( ! obj ) { _rtld_error ( " " , index ) ; rtld_die ( ) ; } p = malloc_aligned ( obj -> tlssize , obj -> tlsalign ) ; memcpy ( p , obj -> tlsinit , obj -> tlsinitsize ) ; memset ( p + obj -> tlsinitsize , 0 , obj -> tlssize - obj -> tlsinitsize ) ; return p ; }
Allocate TLS block for module with given index.
Allocate TLS block for module with given index .