int PEVENT_PLUGIN_LOADER(struct pevent *pevent) { PyObject *globals, *m, *py_pevent, *str, *res; Py_Initialize(); m = PyImport_AddModule("__main__"); globals = PyModule_GetDict(m); res = PyRun_String(pypath, Py_file_input, globals, globals); if (!res) { PyErr_Print(); return -1; } else Py_DECREF(res); str = PyString_FromString("pevent"); if (!str) return -ENOMEM; py_pevent = PyLong_FromUnsignedLong((unsigned long)pevent); if (!py_pevent) return -ENOMEM; if (PyDict_SetItem(globals, str, py_pevent)) fprintf(stderr, "failed to insert pevent\n"); Py_DECREF(py_pevent); Py_DECREF(str); trace_util_load_plugins(pevent, ".py", load_plugin, globals); return 0; }
struct plugin_list *tracecmd_load_plugins(struct pevent *pevent) { struct plugin_list *list = NULL; trace_util_load_plugins(pevent, ".so", load_plugin, &list); return list; }
struct plugin_option *trace_util_read_plugin_options(void) { struct plugin_option_read option = { .options = NULL, }; append_option(&option, trace_ftrace_options, "ftrace", NULL); trace_util_load_plugins(NULL, ".so", read_options, &option); return option.options; }