lttng::utils::container_of(head, &ust_app_session::rcu_head);
lttng_ht_destroy(ua_sess->channels);
- free(ua_sess);
+ delete (ua_sess);
}
/*
struct ust_app_session *ua_sess;
/* Init most of the default value by allocating and zeroing */
- ua_sess = zmalloc<ust_app_session>();
+ ua_sess = new ust_app_session();
if (ua_sess == NULL) {
PERROR("malloc");
goto error_free;
}
- ua_sess->handle = -1;
- ua_sess->channels = lttng_ht_new(0, LTTNG_HT_TYPE_STRING);
ua_sess->metadata_attr.type = LTTNG_UST_ABI_CHAN_METADATA;
pthread_mutex_init(&ua_sess->lock, NULL);
*/
pthread_mutex_t lock;
- int enabled;
+ int enabled{};
/* started: has the session been in started state at any time ? */
- int started; /* allows detection of start vs restart. */
- int handle; /* used has unique identifier for app session */
+ int started{}; /* allows detection of start vs restart. */
+ int handle{-1}; /* used has unique identifier for app session */
- bool deleted; /* Session deleted flag. Check with lock held. */
+ bool deleted{false}; /* Session deleted flag. Check with lock held. */
/*
* Tracing session ID. Multiple ust app session can have the same tracing
* session id making this value NOT unique to the object.
*/
- uint64_t tracing_id;
- uint64_t id; /* Unique session identifier */
- struct lttng_ht *channels; /* Registered channels */
- struct lttng_ht_node_u64 node;
+ uint64_t tracing_id{};
+ uint64_t id{}; /* Unique session identifier */
+ struct lttng_ht *channels{lttng_ht_new(0, LTTNG_HT_TYPE_STRING)}; /* Registered channels */
+ struct lttng_ht_node_u64 node {};
/*
* Node indexed by UST session object descriptor (handle). Stored in the
* ust_sessions_objd hash table in the ust_app object.
*/
struct lttng_ht_node_ulong ust_objd_node;
/* Starts with 'ust'; no leading slash. */
- char path[PATH_MAX];
+ char path[PATH_MAX]{};
/* UID/GID of the application owning the session */
struct lttng_credentials real_credentials;
/* Effective UID and GID. Same as the tracing session. */
* Once at least *one* session is created onto the application, the
* corresponding consumer is set so we can use it on unregistration.
*/
- struct consumer_output *consumer;
- enum lttng_buffer_type buffer_type;
+ struct consumer_output *consumer{nullptr};
+ enum lttng_buffer_type buffer_type { LTTNG_BUFFER_PER_PID };
/* ABI of the session. Same value as the application. */
- uint32_t bits_per_long;
+ uint32_t bits_per_long{};
/* For delayed reclaim */
- struct rcu_head rcu_head;
+ struct rcu_head rcu_head {};
/* If the channel's streams have to be outputed or not. */
- unsigned int output_traces;
- unsigned int live_timer_interval; /* usec */
+ unsigned int output_traces{};
+ unsigned int live_timer_interval{}; /* usec */
/* Metadata channel attributes. */
- struct lttng_ust_ctl_consumer_channel_attr metadata_attr;
+ struct lttng_ust_ctl_consumer_channel_attr metadata_attr {};
- char root_shm_path[PATH_MAX];
- char shm_path[PATH_MAX];
+ char root_shm_path[PATH_MAX]{};
+ char shm_path[PATH_MAX]{};
};
/*