Lines Matching defs:tsd
122 idmap_tsd_t *tsd = (idmap_tsd_t *)key;
123 if (tsd) {
124 if (tsd->db_db)
125 (void) sqlite_close(tsd->db_db);
126 if (tsd->cache_db)
127 (void) sqlite_close(tsd->cache_db);
128 free(tsd);
146 idmap_tsd_t *tsd;
148 if ((tsd = pthread_getspecific(idmap_tsd_key)) == NULL) {
150 if ((tsd = malloc(sizeof (*tsd))) != NULL) {
152 (void) memset(tsd, 0, sizeof (*tsd));
154 if (pthread_setspecific(idmap_tsd_key, tsd) != 0) {
156 free(tsd);
157 tsd = NULL;
160 tsd = NULL;
164 return (tsd);
372 idmap_tsd_t *tsd;
378 if ((tsd = idmap_get_tsd()) == NULL) {
384 if (tsd->db_db == NULL) {
385 tsd->db_db = sqlite_open(IDMAP_DBNAME, 0, &errmsg);
386 if (tsd->db_db == NULL) {
393 tsd->db_busy.name = IDMAP_DBNAME;
394 tsd->db_busy.delays = db_delay_table;
395 tsd->db_busy.delay_size = sizeof (db_delay_table) /
397 sqlite_busy_handler(tsd->db_db, idmap_sqlite_busy_handler,
398 &tsd->db_busy);
400 *db = tsd->db_db;
411 idmap_tsd_t *tsd;
417 if ((tsd = idmap_get_tsd()) == NULL) {
423 if (tsd->cache_db == NULL) {
424 tsd->cache_db = sqlite_open(IDMAP_CACHENAME, 0, &errmsg);
425 if (tsd->cache_db == NULL) {
432 tsd->cache_busy.name = IDMAP_CACHENAME;
433 tsd->cache_busy.delays = cache_delay_table;
434 tsd->cache_busy.delay_size = sizeof (cache_delay_table) /
436 sqlite_busy_handler(tsd->cache_db, idmap_sqlite_busy_handler,
437 &tsd->cache_busy);
439 *cache = tsd->cache_db;