/* Disable all functions of a trace * @param trace trace name * @see etrace_funcsettatus */ int etrace_funcdisableall(char *trace) { u_int index; int keynbr; char **keys; hash_t *table; PROFILER_IN(__FILE__, __FUNCTION__, __LINE__); if (!trace) trace = ETRACE_TYPE_DEFAULT; etrace_init_trace(); keys = hash_get_keys(&traces_table, &keynbr); if (keys) { for (index = 0; index < keynbr; index++) { table = (hash_t *) hash_get(&traces_table, keys[index]); if (table) etrace_funcsetstatus(table, 0); } hash_free_keys(keys); } PROFILER_ROUT(__FILE__, __FUNCTION__, __LINE__, 0); }
/** * Change the status of a whole trace * @param table trace hash table * @param status new status (0 = disable, 1 = enable) * @see etrace_funcenableall * @see etrace_funcdisableall */ int etrace_funcsetstatus(hash_t *table, int status) { u_int index; int keynbr; char **keys; trace_t *ret_trace; PROFILER_IN(__FILE__, __FUNCTION__, __LINE__); if (!table) PROFILER_ERR(__FILE__, __FUNCTION__, __LINE__, "Invalid parameters", -1); etrace_init_trace(); keys = hash_get_keys(table, &keynbr); if (keys) { for (index = 0; index < keynbr; index++) { ret_trace = (trace_t *) hash_get(table, keys[index]); if (ret_trace) { if (ret_trace->enable != status) { if (ret_trace->enable == 1) trace_enabled_count--; else trace_enabled_count++; } ret_trace->enable = status; } } hash_free_keys(keys); } PROFILER_ROUT(__FILE__, __FUNCTION__, __LINE__, 0); }