{
int ret;
char *cmd;
- struct ltt_session *sess;
+ struct ltt_session *sess, *stmp;
DBG("Cleaning up");
pthread_mutex_destroy(&session_list_ptr->lock);
/* Cleanup ALL session */
- cds_list_for_each_entry(sess, &session_list_ptr->head, list) {
+ cds_list_for_each_entry_safe(sess, stmp, &session_list_ptr->head, list) {
teardown_kernel_session(sess);
// TODO complete session cleanup (including UST)
}
int destroy_session(char *name)
{
int found = -1;
- struct ltt_session *iter;
+ struct ltt_session *iter, *tmp;
lock_session_list();
- cds_list_for_each_entry(iter, <t_session_list.head, list) {
+ cds_list_for_each_entry_safe(iter, tmp, <t_session_list.head, list) {
if (strcmp(iter->name, name) == 0) {
DBG("Destroying session %s", iter->name);
del_session_list(iter);
void trace_destroy_kernel_channel(struct ltt_kernel_channel *channel)
{
- struct ltt_kernel_stream *stream;
- struct ltt_kernel_event *event;
+ struct ltt_kernel_stream *stream, *stmp;
+ struct ltt_kernel_event *event, *etmp;
DBG("[trace] Closing channel fd %d", channel->fd);
/* Close kernel fd */
free(channel->channel);
/* For each stream in the channel list */
- cds_list_for_each_entry(stream, &channel->stream_list.head, list) {
+ cds_list_for_each_entry_safe(stream, stmp, &channel->stream_list.head, list) {
trace_destroy_kernel_stream(stream);
}
/* For each event in the channel list */
- cds_list_for_each_entry(event, &channel->events_list.head, list) {
+ cds_list_for_each_entry_safe(event, etmp, &channel->events_list.head, list) {
trace_destroy_kernel_event(event);
}
void trace_destroy_kernel_session(struct ltt_kernel_session *session)
{
- struct ltt_kernel_channel *channel;
+ struct ltt_kernel_channel *channel, *ctmp;
DBG("[trace] Closing session fd %d", session->fd);
/* Close kernel fds */
trace_destroy_kernel_metadata(session->metadata);
}
- cds_list_for_each_entry(channel, &session->channel_list.head, list) {
+ cds_list_for_each_entry_safe(channel, ctmp, &session->channel_list.head, list) {
trace_destroy_kernel_channel(channel);
}