projects
/
lttng-tools.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Remove unused and empty lib
[lttng-tools.git]
/
ltt-sessiond
/
session.c
diff --git
a/ltt-sessiond/session.c
b/ltt-sessiond/session.c
index ae83e45aec1b7610992772d48b35615a8adb1ba1..c7ce843d71669f3b40609293341dbf8f665a73a1 100644
(file)
--- a/
ltt-sessiond/session.c
+++ b/
ltt-sessiond/session.c
@@
-21,12
+21,16
@@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include <urcu.h>
#include <lttng-sessiond-comm.h>
#include <lttngerr.h>
#include <lttng-sessiond-comm.h>
#include <lttngerr.h>
+#include "hashtable.h"
#include "session.h"
#include "session.h"
+#include "../hashtable/hash.h"
+
/*
* NOTES:
*
/*
* NOTES:
*
@@
-113,29
+117,25
@@
void session_unlock(struct ltt_session *session)
}
/*
}
/*
- * Return a ltt_session structure ptr that matches name.
- * If no session found, NULL is returned.
+ * Return a ltt_session structure ptr that matches name. If no session found,
+ * NULL is returned. This must be called with the session lock held using
+ * session_lock_list and session_unlock_list.
*/
struct ltt_session *session_find_by_name(char *name)
{
*/
struct ltt_session *session_find_by_name(char *name)
{
- int found = 0;
struct ltt_session *iter;
DBG2("Trying to find session by name %s", name);
struct ltt_session *iter;
DBG2("Trying to find session by name %s", name);
- session_lock_list();
cds_list_for_each_entry(iter, <t_session_list.head, list) {
if (strncmp(iter->name, name, NAME_MAX) == 0) {
cds_list_for_each_entry(iter, <t_session_list.head, list) {
if (strncmp(iter->name, name, NAME_MAX) == 0) {
- found = 1;
- break;
+ goto found;
}
}
}
}
- session_unlock_list();
- if (!found) {
- iter = NULL;
- }
+ iter = NULL;
+found:
return iter;
}
return iter;
}
@@
-154,8
+154,6
@@
int session_destroy(struct ltt_session *session)
DBG("Destroying session %s", session->name);
del_session_list(session);
DBG("Destroying session %s", session->name);
del_session_list(session);
- free(session->name);
- free(session->path);
pthread_mutex_destroy(&session->lock);
free(session);
pthread_mutex_destroy(&session->lock);
free(session);
@@
-186,7
+184,7
@@
int session_create(char *name, char *path)
/* Define session name */
if (name != NULL) {
/* Define session name */
if (name != NULL) {
- if (
asprintf(&new_session->name
, "%s", name) < 0) {
+ if (
snprintf(new_session->name, NAME_MAX
, "%s", name) < 0) {
ret = LTTCOMM_FATAL;
goto error_asprintf;
}
ret = LTTCOMM_FATAL;
goto error_asprintf;
}
@@
-198,7
+196,7
@@
int session_create(char *name, char *path)
/* Define session system path */
if (path != NULL) {
/* Define session system path */
if (path != NULL) {
- if (
asprintf(&new_session->path
, "%s", path) < 0) {
+ if (
snprintf(new_session->path, PATH_MAX
, "%s", path) < 0) {
ret = LTTCOMM_FATAL;
goto error_asprintf;
}
ret = LTTCOMM_FATAL;
goto error_asprintf;
}
@@
-210,9
+208,7
@@
int session_create(char *name, char *path)
/* Init kernel session */
new_session->kernel_session = NULL;
/* Init kernel session */
new_session->kernel_session = NULL;
-
- /* Init UST session list */
- CDS_INIT_LIST_HEAD(&new_session->ust_session_list.head);
+ new_session->ust_session = NULL;
/* Init lock */
pthread_mutex_init(&new_session->lock, NULL);
/* Init lock */
pthread_mutex_init(&new_session->lock, NULL);
This page took
0.024782 seconds
and
4
git commands to generate.