projects
/
lttng-tools.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Add context exist error code
[lttng-tools.git]
/
lttng-sessiond
/
main.c
diff --git
a/lttng-sessiond/main.c
b/lttng-sessiond/main.c
index 0a78f27bad9e9e6f85ad9e86008030464b924a39..ff096e1b90db47940a5c11092e785fd7b67724f9 100644
(file)
--- a/
lttng-sessiond/main.c
+++ b/
lttng-sessiond/main.c
@@
-50,7
+50,7
@@
#include "event.h"
#include "futex.h"
#include "hashtable.h"
#include "event.h"
#include "futex.h"
#include "hashtable.h"
-#include "kernel
-ctl
.h"
+#include "kernel.h"
#include "lttng-sessiond.h"
#include "shm.h"
#include "ust-app.h"
#include "lttng-sessiond.h"
#include "shm.h"
#include "ust-app.h"
@@
-1532,7
+1532,7
@@
static pid_t spawn_consumerd(struct consumer_data *consumer_data)
break;
case LTTNG_CONSUMER64_UST:
{
break;
case LTTNG_CONSUMER64_UST:
{
- char *tmpnew;
+ char *tmpnew
= NULL
;
if (consumerd64_libdir[0] != '\0') {
char *tmp;
if (consumerd64_libdir[0] != '\0') {
char *tmp;
@@
-1575,7
+1575,7
@@
static pid_t spawn_consumerd(struct consumer_data *consumer_data)
}
case LTTNG_CONSUMER32_UST:
{
}
case LTTNG_CONSUMER32_UST:
{
- char *tmpnew;
+ char *tmpnew
= NULL
;
if (consumerd32_libdir[0] != '\0') {
char *tmp;
if (consumerd32_libdir[0] != '\0') {
char *tmp;
@@
-2191,7
+2191,13
@@
static int cmd_disable_channel(struct ltt_session *session,
goto error;
}
goto error;
}
- ret = ust_app_disable_channel_all(usess, uchan);
+ /* Already disabled */
+ if (!uchan->enabled) {
+ DBG2("UST channel %s already disabled", channel_name);
+ break;
+ }
+
+ ret = ust_app_disable_channel_glb(usess, uchan);
if (ret < 0) {
ret = LTTCOMM_UST_DISABLE_FAIL;
goto error;
if (ret < 0) {
ret = LTTCOMM_UST_DISABLE_FAIL;
goto error;
@@
-2299,28
+2305,32
@@
static int cmd_enable_channel(struct ltt_session *session,
goto error;
}
goto error;
}
- rcu_read_lock();
- hashtable_add_unique(usess->domain_global.channels, &uchan->node);
- rcu_read_unlock();
- DBG2("UST channel %s added to global domain HT", attr->name);
-
/* Add channel to all registered applications */
/* Add channel to all registered applications */
- ret = ust_app_create_channel_
all
(usess, uchan);
+ ret = ust_app_create_channel_
glb
(usess, uchan);
if (ret != 0) {
ret = LTTCOMM_UST_CHAN_FAIL;
goto error;
}
if (ret != 0) {
ret = LTTCOMM_UST_CHAN_FAIL;
goto error;
}
+
+ rcu_read_lock();
+ hashtable_add_unique(usess->domain_global.channels, &uchan->node);
+ rcu_read_unlock();
+
+ DBG2("UST channel %s added to global domain HT", attr->name);
} else {
/* If already enabled, everything is OK */
if (uchan->enabled) {
} else {
/* If already enabled, everything is OK */
if (uchan->enabled) {
- ret = LTTCOMM_OK;
- goto error;
+ break;
}
}
- ret = ust_app_enable_channel_
all
(usess, uchan);
+ ret = ust_app_enable_channel_
glb
(usess, uchan);
if (ret < 0) {
if (ret < 0) {
- ret = LTTCOMM_UST_ENABLE_FAIL;
- goto error;
+ if (ret != -EEXIST) {
+ ret = LTTCOMM_UST_CHAN_ENABLE_FAIL;
+ goto error;
+ } else {
+ ret = LTTCOMM_OK;
+ }
}
}
}
}
@@
-2378,6
+2388,7
@@
static int cmd_disable_event(struct ltt_session *session, int domain,
{
struct ltt_ust_session *usess;
struct ltt_ust_channel *uchan;
{
struct ltt_ust_session *usess;
struct ltt_ust_channel *uchan;
+ struct ltt_ust_event *uevent;
usess = session->ust_session;
usess = session->ust_session;
@@
-2388,12
+2399,20
@@
static int cmd_disable_event(struct ltt_session *session, int domain,
goto error;
}
goto error;
}
- ret = ust_app_disable_event(usess, uchan, event_name);
+ uevent = trace_ust_find_event_by_name(uchan->events, event_name);
+ if (uevent == NULL) {
+ ret = LTTCOMM_UST_EVENT_NOT_FOUND;
+ goto error;
+ }
+
+ ret = ust_app_disable_event_glb(usess, uchan, uevent);
if (ret < 0) {
ret = LTTCOMM_UST_DISABLE_FAIL;
goto error;
}
if (ret < 0) {
ret = LTTCOMM_UST_DISABLE_FAIL;
goto error;
}
+ uevent->enabled = 0;
+
DBG2("Disable UST event %s in channel %s completed", event_name,
channel_name);
DBG2("Disable UST event %s in channel %s completed", event_name,
channel_name);
@@
-2457,7
+2476,7
@@
static int cmd_disable_event_all(struct ltt_session *session, int domain,
goto error;
}
goto error;
}
- ret = ust_app_disable_
event_all
(usess, uchan);
+ ret = ust_app_disable_
all_event_glb
(usess, uchan);
if (ret < 0) {
ret = LTTCOMM_UST_DISABLE_FAIL;
goto error;
if (ret < 0) {
ret = LTTCOMM_UST_DISABLE_FAIL;
goto error;
@@
-2580,10
+2599,10
@@
static int cmd_enable_event(struct ltt_session *session, int domain,
}
case LTTNG_DOMAIN_UST:
{
}
case LTTNG_DOMAIN_UST:
{
- struct ltt_ust_channel *uchan;
- struct ltt_ust_event *uevent;
struct lttng_channel *attr;
struct lttng_channel *attr;
+ struct ltt_ust_channel *uchan;
+ /* Get channel from global UST domain */
uchan = trace_ust_find_channel_by_name(usess->domain_global.channels,
channel_name);
if (uchan == NULL) {
uchan = trace_ust_find_channel_by_name(usess->domain_global.channels,
channel_name);
if (uchan == NULL) {
@@
-2594,14
+2613,14
@@
static int cmd_enable_event(struct ltt_session *session, int domain,
goto error;
}
snprintf(attr->name, NAME_MAX, "%s", channel_name);
goto error;
}
snprintf(attr->name, NAME_MAX, "%s", channel_name);
+ attr->name[NAME_MAX - 1] = '\0';
/* Use the internal command enable channel */
ret = cmd_enable_channel(session, domain, attr);
/* Use the internal command enable channel */
ret = cmd_enable_channel(session, domain, attr);
- if (ret
< 0
) {
+ if (ret
!= LTTCOMM_OK
) {
free(attr);
goto error;
}
free(attr);
goto error;
}
-
free(attr);
/* Get the newly created channel reference back */
free(attr);
/* Get the newly created channel reference back */
@@
-2614,31
+2633,12
@@
static int cmd_enable_event(struct ltt_session *session, int domain,
}
}
}
}
- uevent = trace_ust_find_event_by_name(uchan->events, event->name);
- if (uevent == NULL) {
- uevent = trace_ust_create_event(event);
- if (uevent == NULL) {
- ret = LTTCOMM_FATAL;
- goto error;
- }
-
- }
+ /* At this point, the session and channel exist on the tracer */
- ret = ust_app_create_event_all(usess, uchan, uevent);
- if (ret < 0) {
- ret = LTTCOMM_UST_ENABLE_FAIL;
+ ret = event_ust_enable_tracepoint(usess, domain, uchan, event);
+ if (ret != LTTCOMM_OK) {
goto error;
}
goto error;
}
-
- /* Add ltt ust event to channel */
- rcu_read_lock();
- hashtable_add_unique(uchan->events, &uevent->node);
- rcu_read_unlock();
-
- uevent->enabled = 1;
-
- DBG3("UST ltt event %s added to channel %s", uevent->attr.name,
- uchan->name);
break;
}
case LTTNG_DOMAIN_UST_EXEC_NAME:
break;
}
case LTTNG_DOMAIN_UST_EXEC_NAME:
This page took
0.026482 seconds
and
4
git commands to generate.