projects
/
lttng-tools.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Extend API and remove lttng_uri from lttng.h
[lttng-tools.git]
/
src
/
bin
/
lttng-sessiond
/
ust-consumer.c
diff --git
a/src/bin/lttng-sessiond/ust-consumer.c
b/src/bin/lttng-sessiond/ust-consumer.c
index 5b909ab1594609257f1026f7d246c39f43bf8d9c..aabe49403fbc1215d423986cb7dfa71301da2a47 100644
(file)
--- a/
src/bin/lttng-sessiond/ust-consumer.c
+++ b/
src/bin/lttng-sessiond/ust-consumer.c
@@
-117,7
+117,7
@@
error:
/*
* Send all stream fds of UST channel to the consumer.
*/
/*
* Send all stream fds of UST channel to the consumer.
*/
-
int ust_consumer_
send_channel_streams(int sock,
+
static int
send_channel_streams(int sock,
struct ust_app_channel *uchan, struct ust_app_session *usess,
struct consumer_output *consumer)
{
struct ust_app_channel *uchan, struct ust_app_session *usess,
struct consumer_output *consumer)
{
@@
-136,8
+136,8
@@
int ust_consumer_send_channel_streams(int sock,
/* Get the right path name destination */
if (consumer->type == CONSUMER_DST_LOCAL) {
/* Set application path to the destination path */
/* Get the right path name destination */
if (consumer->type == CONSUMER_DST_LOCAL) {
/* Set application path to the destination path */
- ret = snprintf(tmp_path, sizeof(tmp_path), "%s/%s",
- consumer->dst.trace_path, usess->path);
+ ret = snprintf(tmp_path, sizeof(tmp_path), "%s/%s
/%s
",
+ consumer->dst.trace_path,
consumer->subdir,
usess->path);
if (ret < 0) {
PERROR("snprintf stream path");
goto error;
if (ret < 0) {
PERROR("snprintf stream path");
goto error;
@@
-178,7
+178,7
@@
error:
/*
* Sending metadata to the consumer with command ADD_CHANNEL and ADD_STREAM.
*/
/*
* Sending metadata to the consumer with command ADD_CHANNEL and ADD_STREAM.
*/
-
int ust_consumer_
send_metadata(int sock, struct ust_app_session *usess,
+
static int
send_metadata(int sock, struct ust_app_session *usess,
struct consumer_output *consumer)
{
int ret, fd, fds[2];
struct consumer_output *consumer)
{
int ret, fd, fds[2];
@@
-225,8
+225,8
@@
int ust_consumer_send_metadata(int sock, struct ust_app_session *usess,
/* Get correct path name destination */
if (consumer->type == CONSUMER_DST_LOCAL) {
/* Set application path to the destination path */
/* Get correct path name destination */
if (consumer->type == CONSUMER_DST_LOCAL) {
/* Set application path to the destination path */
- ret = snprintf(tmp_path, sizeof(tmp_path), "%s/%s",
- consumer->dst.trace_path, usess->path);
+ ret = snprintf(tmp_path, sizeof(tmp_path), "%s/%s
/%s
",
+ consumer->dst.trace_path,
consumer->subdir,
usess->path);
if (ret < 0) {
PERROR("snprintf stream path");
goto error;
if (ret < 0) {
PERROR("snprintf stream path");
goto error;
@@
-281,23
+281,27
@@
error:
/*
* Send all stream fds of the UST session to the consumer.
*/
/*
* Send all stream fds of the UST session to the consumer.
*/
-int ust_consumer_send_session(
int consumer_fd,
struct ust_app_session *usess,
- struct consumer_output *consumer)
+int ust_consumer_send_session(struct ust_app_session *usess,
+ struct consumer_output *consumer
, struct consumer_socket *sock
)
{
int ret = 0;
{
int ret = 0;
- int sock = consumer_fd;
struct lttng_ht_iter iter;
struct ust_app_channel *ua_chan;
struct lttng_ht_iter iter;
struct ust_app_channel *ua_chan;
-
DBG("Sending metadata stream fd"
);
+
assert(usess
);
- if (consumer_fd < 0) {
- ERR("Consumer has negative file descriptor");
- return -EINVAL;
+ if (consumer == NULL || sock == NULL) {
+ /* There is no consumer so just ignoring the command. */
+ DBG("UST consumer does not exist. Not sending streams");
+ return 0;
}
}
+ DBG("Sending metadata stream fd to consumer on %d", sock->fd);
+
+ pthread_mutex_lock(sock->lock);
+
/* Sending metadata information to the consumer */
/* Sending metadata information to the consumer */
- ret =
ust_consumer_send_metadata(consumer_
fd, usess, consumer);
+ ret =
send_metadata(sock->
fd, usess, consumer);
if (ret < 0) {
goto error;
}
if (ret < 0) {
goto error;
}
@@
-314,7
+318,7
@@
int ust_consumer_send_session(int consumer_fd, struct ust_app_session *usess,
continue;
}
continue;
}
- ret =
ust_consumer_send_channel_streams(sock
, ua_chan, usess, consumer);
+ ret =
send_channel_streams(sock->fd
, ua_chan, usess, consumer);
if (ret < 0) {
rcu_read_unlock();
goto error;
if (ret < 0) {
rcu_read_unlock();
goto error;
@@
-324,8
+328,10
@@
int ust_consumer_send_session(int consumer_fd, struct ust_app_session *usess,
DBG("consumer fds (metadata and channel streams) sent");
DBG("consumer fds (metadata and channel streams) sent");
- return 0;
+ /* All good! */
+ ret = 0;
error:
error:
+ pthread_mutex_unlock(sock->lock);
return ret;
}
return ret;
}
This page took
0.030038 seconds
and
4
git commands to generate.