X-Git-Url: https://git.liburcu.org/?a=blobdiff_plain;f=src%2Fbin%2Flttng-sessiond%2Frotate.c;h=49ccea94e381fd6ee520162b8c362f310efe7e9e;hb=5c408ad8ef08a226c018702aca969536f36ac4e5;hp=05e9bb08a48ca397710beb720c78ea5e59891df4;hpb=d086f507d02078aed618ab291a0bc4a634958fa3;p=lttng-tools.git diff --git a/src/bin/lttng-sessiond/rotate.c b/src/bin/lttng-sessiond/rotate.c index 05e9bb08a..49ccea94e 100644 --- a/src/bin/lttng-sessiond/rotate.c +++ b/src/bin/lttng-sessiond/rotate.c @@ -50,6 +50,38 @@ unsigned long hash_channel_key(struct rotation_channel_key *key) (void *) (unsigned long) key->domain, lttng_ht_seed); } +int rotate_add_channel_pending(uint64_t key, enum lttng_domain_type domain, + struct ltt_session *session) +{ + int ret; + struct rotation_channel_info *new_info; + struct rotation_channel_key channel_key = { .key = key, + .domain = domain }; + + new_info = zmalloc(sizeof(struct rotation_channel_info)); + if (!new_info) { + goto error; + } + + new_info->channel_key.key = key; + new_info->channel_key.domain = domain; + new_info->session_id = session->id; + cds_lfht_node_init(&new_info->rotate_channels_ht_node); + + session->nr_chan_rotate_pending++; + cds_lfht_add(channel_pending_rotate_ht, + hash_channel_key(&channel_key), + &new_info->rotate_channels_ht_node); + + ret = 0; + goto end; + +error: + ret = -1; +end: + return ret; +} + /* The session's lock must be held by the caller. */ static int session_rename_chunk(struct ltt_session *session, char *current_path,