projects
/
lttng-tools.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Use case-scope error labels when handling LTTNG_CONSUMER_GET_CHANNEL
[lttng-tools.git]
/
src
/
common
/
ust-consumer
/
ust-consumer.c
diff --git
a/src/common/ust-consumer/ust-consumer.c
b/src/common/ust-consumer/ust-consumer.c
index ff9d31d5287a92b29bf6ac16bff0e6a17876d837..b2c454deb54302362806dd80180f9b235f29e33a 100644
(file)
--- a/
src/common/ust-consumer/ust-consumer.c
+++ b/
src/common/ust-consumer/ust-consumer.c
@@
-519,7
+519,8
@@
error_open:
if (channel->root_shm_path[0]) {
(void) run_as_rmdir_recursive(channel->root_shm_path,
channel->buffer_credentials.value.uid,
if (channel->root_shm_path[0]) {
(void) run_as_rmdir_recursive(channel->root_shm_path,
channel->buffer_credentials.value.uid,
- channel->buffer_credentials.value.gid);
+ channel->buffer_credentials.value.gid,
+ LTTNG_DIRECTORY_HANDLE_SKIP_NON_EMPTY_FLAG);
}
free(stream_fds);
error_alloc:
}
free(stream_fds);
error_alloc:
@@
-1590,7
+1591,7
@@
int lttng_ustconsumer_recv_cmd(struct lttng_consumer_local_data *ctx,
if (!channel) {
ERR("UST consumer get channel key %" PRIu64 " not found", key);
ret_code = LTTCOMM_CONSUMERD_CHAN_NOT_FOUND;
if (!channel) {
ERR("UST consumer get channel key %" PRIu64 " not found", key);
ret_code = LTTCOMM_CONSUMERD_CHAN_NOT_FOUND;
- goto end_
msg_sessiond
;
+ goto end_
get_channel
;
}
health_code_update();
}
health_code_update();
@@
-1606,13
+1607,13
@@
int lttng_ustconsumer_recv_cmd(struct lttng_consumer_local_data *ctx,
* and the consumer can continue its work. The above call
* has sent the error status message to the sessiond.
*/
* and the consumer can continue its work. The above call
* has sent the error status message to the sessiond.
*/
- goto end_nosignal;
+ goto end_
get_channel_
nosignal;
}
/*
* The communicaton was broken hence there is a bad state between
* the consumer and sessiond so stop everything.
*/
}
/*
* The communicaton was broken hence there is a bad state between
* the consumer and sessiond so stop everything.
*/
- goto error_fatal;
+ goto error_
get_channel_
fatal;
}
health_code_update();
}
health_code_update();
@@
-1622,7
+1623,7
@@
int lttng_ustconsumer_recv_cmd(struct lttng_consumer_local_data *ctx,
* so don't send them to the data thread.
*/
if (!channel->monitor) {
* so don't send them to the data thread.
*/
if (!channel->monitor) {
- goto end_
msg_sessiond
;
+ goto end_
get_channel
;
}
ret = send_streams_to_thread(channel, ctx);
}
ret = send_streams_to_thread(channel, ctx);
@@
-1631,11
+1632,16
@@
int lttng_ustconsumer_recv_cmd(struct lttng_consumer_local_data *ctx,
* If we are unable to send the stream to the thread, there is
* a big problem so just stop everything.
*/
* If we are unable to send the stream to the thread, there is
* a big problem so just stop everything.
*/
- goto error_fatal;
+ goto error_
get_channel_
fatal;
}
/* List MUST be empty after or else it could be reused. */
assert(cds_list_empty(&channel->streams.head));
}
/* List MUST be empty after or else it could be reused. */
assert(cds_list_empty(&channel->streams.head));
+end_get_channel:
goto end_msg_sessiond;
goto end_msg_sessiond;
+error_get_channel_fatal:
+ goto error_fatal;
+end_get_channel_nosignal:
+ goto end_nosignal;
}
case LTTNG_CONSUMER_DESTROY_CHANNEL:
{
}
case LTTNG_CONSUMER_DESTROY_CHANNEL:
{
@@
-2008,8
+2014,8
@@
int lttng_ustconsumer_recv_cmd(struct lttng_consumer_local_data *ctx,
case LTTNG_CONSUMER_CREATE_TRACE_CHUNK:
{
const struct lttng_credentials credentials = {
case LTTNG_CONSUMER_CREATE_TRACE_CHUNK:
{
const struct lttng_credentials credentials = {
- .uid = msg.u.create_trace_chunk.credentials.uid,
- .gid = msg.u.create_trace_chunk.credentials.gid,
+ .uid = msg.u.create_trace_chunk.credentials.
value.
uid,
+ .gid = msg.u.create_trace_chunk.credentials.
value.
gid,
};
const bool is_local_trace =
!msg.u.create_trace_chunk.relayd_id.is_set;
};
const bool is_local_trace =
!msg.u.create_trace_chunk.relayd_id.is_set;
@@
-2062,9
+2068,12
@@
int lttng_ustconsumer_recv_cmd(struct lttng_consumer_local_data *ctx,
!is_local_trace ? &relayd_id : NULL,
msg.u.create_trace_chunk.session_id,
msg.u.create_trace_chunk.chunk_id,
!is_local_trace ? &relayd_id : NULL,
msg.u.create_trace_chunk.session_id,
msg.u.create_trace_chunk.chunk_id,
- (time_t) msg.u.create_trace_chunk.creation_timestamp,
+ (time_t) msg.u.create_trace_chunk
+ .creation_timestamp,
chunk_override_name,
chunk_override_name,
- &credentials,
+ msg.u.create_trace_chunk.credentials.is_set ?
+ &credentials :
+ NULL,
chunk_directory_handle.is_set ?
&chunk_directory_handle.value :
NULL);
chunk_directory_handle.is_set ?
&chunk_directory_handle.value :
NULL);
@@
-2077,15
+2086,21
@@
int lttng_ustconsumer_recv_cmd(struct lttng_consumer_local_data *ctx,
}
case LTTNG_CONSUMER_CLOSE_TRACE_CHUNK:
{
}
case LTTNG_CONSUMER_CLOSE_TRACE_CHUNK:
{
+ enum lttng_trace_chunk_command_type close_command =
+ msg.u.close_trace_chunk.close_command.value;
const uint64_t relayd_id =
msg.u.close_trace_chunk.relayd_id.value;
ret_code = lttng_consumer_close_trace_chunk(
msg.u.close_trace_chunk.relayd_id.is_set ?
const uint64_t relayd_id =
msg.u.close_trace_chunk.relayd_id.value;
ret_code = lttng_consumer_close_trace_chunk(
msg.u.close_trace_chunk.relayd_id.is_set ?
- &relayd_id : NULL,
+ &relayd_id :
+ NULL,
msg.u.close_trace_chunk.session_id,
msg.u.close_trace_chunk.chunk_id,
msg.u.close_trace_chunk.session_id,
msg.u.close_trace_chunk.chunk_id,
- (time_t) msg.u.close_trace_chunk.close_timestamp);
+ (time_t) msg.u.close_trace_chunk.close_timestamp,
+ msg.u.close_trace_chunk.close_command.is_set ?
+ &close_command :
+ NULL);
goto end_msg_sessiond;
}
case LTTNG_CONSUMER_TRACE_CHUNK_EXISTS:
goto end_msg_sessiond;
}
case LTTNG_CONSUMER_TRACE_CHUNK_EXISTS:
@@
-2105,15
+2120,12
@@
int lttng_ustconsumer_recv_cmd(struct lttng_consumer_local_data *ctx,
}
end_nosignal:
}
end_nosignal:
- rcu_read_unlock();
-
- health_code_update();
-
/*
* Return 1 to indicate success since the 0 value can be a socket
* shutdown during the recv() or send() call.
*/
/*
* Return 1 to indicate success since the 0 value can be a socket
* shutdown during the recv() or send() call.
*/
- return 1;
+ ret = 1;
+ goto end;
end_msg_sessiond:
/*
end_msg_sessiond:
/*
@@
-2125,11
+2137,9
@@
end_msg_sessiond:
if (ret < 0) {
goto error_fatal;
}
if (ret < 0) {
goto error_fatal;
}
- rcu_read_unlock();
-
- health_code_update();
+ ret = 1;
+ goto end;
- return 1;
end_channel_error:
if (channel) {
pthread_mutex_unlock(&channel->lock);
end_channel_error:
if (channel) {
pthread_mutex_unlock(&channel->lock);
@@
-2145,15
+2155,18
@@
end_channel_error:
/* Stop everything if session daemon can not be notified. */
goto error_fatal;
}
/* Stop everything if session daemon can not be notified. */
goto error_fatal;
}
- rcu_read_unlock();
-
- health_code_update();
+ ret = 1;
+ goto end;
- return 1;
error_fatal:
error_fatal:
- rcu_read_unlock();
/* This will issue a consumer stop. */
/* This will issue a consumer stop. */
- return -1;
+ ret = -1;
+ goto end;
+
+end:
+ rcu_read_unlock();
+ health_code_update();
+ return ret;
}
/*
}
/*
@@
-2340,7
+2353,8
@@
void lttng_ustconsumer_free_channel(struct lttng_consumer_channel *chan)
if (chan->root_shm_path[0]) {
(void) run_as_rmdir_recursive(chan->root_shm_path,
chan->buffer_credentials.value.uid,
if (chan->root_shm_path[0]) {
(void) run_as_rmdir_recursive(chan->root_shm_path,
chan->buffer_credentials.value.uid,
- chan->buffer_credentials.value.gid);
+ chan->buffer_credentials.value.gid,
+ LTTNG_DIRECTORY_HANDLE_SKIP_NON_EMPTY_FLAG);
}
free(chan->stream_fds);
}
}
free(chan->stream_fds);
}
This page took
0.029004 seconds
and
5
git commands to generate.