• Home
  • Raw
  • Download

Lines Matching +full:- +full:dm

19  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
120 if(me->bInit == 0) { in static_mod_table_ctor()
121 RW_MUTEX_CTOR(me->mut); in static_mod_table_ctor()
122 me->staticMods = 0; in static_mod_table_ctor()
123 me->staticModOverrides = 0; in static_mod_table_ctor()
124 me->bInit = 1; in static_mod_table_ctor()
131 struct const_mod *dm, *ftmp; in static_mod_table_dtor_imp() local
132 if(me->bInit != 0) { in static_mod_table_dtor_imp()
133 if( me->staticMods || me->constMods || me->staticModOverrides) { in static_mod_table_dtor_imp()
134 RW_MUTEX_LOCK_WRITE(me->mut); in static_mod_table_dtor_imp()
135 HASH_ITER(hh, me->staticMods, sm, stmp) { in static_mod_table_dtor_imp()
136 if(me->staticMods) { in static_mod_table_dtor_imp()
137 HASH_DEL(me->staticMods,sm); in static_mod_table_dtor_imp()
142 HASH_ITER(hh, me->staticModOverrides, sm, stmp) { in static_mod_table_dtor_imp()
143 if(me->staticModOverrides) { in static_mod_table_dtor_imp()
144 HASH_DEL(me->staticModOverrides,sm); in static_mod_table_dtor_imp()
149 HASH_ITER(hh, me->constMods, dm, ftmp) { in static_mod_table_dtor_imp()
150 if(me->constMods) { in static_mod_table_dtor_imp()
151 HASH_DEL(me->constMods,dm); in static_mod_table_dtor_imp()
153 free(dm); in static_mod_table_dtor_imp()
154 dm = NULL; in static_mod_table_dtor_imp()
156 RW_MUTEX_UNLOCK_WRITE(me->mut); in static_mod_table_dtor_imp()
158 RW_MUTEX_DTOR(me->mut); in static_mod_table_dtor_imp()
159 me->staticMods = 0; in static_mod_table_dtor_imp()
160 me->staticModOverrides = 0; in static_mod_table_dtor_imp()
161 me->bInit = 0; in static_mod_table_dtor_imp()
167 RW_MUTEX_CTOR(me->mut); in open_mod_table_ctor_imp()
168 me->openMods = 0; in open_mod_table_ctor_imp()
169 me->smt = (struct static_mod_table*) ctx; in open_mod_table_ctor_imp()
177 struct open_mod *dm, *ftmp; in open_mod_table_dtor_imp() local
178 if( me->openMods) { in open_mod_table_dtor_imp()
179 RW_MUTEX_LOCK_WRITE(me->mut); in open_mod_table_dtor_imp()
180 HASH_ITER(hh, me->openMods, dm, ftmp) { in open_mod_table_dtor_imp()
181 if(me->openMods) { in open_mod_table_dtor_imp()
182 HASH_DEL(me->openMods,dm); in open_mod_table_dtor_imp()
184 if(dm->h64) { in open_mod_table_dtor_imp()
185 (void)open_mod_handle_close(dm, dm->h64); in open_mod_table_dtor_imp()
187 if(dm->dlhandle) { in open_mod_table_dtor_imp()
188 DLCLOSE(dm->dlhandle); in open_mod_table_dtor_imp()
190 free(dm); in open_mod_table_dtor_imp()
192 RW_MUTEX_UNLOCK_WRITE(me->mut); in open_mod_table_dtor_imp()
194 RW_MUTEX_DTOR(me->mut); in open_mod_table_dtor_imp()
195 me->openMods = 0; in open_mod_table_dtor_imp()
204 return open_mod_table_open_from_static(me, &me->smt->staticModOverrides, uri, handle); in open_mod_table_open_static_override()
210 return open_mod_table_open_from_static(me, &me->smt->staticMods, uri, handle); in open_mod_table_open_static()
220 std_strlcpy(sm->uri, uri, len); in static_mod_add()
221 sm->invoke = invoke; in static_mod_add()
222 sm->handle_invoke = handle_invoke; in static_mod_add()
223 RW_MUTEX_LOCK_WRITE(me->mut); in static_mod_add()
225 RW_MUTEX_UNLOCK_WRITE(me->mut); in static_mod_add()
238 return static_mod_add(me, &me->staticModOverrides, uri, pfn, 0); in static_mod_table_register_static_override()
241 return static_mod_add(me, &me->staticModOverrides, uri, 0, pfn); in static_mod_table_register_static_override1()
244 return static_mod_add(me, &me->staticMods, uri, pfn, 0); in static_mod_table_register_static()
247 return static_mod_add(me, &me->staticMods, uri, 0, pfn); in static_mod_table_register_static1()
258 struct const_mod *dm = 0, *dmOld; in static_mod_table_register_const_handle() local
259 …VERIFYC(NULL != (dm = ((struct const_mod*)calloc(1, sizeof(struct open_mod) + len))), AEE_ENOMEMOR… in static_mod_table_register_const_handle()
260 dm->key = local; in static_mod_table_register_const_handle()
261 dm->invoke = invoke; in static_mod_table_register_const_handle()
262 dm->handle_invoke = handle_invoke; in static_mod_table_register_const_handle()
263 dm->h64 = remote; in static_mod_table_register_const_handle()
264 std_strlcpy(dm->uri, uri, len); in static_mod_table_register_const_handle()
266 RW_MUTEX_LOCK_WRITE(me->mut); in static_mod_table_register_const_handle()
267 HASH_FIND_INT(me->constMods, &local, dmOld); in static_mod_table_register_const_handle()
269 HASH_ADD_INT(me->constMods, key, dm); in static_mod_table_register_const_handle()
271 RW_MUTEX_UNLOCK_WRITE(me->mut); in static_mod_table_register_const_handle()
272 nErr = dmOld != 0 ? -1 : nErr; in static_mod_table_register_const_handle()
276 if(dm) { in static_mod_table_register_const_handle()
277 free(dm); in static_mod_table_register_const_handle()
278 dm = NULL; in static_mod_table_register_const_handle()
293 nErr = mod->handle_invoke(0,REMOTE_SCALARS_MAKEX(0,0,2,0,0,1),args); in open_mod_handle_open()
306 nErr = mod->handle_invoke(0,REMOTE_SCALARS_MAKEX(0,1,0,0,1,0),args); in open_mod_handle_close()
337 out->file = sbuf_cur(&buf); in parse_uri()
339 out->filelen = sbuf_cur(&buf) - out->file; in parse_uri()
340 FARF(HIGH, "file:%.*s %d", out->filelen, out->file, out->filelen); in parse_uri()
342 out->sym = sbuf_cur(&buf); in parse_uri()
344 out->symlen = sbuf_cur(&buf) - out->sym; in parse_uri()
345 assert(out->sym + out->symlen <= uri + urilen); in parse_uri()
346 FARF(HIGH, "sym:%.*s %d", out->symlen, out->sym, out->symlen); in parse_uri()
356 nameLen = sbuf_cur(&buf) - name; in parse_uri()
366 valueLen = sbuf_cur(&buf) - value; in parse_uri()
371 out->ver = value; in parse_uri()
372 out->verlen = valueLen; in parse_uri()
377 if(out->filelen) { in parse_uri()
378 FARF(HIGH, "parse_uri file: %.*s", out->filelen, out->file); in parse_uri()
380 if(out->symlen) { in parse_uri()
381 FARF(HIGH, "parse_uri sym: %.*s", out->symlen, out->sym); in parse_uri()
383 if(out->verlen) { in parse_uri()
384 FARF(HIGH, "parse_uri version: %.*s", out->verlen, out->ver); in parse_uri()
396 struct open_mod *dm = 0, *dmOld; in open_mod_table_open_dynamic() local
402 …VERIFYC(NULL != (dm = ((struct open_mod*)calloc(1, sizeof(struct open_mod) + len + 1))), AEE_ENOME… in open_mod_table_open_dynamic()
403 std_memmove(dm->uri, uri, len + 1); in open_mod_table_open_dynamic()
405 (void)parse_uri(dm->uri, len, &dm->vals); in open_mod_table_open_dynamic()
407 FARF(HIGH, "vals %d %d %d", dm->vals.filelen, dm->vals.symlen, dm->vals.verlen); in open_mod_table_open_dynamic()
408 if(dm->vals.filelen) { in open_mod_table_open_dynamic()
409 int rv = std_snprintf(tmp, tmplen, "%.*s", dm->vals.filelen, dm->vals.file); in open_mod_table_open_dynamic()
417 dm->dlhandle = DLOPEN(tmp,RTLD_NOW); in open_mod_table_open_dynamic()
418 FARF(HIGH, "got %p for dlopen %s", dm->dlhandle, tmp); in open_mod_table_open_dynamic()
419 VERIFY(!(nErr = (dlErr = dm->dlhandle == 0 ? -5 : 0))); in open_mod_table_open_dynamic()
421 if(dm->vals.symlen) { in open_mod_table_open_dynamic()
422 int rv = std_snprintf(tmp, tmplen, "%.*s", dm->vals.symlen, dm->vals.sym); in open_mod_table_open_dynamic()
430 if(dm->vals.verlen && 0 == std_strncmp(dm->vals.ver, "1.0", dm->vals.verlen)) { in open_mod_table_open_dynamic()
431 dm->handle_invoke = (handle_invoke_fn) DLSYM(dm->dlhandle, tmp); in open_mod_table_open_dynamic()
433 dm->invoke = (invoke_fn) DLSYM(dm->dlhandle, tmp); in open_mod_table_open_dynamic()
435 FARF(HIGH, "dlsym returned %p %p", dm->invoke, dm->handle_invoke); in open_mod_table_open_dynamic()
436 VERIFYC(!(dlErr = dm->invoke || dm->handle_invoke ? 0 : AEE_ENOSUCHSYMBOL), AEE_ENOSUCHSYMBOL); in open_mod_table_open_dynamic()
438 dm->key = (uint32)(uintptr_t)dm; in open_mod_table_open_dynamic()
439 dm->refs = 1; in open_mod_table_open_dynamic()
440 if(dm->handle_invoke) { in open_mod_table_open_dynamic()
441 VERIFY(AEE_SUCCESS == (nErr = open_mod_handle_open(dm, uri, &dm->h64))); in open_mod_table_open_dynamic()
443 RW_MUTEX_LOCK_WRITE(me->mut); in open_mod_table_open_dynamic()
445 HASH_FIND_INT(me->openMods, &dm->key, dmOld); in open_mod_table_open_dynamic()
447 dm->key++; in open_mod_table_open_dynamic()
450 RW_MUTEX_LOCK_WRITE(me->smt->mut); in open_mod_table_open_dynamic()
451 HASH_FIND_INT(me->smt->constMods, &dm->key, dmOld); in open_mod_table_open_dynamic()
452 RW_MUTEX_UNLOCK_WRITE(me->smt->mut); in open_mod_table_open_dynamic()
454 HASH_ADD_INT(me->openMods, key, dm); in open_mod_table_open_dynamic()
456 RW_MUTEX_UNLOCK_WRITE(me->mut); in open_mod_table_open_dynamic()
457 nErr = dmOld != 0 ? -1 : nErr; in open_mod_table_open_dynamic()
459 *handle = dm->key; in open_mod_table_open_dynamic()
474 if(dm && dm->h64) { in open_mod_table_open_dynamic()
475 (void)open_mod_handle_close(dm, dm->h64); in open_mod_table_open_dynamic()
477 if(dm && dm->dlhandle) { in open_mod_table_open_dynamic()
478 DLCLOSE(dm->dlhandle); in open_mod_table_open_dynamic()
480 if(dm) { in open_mod_table_open_dynamic()
481 free(dm); in open_mod_table_open_dynamic()
482 dm = NULL; in open_mod_table_open_dynamic()
501 struct open_mod *dm = 0, *dmOld = 0; in open_mod_table_open_from_static() local
505 VERIFYC(NULL != (dm = ((struct open_mod*)calloc(1, sizeof(*dm) + sz))), AEE_ENOMEMORY); in open_mod_table_open_from_static()
506 RW_MUTEX_LOCK_READ(me->mut); in open_mod_table_open_from_static()
508 RW_MUTEX_UNLOCK_READ(me->mut); in open_mod_table_open_from_static()
509 std_memmove(dm->uri, uri, len); in open_mod_table_open_from_static()
511 VERIFY(AEE_SUCCESS == (nErr = parse_uri(uri, len, &dm->vals))); in open_mod_table_open_from_static()
512 FARF(HIGH, "file %.*s %d", dm->vals.filelen, dm->vals.file, dm->vals.filelen); in open_mod_table_open_from_static()
513 FARF(HIGH, "sym %.*s %d", dm->vals.symlen, dm->vals.sym, dm->vals.symlen); in open_mod_table_open_from_static()
514 FARF(HIGH, "version %.*s %d", dm->vals.verlen, dm->vals.ver, dm->vals.verlen); in open_mod_table_open_from_static()
515 if(dm->vals.verlen) { in open_mod_table_open_from_static()
516 int rv = std_snprintf(dm->uri, sz, "file:///%.*s?%.*s&_modver=%.*s", in open_mod_table_open_from_static()
517 dm->vals.filelen, dm->vals.file, in open_mod_table_open_from_static()
518 dm->vals.symlen, dm->vals.sym, in open_mod_table_open_from_static()
519 dm->vals.verlen, dm->vals.ver); in open_mod_table_open_from_static()
522 int rv = std_snprintf(dm->uri, sz, "file://%.*s?%.*s", in open_mod_table_open_from_static()
523 dm->vals.filelen, dm->vals.file, in open_mod_table_open_from_static()
524 dm->vals.symlen, dm->vals.sym); in open_mod_table_open_from_static()
527 FARF(HIGH, "dm->uri:%s", dm->uri); in open_mod_table_open_from_static()
529 RW_MUTEX_LOCK_READ(me->mut); in open_mod_table_open_from_static()
530 HASH_FIND_STR(*tbl, dm->uri, sm); in open_mod_table_open_from_static()
531 RW_MUTEX_UNLOCK_READ(me->mut); in open_mod_table_open_from_static()
534 assert(sm->handle_invoke || sm->invoke); in open_mod_table_open_from_static()
535 dm->handle_invoke = sm->handle_invoke; in open_mod_table_open_from_static()
536 dm->invoke = sm->invoke; in open_mod_table_open_from_static()
537 dm->key = (uint32)(uintptr_t)dm; in open_mod_table_open_from_static()
538 dm->refs = 1; in open_mod_table_open_from_static()
539 if(dm->handle_invoke) { in open_mod_table_open_from_static()
540 VERIFY(AEE_SUCCESS == (nErr = open_mod_handle_open(dm, uri, &dm->h64))); in open_mod_table_open_from_static()
543 RW_MUTEX_LOCK_WRITE(me->mut); in open_mod_table_open_from_static()
545 HASH_FIND_INT(me->openMods, &dm->key, dmOld); in open_mod_table_open_from_static()
547 dm->key++; in open_mod_table_open_from_static()
550 HASH_ADD_INT(me->openMods, key, dm); in open_mod_table_open_from_static()
551 RW_MUTEX_UNLOCK_WRITE(me->mut); in open_mod_table_open_from_static()
553 *handle = dm->key; in open_mod_table_open_from_static()
562 if(nErr && dm) { in open_mod_table_open_from_static()
563 if(dm->h64) { in open_mod_table_open_from_static()
564 (void)open_mod_handle_close(dm, dm->h64); in open_mod_table_open_from_static()
566 free(dm); in open_mod_table_open_from_static()
567 dm = NULL; in open_mod_table_open_from_static()
597 static void open_mod_close(struct open_mod_table *me, struct open_mod* dm) { in open_mod_close() argument
598 RW_MUTEX_LOCK_WRITE(me->mut); in open_mod_close()
599 dm->refs--; in open_mod_close()
600 if(dm->refs <= 0) { in open_mod_close()
601 HASH_DEL(me->openMods,dm); in open_mod_close()
603 dm = 0; in open_mod_close()
605 RW_MUTEX_UNLOCK_WRITE(me->mut); in open_mod_close()
606 if(dm) { in open_mod_close()
607 if(dm->h64) { in open_mod_close()
608 (void)open_mod_handle_close(dm, dm->h64); in open_mod_close()
610 if(dm->dlhandle) { in open_mod_close()
611 DLCLOSE(dm->dlhandle); in open_mod_close()
613 free(dm); in open_mod_close()
614 dm = NULL; in open_mod_close()
620 struct open_mod *dm, *del = 0;; in open_mod_table_close() local
623 RW_MUTEX_LOCK_WRITE(me->mut); in open_mod_table_close()
624 HASH_FIND_INT(me->openMods, &handle, dm); in open_mod_table_close()
625 if(dm) { in open_mod_table_close()
626 dm->refs--; in open_mod_table_close()
627 if(dm->refs <= 0) { in open_mod_table_close()
628 del = dm; in open_mod_table_close()
629 FARF(HIGH, "deleting %s %p", del->uri, del); in open_mod_table_close()
630 HASH_DEL(me->openMods,dm); in open_mod_table_close()
632 FARF(HIGH, "leaked %s", dm->uri); in open_mod_table_close()
633 dm = 0; in open_mod_table_close()
636 RW_MUTEX_UNLOCK_WRITE(me->mut); in open_mod_table_close()
638 if(del->h64) { in open_mod_table_close()
639 (void)open_mod_handle_close(dm, dm->h64); in open_mod_table_close()
641 if(del->dlhandle) { in open_mod_table_close()
642 dlErr = DLCLOSE(del->dlhandle); in open_mod_table_close()
644 FARF(HIGH, "free %s %p", del->uri, del); in open_mod_table_close()
667 RW_MUTEX_LOCK_READ(me->mut); in open_mod_table_get_open()
668 HASH_FIND_INT(me->openMods, &handle, om); in open_mod_table_get_open()
670 om->refs++; in open_mod_table_get_open()
672 RW_MUTEX_UNLOCK_READ(me->mut); in open_mod_table_get_open()
677 RW_MUTEX_LOCK_READ(me->smt->mut); in open_mod_table_get_const()
678 HASH_FIND_INT(me->smt->constMods, &handle, cm); in open_mod_table_get_const()
679 RW_MUTEX_UNLOCK_READ(me->smt->mut); in open_mod_table_get_const()
692 invoke = cm->invoke; in open_mod_table_handle_invoke()
693 handle_invoke = cm->handle_invoke; in open_mod_table_handle_invoke()
694 h = cm->h64; in open_mod_table_handle_invoke()
697 invoke = om->invoke; in open_mod_table_handle_invoke()
698 handle_invoke = om->handle_invoke; in open_mod_table_handle_invoke()
699 h = om->h64; in open_mod_table_handle_invoke()