Lines Matching refs:tsd

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