end:
cds_list_add_tail(&ctx->list, &chan->ctx_list);
ctx->in_list = true;
- ctx = NULL;
+ ctx = nullptr;
error:
if (ctx) {
trace_kernel_destroy_context(ctx);
/* Allocate data structure */
lks = trace_kernel_create_session();
- if (lks == NULL) {
+ if (lks == nullptr) {
ret = -1;
goto error;
}
/* Allocate kernel channel */
lkc = trace_kernel_create_channel(chan);
- if (lkc == NULL) {
+ if (lkc == nullptr) {
goto error;
}
{
int fd;
int ret = 0;
- const char *symbol = NULL;
- const struct lttng_userspace_probe_location_lookup_method *lookup = NULL;
+ const char *symbol = nullptr;
+ const struct lttng_userspace_probe_location_lookup_method *lookup = nullptr;
enum lttng_userspace_probe_location_lookup_method_type lookup_method_type;
LTTNG_ASSERT(lttng_userspace_probe_location_get_type(probe_location) ==
uint32_t *offsets_count)
{
enum lttng_userspace_probe_location_lookup_method_type lookup_method_type;
- const struct lttng_userspace_probe_location_lookup_method *lookup = NULL;
- const char *probe_name = NULL, *provider_name = NULL;
+ const struct lttng_userspace_probe_location_lookup_method *lookup = nullptr;
+ const char *probe_name = nullptr, *provider_name = nullptr;
int ret = 0;
int fd, i;
gid_t gid,
int fd)
{
- const struct lttng_userspace_probe_location_lookup_method *lookup_method = NULL;
+ const struct lttng_userspace_probe_location_lookup_method *lookup_method = nullptr;
enum lttng_userspace_probe_location_lookup_method_type type;
int ret;
case LTTNG_USERSPACE_PROBE_LOCATION_LOOKUP_METHOD_TYPE_TRACEPOINT_SDT:
{
int i;
- uint64_t *offsets = NULL;
+ uint64_t *offsets = nullptr;
uint32_t offsets_count;
struct lttng_kernel_abi_event_callsite callsite;
int fd)
{
int ret;
- const struct lttng_userspace_probe_location *location = NULL;
+ const struct lttng_userspace_probe_location *location = nullptr;
LTTNG_ASSERT(ev);
LTTNG_ASSERT(ev->type == LTTNG_EVENT_USERSPACE_PROBE);
int ret;
enum lttng_event_rule_status status;
enum lttng_event_rule_type event_rule_type;
- const struct lttng_userspace_probe_location *location = NULL;
+ const struct lttng_userspace_probe_location *location = nullptr;
LTTNG_ASSERT(rule);
LTTNG_ASSERT(creds);
case LTTNG_PROCESS_ATTR_VIRTUAL_GROUP_ID:
return session->tracker_vgid;
default:
- return NULL;
+ return nullptr;
}
}
int kernel_open_metadata(struct ltt_kernel_session *session)
{
int ret;
- struct ltt_kernel_metadata *lkm = NULL;
+ struct ltt_kernel_metadata *lkm = nullptr;
LTTNG_ASSERT(session);
/* Allocate kernel metadata */
lkm = trace_kernel_create_metadata();
- if (lkm == NULL) {
+ if (lkm == nullptr) {
goto error;
}
/*
* Make a kernel wait to make sure in-flight probe have completed.
*/
-void kernel_wait_quiescent(void)
+void kernel_wait_quiescent()
{
int ret;
int fd = kernel_tracer_fd;
while ((ret = kernctl_create_stream(channel->fd)) >= 0) {
lks = trace_kernel_create_stream(channel->channel->name, channel->stream_count);
- if (lks == NULL) {
+ if (lks == nullptr) {
ret = close(ret);
if (ret) {
PERROR("close");
}
fp = fdopen(fd, "r");
- if (fp == NULL) {
+ if (fp == nullptr) {
PERROR("kernel tracepoint list fdopen");
goto error_fp;
}
*/
nbmem = KERNEL_EVENT_INIT_LIST_SIZE;
elist = calloc<lttng_event>(nbmem);
- if (elist == NULL) {
+ if (elist == nullptr) {
PERROR("alloc list events");
count = -ENOMEM;
goto end;
DBG("Reallocating event list from %zu to %zu bytes", nbmem, new_nbmem);
new_elist = (lttng_event *) realloc(elist,
new_nbmem * sizeof(struct lttng_event));
- if (new_elist == NULL) {
+ if (new_elist == nullptr) {
PERROR("realloc list events");
free(event);
free(elist);
/*
* Kernel work-arounds called at the start of sessiond main().
*/
-int init_kernel_workarounds(void)
+int init_kernel_workarounds()
{
int ret;
FILE *fp;
{
struct lttng_trace_chunk *trace_chunk;
- if (ksess == NULL) {
+ if (ksess == nullptr) {
DBG3("No kernel session when tearing down session");
return;
}
/* Teardown of data required by destroy notifiers. */
void kernel_free_session(struct ltt_kernel_session *ksess)
{
- if (ksess == NULL) {
+ if (ksess == nullptr) {
return;
}
trace_kernel_free_session(ksess);
*/
void kernel_destroy_channel(struct ltt_kernel_channel *kchan)
{
- struct ltt_kernel_session *ksess = NULL;
+ struct ltt_kernel_session *ksess = nullptr;
LTTNG_ASSERT(kchan);
LTTNG_ASSERT(kchan->channel);
struct consumer_socket *socket;
struct lttng_ht_iter iter;
struct ltt_kernel_metadata *saved_metadata;
- char *trace_path = NULL;
+ char *trace_path = nullptr;
size_t consumer_path_offset = 0;
LTTNG_ASSERT(ksess);
* Return 1 on success, 0 when feature is not supported, negative value in case
* of errors.
*/
-int kernel_supports_ring_buffer_snapshot_sample_positions(void)
+int kernel_supports_ring_buffer_snapshot_sample_positions()
{
/*
* RING_BUFFER_SNAPSHOT_SAMPLE_POSITIONS was introduced in 2.3
* Return 1 on success, 0 when feature is not supported, negative value in case
* of errors.
*/
-int kernel_supports_ring_buffer_packet_sequence_number(void)
+int kernel_supports_ring_buffer_packet_sequence_number()
{
/*
* Packet sequence number was introduced in LTTng 2.8,
* Return 1 on success, 0 when feature is not supported, negative value in case
* of errors.
*/
-int kernel_supports_event_notifiers(void)
+int kernel_supports_event_notifiers()
{
/*
* Event notifiers were introduced in LTTng 2.13, lttng-modules ABI 2.6.
/*
* Setup necessary data for kernel tracer action.
*/
-int init_kernel_tracer(void)
+int init_kernel_tracer()
{
int ret;
bool is_root = !getuid();
}
kernel_token_to_event_notifier_rule_ht = cds_lfht_new(
- DEFAULT_HT_SIZE, 1, 0, CDS_LFHT_AUTO_RESIZE | CDS_LFHT_ACCOUNTING, NULL);
+ DEFAULT_HT_SIZE, 1, 0, CDS_LFHT_AUTO_RESIZE | CDS_LFHT_ACCOUNTING, nullptr);
if (!kernel_token_to_event_notifier_rule_ht) {
goto error_token_ht;
}
}
}
-void cleanup_kernel_tracer(void)
+void cleanup_kernel_tracer()
{
DBG2("Closing kernel event notifier group notification file descriptor");
if (kernel_tracer_event_notifier_group_notification_fd >= 0) {
}
if (kernel_token_to_event_notifier_rule_ht) {
- const int ret = cds_lfht_destroy(kernel_token_to_event_notifier_rule_ht, NULL);
+ const int ret = cds_lfht_destroy(kernel_token_to_event_notifier_rule_ht, nullptr);
LTTNG_ASSERT(ret == 0);
}
free(syscall_table);
}
-bool kernel_tracer_is_initialized(void)
+bool kernel_tracer_is_initialized()
{
return kernel_tracer_fd >= 0;
}
struct ltt_kernel_event_notifier_rule *event_notifier_rule;
struct lttng_kernel_abi_event_notifier kernel_event_notifier = {};
unsigned int capture_bytecode_count = 0, i;
- const struct lttng_condition *condition = NULL;
- const struct lttng_event_rule *event_rule = NULL;
+ const struct lttng_condition *condition = nullptr;
+ const struct lttng_event_rule *event_rule = nullptr;
enum lttng_condition_status cond_status;
LTTNG_ASSERT(trigger);
lttng_condition_event_rule_matches_get_capture_bytecode_at_index(condition,
i);
- if (capture_bytecode == NULL) {
+ if (capture_bytecode == nullptr) {
ERR("Unexpected NULL capture bytecode on condition");
error_code_ret = LTTNG_ERR_KERN_ENABLE_FAIL;
goto capture_error;
return error_code_ret;
}
-int kernel_get_notification_fd(void)
+int kernel_get_notification_fd()
{
return kernel_tracer_event_notifier_group_notification_fd;
}