#include <urcu/compiler.h>
#include <pthread.h>
-#include <common/error.h>
-#include <common/hashtable/hashtable.h>
-#include <common/index-allocator.h>
-#include <common/kernel-ctl/kernel-ctl.h>
-#include <common/shm.h>
-#include <lttng/trigger/trigger-internal.h>
+#include <common/error.hpp>
+#include <common/hashtable/hashtable.hpp>
+#include <common/index-allocator.hpp>
+#include <common/kernel-ctl/kernel-ctl.hpp>
+#include <common/shm.hpp>
+#include <lttng/trigger/trigger-internal.hpp>
-#include "event-notifier-error-accounting.h"
-#include "lttng-ust-error.h"
-#include "ust-app.h"
+#include "event-notifier-error-accounting.hpp"
+#include "lttng-ust-error.hpp"
+#include "ust-app.hpp"
#define ERROR_COUNTER_INDEX_HT_INITIAL_SIZE 16
goto error;
}
- entry = (ust_error_accounting_entry *) zmalloc(sizeof(struct ust_error_accounting_entry));
+ entry = zmalloc<ust_error_accounting_entry>();
if (!entry) {
PERROR("Failed to allocate event notifier error acounting entry")
goto error;
entry->uid = app->uid;
entry->nr_counter_cpu_fds = lttng_ust_ctl_get_nr_cpu_per_counter();
- cpu_counter_fds = (int *) zmalloc(entry->nr_counter_cpu_fds * sizeof(*cpu_counter_fds));
+ cpu_counter_fds = calloc<int>(entry->nr_counter_cpu_fds);
if (!cpu_counter_fds) {
PERROR("Failed to allocate event notifier error counter file descriptors array: application uid = %d, application name = '%s', pid = %d, allocation size = %zu",
(int) app->uid, app->name, (int) app->pid,
cpu_counter_fds[i] = -1;
}
- cpu_counters = (lttng_ust_abi_object_data **) zmalloc(entry->nr_counter_cpu_fds * sizeof(struct lttng_ust_abi_object_data *));
+ cpu_counters = calloc<lttng_ust_abi_object_data *>(entry->nr_counter_cpu_fds);
if (!cpu_counters) {
PERROR("Failed to allocate event notifier error counter lttng_ust_abi_object_data array: application uid = %d, application name = '%s', pid = %d, allocation size = %zu",
(int) app->uid, app->name, (int) app->pid,
goto error_send_counter_data;
}
- cpu_counters = (lttng_ust_abi_object_data **) zmalloc(entry->nr_counter_cpu_fds * sizeof(struct lttng_ust_abi_object_data *));
+ cpu_counters = calloc<lttng_ust_abi_object_data *>(entry->nr_counter_cpu_fds);
if (!cpu_counters) {
PERROR("Failed to allocate event notifier error counter lttng_ust_abi_object_data array: application uid = %d, application name = '%s', pid = %d, allocation size = %zu",
(int) app->uid, app->name, (int) app->pid,
goto end;
}
- index_entry = (index_ht_entry *) zmalloc(sizeof(*index_entry));
+ index_entry = zmalloc<index_ht_entry>();
if (index_entry == NULL) {
PERROR("Failed to allocate event notifier error counter hash table entry");
status = EVENT_NOTIFIER_ERROR_ACCOUNTING_STATUS_NOMEM;
trigger_name, trigger_owner_uid);
goto end;
}
- /* fall-through. */
}
+ /* fall-through. */
case EVENT_NOTIFIER_ERROR_ACCOUNTING_STATUS_OK:
*error_counter_index = local_error_counter_index;
status = EVENT_NOTIFIER_ERROR_ACCOUNTING_STATUS_OK;