/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2008 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
/*
* This file contains most of the functionality
* required to support the threads portion of libc_db.
*/
#include "lint.h"
#include "thr_uberdata.h"
static void
tdb_event_ready(void) {}
static void
tdb_event_sleep(void) {}
static void
tdb_event_switchto(void) {}
static void
tdb_event_switchfrom(void) {}
static void
tdb_event_lock_try(void) {}
static void
tdb_event_catchsig(void) {}
static void
tdb_event_idle(void) {}
static void
tdb_event_create(void) {}
static void
tdb_event_death(void) {}
static void
tdb_event_preempt(void) {}
static void
tdb_event_pri_inherit(void) {}
static void
tdb_event_reap(void) {}
static void
tdb_event_concurrency(void) {}
static void
tdb_event_timeout(void) {}
/*
* uberflags.uf_tdb_register_sync is set to REGISTER_SYNC_ENABLE by a debugger
* to empty the table and then enable synchronization object registration.
*
* uberflags.uf_tdb_register_sync is set to REGISTER_SYNC_DISABLE by a debugger
* to empty the table and then disable synchronization object registration.
*/
};
#if TDB_HASH_SHIFT != 15
#error "this is all broken because TDB_HASH_SHIFT is not 15"
#endif
static uint_t
{
/*
* This knows for a fact that the hash table has
* 32K entries; that is, that TDB_HASH_SHIFT is 15.
*/
#ifdef _LP64
#else
#endif
}
static tdb_sync_stats_t *
{
void *vaddr;
int i;
/*
* Don't keep trying after mmap() has already failed.
*/
if (tdbp->tdb_hash_alloc_failed)
return (NULL);
/* double the allocation each time */
return (NULL);
}
}
return (sap);
}
static void
{
void *vaddr;
int i;
if (tdbp->tdb_hash_alloc_failed)
return;
/*
* There is no point allocating the hash table
* if we are disabling registration.
*/
return;
}
return;
}
/* start with a free list of 2k elements */
return;
}
/* initialize the free list */
/* insert &udp->tdb_hash_lock itself into the new (empty) table */
/* assign to tdb_sync_addr_hash only after fully initialized */
}
{
int locked = 0;
int i;
/*
* Don't start statistics collection until
* we have initialized the primary link map.
*/
if (!self->ul_primarymap)
return (NULL);
if (new)
*new = 0;
/*
* To avoid recursion problems, we must do two things:
* 1. Make a special case for tdb_hash_lock (we use it internally).
* 2. Deal with the dynamic linker's lock interface:
* When calling any external function, we may invoke the
* dynamic linker. It grabs a lock, which calls back here.
* This only happens on the first call to the external
* function, so we can just return NULL if we are called
* recursively (and miss the first count).
*/
return (&udp->tdb_hash_lock_stats);
return (NULL);
/*
* On the first time through, initialize the hash table and free list.
*/
goto out;
}
}
/*
* Look up an address in the synchronization object hash table.
* No lock is required since it can only deliver a false
* negative, in which case we fall into the locked case below.
*/
goto out;
}
}
/*
* The search with no lock held failed or a special action is required.
*/
locked = 1;
case REGISTER_SYNC_ON:
break;
case REGISTER_SYNC_OFF:
goto out;
default:
/*
* For all debugger actions, first zero out the
* statistics block of every element in the hash table.
*/
for (i = 0; i < TDB_HASH_SIZE; i++)
for (sap = (tdb_sync_stats_t *)
case REGISTER_SYNC_ENABLE:
break;
case REGISTER_SYNC_DISABLE:
default:
goto out;
}
break;
}
/*
* Perform the search while holding tdb_hash_lock.
* Keep track of the insertion point.
*/
break;
}
/*
* Insert a new element if necessary.
*/
if (new)
*new = 1;
}
out:
if (locked)
self->ul_sync_obj_reg = 0;
return (sap);
}
void
{
/*
* tdb_hash_lock is never destroyed.
*/
/*
* Avoid acquiring tdb_hash_lock if lock statistics gathering has
* never been initiated or there is nothing in the hash bucket.
* (Once the hash table is allocated, it is never deallocated.)
*/
return;
/* remove it from the hash table */
/* clear it */
/* insert it on the tail of the free list */
} else {
}
break;
}
}
}
/*
* Return a mutex statistics block for the given mutex.
*/
{
/* avoid stealing the cache line unnecessarily */
return (NULL);
}
/*
* Return a condvar statistics block for the given condvar.
*/
{
/* avoid stealing the cache line unnecessarily */
return (NULL);
}
/*
* Return an rwlock statistics block for the given rwlock.
*/
{
/* avoid stealing the cache line unnecessarily */
return (NULL);
}
/*
* Return a semaphore statistics block for the given semaphore.
*/
{
int new;
/* avoid stealing the cache line unnecessarily */
return (NULL);
if (new) {
}
}