plugin 40 src/libsir/include/sir/plugins.h sirpluginid _sir_plugin_probe(sir_plugin* plugin); plugin 42 src/libsir/include/sir/plugins.h bool _sir_plugin_unload(sir_plugin* plugin); plugin 44 src/libsir/include/sir/plugins.h sirpluginid _sir_plugin_add(sir_plugin* plugin); plugin 46 src/libsir/include/sir/plugins.h void _sir_plugin_destroy(sir_plugin** plugin); plugin 50 src/libsir/include/sir/plugins.h sirpluginid _sir_plugin_cache_add(sir_plugincache* spc, sir_plugin* plugin); plugin 42 src/libsir/src/sirplugins.c sir_plugin* plugin = (sir_plugin*)calloc(1, sizeof(sir_plugin)); plugin 43 src/libsir/src/sirplugins.c if (!plugin) plugin 47 src/libsir/src/sirplugins.c plugin->handle = dlopen(path, RTLD_NOW | RTLD_LOCAL); plugin 48 src/libsir/src/sirplugins.c if (!plugin->handle) { plugin 51 src/libsir/src/sirplugins.c _sir_plugin_destroy(&plugin); plugin 56 src/libsir/src/sirplugins.c plugin->handle = LoadLibraryA(path); plugin 58 src/libsir/src/sirplugins.c if (!plugin->handle) { plugin 61 src/libsir/src/sirplugins.c _sir_plugin_destroy(&plugin); plugin 66 src/libsir/src/sirplugins.c plugin->loaded = true; plugin 67 src/libsir/src/sirplugins.c plugin->path = strndup(path, strnlen(path, SIR_MAXPATH)); plugin 69 src/libsir/src/sirplugins.c if (!_sir_validstrnofail(plugin->path)) { plugin 70 src/libsir/src/sirplugins.c _sir_plugin_destroy(&plugin); plugin 75 src/libsir/src/sirplugins.c plugin->path, plugin->handle); plugin 77 src/libsir/src/sirplugins.c return _sir_plugin_probe(plugin); plugin 84 src/libsir/src/sirplugins.c sirpluginid _sir_plugin_probe(sir_plugin* plugin) { plugin 87 src/libsir/src/sirplugins.c if (plugin) { plugin 98 src/libsir/src/sirplugins.c plugin->iface.query = (sir_plugin_queryfn) plugin 99 src/libsir/src/sirplugins.c _sir_plugin_getexport(plugin->handle, SIR_PLUGIN_EXPORT_QUERY); plugin 100 src/libsir/src/sirplugins.c plugin->iface.init = (sir_plugin_initfn) plugin 101 src/libsir/src/sirplugins.c _sir_plugin_getexport(plugin->handle, SIR_PLUGIN_EXPORT_INIT); plugin 102 src/libsir/src/sirplugins.c plugin->iface.write = (sir_plugin_writefn) plugin 103 src/libsir/src/sirplugins.c _sir_plugin_getexport(plugin->handle, SIR_PLUGIN_EXPORT_WRITE); plugin 104 src/libsir/src/sirplugins.c plugin->iface.cleanup = (sir_plugin_cleanupfn) plugin 105 src/libsir/src/sirplugins.c _sir_plugin_getexport(plugin->handle, SIR_PLUGIN_EXPORT_CLEANUP); plugin 107 src/libsir/src/sirplugins.c if (!plugin->iface.query || !plugin->iface.init || plugin 108 src/libsir/src/sirplugins.c !plugin->iface.write || !plugin->iface.cleanup) { plugin 110 src/libsir/src/sirplugins.c " '%s', addr: %p)!", plugin->path, plugin->handle); plugin 113 src/libsir/src/sirplugins.c (uintptr_t)plugin->iface.query, (uintptr_t)plugin->iface.init, plugin 114 src/libsir/src/sirplugins.c (uintptr_t)plugin->iface.write, (uintptr_t)plugin->iface.cleanup); plugin 115 src/libsir/src/sirplugins.c _sir_plugin_destroy(&plugin); plugin 122 src/libsir/src/sirplugins.c if (!plugin->iface.query(&plugin->info)) { plugin 124 src/libsir/src/sirplugins.c " query fn!", plugin->path, plugin->handle); plugin 125 src/libsir/src/sirplugins.c _sir_plugin_destroy(&plugin); plugin 131 src/libsir/src/sirplugins.c if (!plugin->info.iface_ver || plugin->info.iface_ver > SIR_PLUGIN_VCURRENT) { plugin 133 src/libsir/src/sirplugins.c " %"PRIu8"; libsir has %d", plugin->path, plugin->handle, plugin 134 src/libsir/src/sirplugins.c plugin->info.iface_ver, SIR_PLUGIN_VCURRENT); plugin 135 src/libsir/src/sirplugins.c _sir_plugin_destroy(&plugin); plugin 143 src/libsir/src/sirplugins.c if (!_sir_validlevels(plugin->info.levels)) { plugin 145 src/libsir/src/sirplugins.c " %04"PRIx16, plugin->path, plugin->handle, plugin->info.levels); plugin 150 src/libsir/src/sirplugins.c if (!_sir_validopts(plugin->info.opts)) { plugin 152 src/libsir/src/sirplugins.c " %08"PRIx32, plugin->path, plugin->handle, plugin->info.opts); plugin 157 src/libsir/src/sirplugins.c if (!_sir_validstrnofail(plugin->info.author) || plugin 158 src/libsir/src/sirplugins.c !_sir_validstrnofail(plugin->info.desc)) { plugin 160 src/libsir/src/sirplugins.c " or description", plugin->path, plugin->handle); plugin 166 src/libsir/src/sirplugins.c _sir_plugin_destroy(&plugin); plugin 173 src/libsir/src/sirplugins.c if (!plugin->iface.init()) { plugin 175 src/libsir/src/sirplugins.c plugin->path, plugin->handle); plugin 176 src/libsir/src/sirplugins.c _sir_plugin_destroy(&plugin); plugin 181 src/libsir/src/sirplugins.c plugin->id = FNV32_1a((const uint8_t*)&plugin->iface, sizeof(sir_pluginiface)); plugin 182 src/libsir/src/sirplugins.c plugin->valid = true; plugin 193 src/libsir/src/sirplugins.c plugin->path, plugin->id, plugin->info.maj_ver, plugin->info.min_ver, plugin 194 src/libsir/src/sirplugins.c plugin->info.bld_ver, plugin->info.levels, plugin->info.opts, plugin 195 src/libsir/src/sirplugins.c _SIR_PRNSTR(plugin->info.author), _SIR_PRNSTR(plugin->info.desc), plugin 196 src/libsir/src/sirplugins.c plugin->info.caps); plugin 198 src/libsir/src/sirplugins.c retval = _sir_plugin_add(plugin); plugin 201 src/libsir/src/sirplugins.c " cache; unloading", plugin->path, plugin->handle); plugin 202 src/libsir/src/sirplugins.c _sir_plugin_destroy(&plugin); plugin 208 src/libsir/src/sirplugins.c SIR_UNUSED(plugin); plugin 249 src/libsir/src/sirplugins.c bool _sir_plugin_unload(sir_plugin* plugin) { plugin 251 src/libsir/src/sirplugins.c if (!_sir_validptrnofail(plugin) || !_sir_validptrnofail(plugin->handle)) { plugin 253 src/libsir/src/sirplugins.c " cannot unload!", (void*)plugin, (plugin ? plugin->handle : NULL)); plugin 258 src/libsir/src/sirplugins.c if (plugin->iface.cleanup && !plugin->iface.cleanup()) plugin 260 src/libsir/src/sirplugins.c " cleanup!", plugin->path, plugin->handle); plugin 263 src/libsir/src/sirplugins.c if (0 != dlclose(plugin->handle)) { plugin 265 src/libsir/src/sirplugins.c _sir_selflog("error: dlclose(%p) failed (%s)", plugin->handle, _SIR_PRNSTR(err)); plugin 269 src/libsir/src/sirplugins.c if (!FreeLibrary(plugin->handle)) { plugin 271 src/libsir/src/sirplugins.c _sir_selflog("error: FreeLibrary(%p) failed (%lu)", plugin->handle, err); plugin 276 src/libsir/src/sirplugins.c plugin->handle = NULL; plugin 277 src/libsir/src/sirplugins.c plugin->loaded = false; plugin 278 src/libsir/src/sirplugins.c _sir_selflog("unloaded plugin (path: '%s', id: %08"PRIx32")", plugin->path, plugin 279 src/libsir/src/sirplugins.c plugin->id); plugin 282 src/libsir/src/sirplugins.c SIR_UNUSED(plugin); plugin 287 src/libsir/src/sirplugins.c sirpluginid _sir_plugin_add(sir_plugin* plugin) { plugin 291 src/libsir/src/sirplugins.c if (_sir_validptr(plugin)) { plugin 293 src/libsir/src/sirplugins.c retval = _sir_plugin_cache_add(spc, plugin); plugin 299 src/libsir/src/sirplugins.c SIR_UNUSED(plugin); plugin 322 src/libsir/src/sirplugins.c void _sir_plugin_destroy(sir_plugin** plugin) { plugin 324 src/libsir/src/sirplugins.c if (_sir_validptrptr(plugin) && _sir_validptr(*plugin)) { plugin 325 src/libsir/src/sirplugins.c bool unloaded = _sir_plugin_unload(*plugin); plugin 328 src/libsir/src/sirplugins.c _sir_safefree(&(*plugin)->path); plugin 329 src/libsir/src/sirplugins.c _sir_safefree(plugin); plugin 332 src/libsir/src/sirplugins.c SIR_UNUSED(plugin); plugin 346 src/libsir/src/sirplugins.c sirpluginid _sir_plugin_cache_add(sir_plugincache* spc, sir_plugin* plugin) { plugin 348 src/libsir/src/sirplugins.c if (!_sir_validptr(spc) || !_sir_validptr(plugin)) plugin 356 src/libsir/src/sirplugins.c const sir_plugin* existing = _sir_plugin_cache_find_id(spc, plugin->id); plugin 359 src/libsir/src/sirplugins.c existing->path, plugin->id); plugin 365 src/libsir/src/sirplugins.c plugin->path, plugin->id, spc->count + 1); plugin 366 src/libsir/src/sirplugins.c spc->plugins[spc->count++] = plugin; plugin 367 src/libsir/src/sirplugins.c return plugin->id; plugin 370 src/libsir/src/sirplugins.c SIR_UNUSED(plugin);