static struct ltt_session_list ltt_session_list = {
.head = CDS_LIST_HEAD_INIT(ltt_session_list.head),
.lock = PTHREAD_MUTEX_INITIALIZER,
- .count = 0,
+ .next_uuid = 0,
};
/*
static unsigned int add_session_list(struct ltt_session *ls)
{
cds_list_add(&ls->list, <t_session_list.head);
- return ++ltt_session_list.count;
+ return ltt_session_list.next_uuid++;
}
/*
static void del_session_list(struct ltt_session *ls)
{
cds_list_del(&ls->list);
- /* Sanity check */
- if (ltt_session_list.count > 0) {
- ltt_session_list.count--;
- }
}
/*
int ret;
struct ltt_session *new_session;
- new_session = session_find_by_name(name);
- if (new_session != NULL) {
- ret = LTTCOMM_EXIST_SESS;
- goto error_exist;
- }
-
/* Allocate session data structure */
new_session = zmalloc(sizeof(struct ltt_session));
if (new_session == NULL) {
new_session->uid = uid;
new_session->gid = gid;
- ret = run_as_mkdir_recursive(new_session->path, S_IRWXU | S_IRWXG,
- new_session->uid, new_session->gid);
- if (ret < 0) {
- if (ret != -EEXIST) {
- ERR("Trace directory creation error");
- ret = LTTCOMM_CREATE_DIR_FAIL;
- goto error;
+ /* Mkdir if we have a valid path length */
+ if (strlen(new_session->path) > 0) {
+ ret = run_as_mkdir_recursive(new_session->path, S_IRWXU | S_IRWXG,
+ new_session->uid, new_session->gid);
+ if (ret < 0) {
+ if (ret != -EEXIST) {
+ ERR("Trace directory creation error");
+ ret = LTTCOMM_CREATE_DIR_FAIL;
+ goto error;
+ }
}
}
free(new_session);
}
-error_exist:
error_malloc:
return ret;
}