projects
/
lttng-tools.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Clean-up: sessiond: rename public accessors
[lttng-tools.git]
/
src
/
bin
/
lttng-sessiond
/
manage-consumer.cpp
diff --git
a/src/bin/lttng-sessiond/manage-consumer.cpp
b/src/bin/lttng-sessiond/manage-consumer.cpp
index cce48526e681309de3cb17bc0ea111b83abcba54..ae1529e9be5a76c851db52a8aad28e0d5cfd5b7f 100644
(file)
--- a/
src/bin/lttng-sessiond/manage-consumer.cpp
+++ b/
src/bin/lttng-sessiond/manage-consumer.cpp
@@
-9,22
+9,24
@@
#include <signal.h>
#include <signal.h>
-#include <common/pipe.h>
-#include <common/utils.h>
+#include <common/pipe.h
pp
>
+#include <common/utils.h
pp
>
-#include "manage-consumer.h"
-#include "testpoint.h"
-#include "health-sessiond.h"
-#include "utils.h"
-#include "thread.h"
-#include "ust-consumer.h"
+#include "manage-consumer.h
pp
"
+#include "testpoint.h
pp
"
+#include "health-sessiond.h
pp
"
+#include "utils.h
pp
"
+#include "thread.h
pp
"
+#include "ust-consumer.h
pp
"
+namespace {
struct thread_notifiers {
struct lttng_pipe *quit_pipe;
struct consumer_data *consumer_data;
sem_t ready;
int initialization_result;
};
struct thread_notifiers {
struct lttng_pipe *quit_pipe;
struct consumer_data *consumer_data;
sem_t ready;
int initialization_result;
};
+} /* namespace */
static void mark_thread_as_ready(struct thread_notifiers *notifiers)
{
static void mark_thread_as_ready(struct thread_notifiers *notifiers)
{
@@
-53,13
+55,13
@@
static void wait_until_thread_is_ready(struct thread_notifiers *notifiers)
*/
static void *thread_consumer_management(void *data)
{
*/
static void *thread_consumer_management(void *data)
{
- int sock = -1, i, ret,
pollfd,
err = -1, should_quit = 0;
- uint32_t
revents,
nb_fd;
+ int sock = -1, i, ret, err = -1, should_quit = 0;
+ uint32_t nb_fd;
enum lttcomm_return_code code;
struct lttng_poll_event events;
struct thread_notifiers *notifiers = (thread_notifiers *) data;
struct consumer_data *consumer_data = notifiers->consumer_data;
enum lttcomm_return_code code;
struct lttng_poll_event events;
struct thread_notifiers *notifiers = (thread_notifiers *) data;
struct consumer_data *consumer_data = notifiers->consumer_data;
- const
int quit_pipe_read
_fd = lttng_pipe_get_readfd(notifiers->quit_pipe);
+ const
auto thread_quit_pipe
_fd = lttng_pipe_get_readfd(notifiers->quit_pipe);
struct consumer_socket *cmd_socket_wrapper = NULL;
DBG("[thread] Manage consumer started");
struct consumer_socket *cmd_socket_wrapper = NULL;
DBG("[thread] Manage consumer started");
@@
-81,7
+83,7
@@
static void *thread_consumer_management(void *data)
goto error_poll;
}
goto error_poll;
}
- ret = lttng_poll_add(&events,
quit_pipe_read_fd, LPOLLIN | LPOLLERR
);
+ ret = lttng_poll_add(&events,
thread_quit_pipe_fd, LPOLLIN
);
if (ret < 0) {
mark_thread_intialization_as_failed(notifiers);
goto error;
if (ret < 0) {
mark_thread_intialization_as_failed(notifiers);
goto error;
@@
-119,13
+121,14
@@
static void *thread_consumer_management(void *data)
for (i = 0; i < nb_fd; i++) {
/* Fetch once the poll data */
for (i = 0; i < nb_fd; i++) {
/* Fetch once the poll data */
- revents = LTTNG_POLL_GETEV(&events, i);
- pollfd = LTTNG_POLL_GETFD(&events, i);
+
const auto
revents = LTTNG_POLL_GETEV(&events, i);
+
const auto
pollfd = LTTNG_POLL_GETFD(&events, i);
health_code_update();
health_code_update();
- /* Thread quit pipe has been closed. Killing thread. */
- if (pollfd == quit_pipe_read_fd) {
+ /* Activity on thread quit pipe, exiting. */
+ if (pollfd == thread_quit_pipe_fd) {
+ DBG("Activity on thread quit pipe");
err = 0;
mark_thread_intialization_as_failed(notifiers);
goto exit;
err = 0;
mark_thread_intialization_as_failed(notifiers);
goto exit;
@@
-193,7
+196,7
@@
static void *thread_consumer_management(void *data)
consumer_data->metadata_sock.fd_ptr = &consumer_data->metadata_fd;
/* Create metadata socket lock. */
consumer_data->metadata_sock.fd_ptr = &consumer_data->metadata_fd;
/* Create metadata socket lock. */
- consumer_data->metadata_sock.lock =
(pthread_mutex_t *) zmalloc(sizeof(pthread_mutex_t)
);
+ consumer_data->metadata_sock.lock =
zmalloc<pthread_mutex_t>(
);
if (consumer_data->metadata_sock.lock == NULL) {
PERROR("zmalloc pthread mutex");
mark_thread_intialization_as_failed(notifiers);
if (consumer_data->metadata_sock.lock == NULL) {
PERROR("zmalloc pthread mutex");
mark_thread_intialization_as_failed(notifiers);
@@
-288,8
+291,8
@@
static void *thread_consumer_management(void *data)
for (i = 0; i < nb_fd; i++) {
/* Fetch once the poll data */
for (i = 0; i < nb_fd; i++) {
/* Fetch once the poll data */
- revents = LTTNG_POLL_GETEV(&events, i);
- pollfd = LTTNG_POLL_GETFD(&events, i);
+
const auto
revents = LTTNG_POLL_GETEV(&events, i);
+
const auto
pollfd = LTTNG_POLL_GETFD(&events, i);
health_code_update();
health_code_update();
@@
-298,7
+301,7
@@
static void *thread_consumer_management(void *data)
* but continue the current loop to handle potential data from
* consumer.
*/
* but continue the current loop to handle potential data from
* consumer.
*/
- if (pollfd ==
quit_pipe_read
_fd) {
+ if (pollfd ==
thread_quit_pipe
_fd) {
should_quit = 1;
} else if (pollfd == sock) {
/* Event on the consumerd socket */
should_quit = 1;
} else if (pollfd == sock) {
/* Event on the consumerd socket */
@@
-437,7
+440,7
@@
bool launch_consumer_management_thread(struct consumer_data *consumer_data)
struct thread_notifiers *notifiers = NULL;
struct lttng_thread *thread;
struct thread_notifiers *notifiers = NULL;
struct lttng_thread *thread;
- notifiers =
(thread_notifiers *) zmalloc(sizeof(*notifiers)
);
+ notifiers =
zmalloc<thread_notifiers>(
);
if (!notifiers) {
goto error_alloc;
}
if (!notifiers) {
goto error_alloc;
}
This page took
0.026043 seconds
and
4
git commands to generate.