summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
8d5a331)
The POLLHUP and POLLERR flags are only valid in 'revents', they are
implicitly enabled regardless of the fact they were set in 'events' or not.
As such remove those flags from all poll events to reduce possible
confusion as to which flags can be returned by poll.
Change-Id: Id22c78c38257d96dfc47e1337795f13c70dd5f91
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
17 files changed:
}
/* Add thread quit pipe to monitored events. */
}
/* Add thread quit pipe to monitored events. */
- const auto poll_add_ret = lttng_poll_add(events, thread_quit_pipe[0], LPOLLIN | LPOLLERR);
+ const auto poll_add_ret = lttng_poll_add(events, thread_quit_pipe[0], LPOLLIN);
if (poll_add_ret < 0) {
return -1;
}
if (poll_add_ret < 0) {
return -1;
}
goto error_poll_create;
}
goto error_poll_create;
}
- ret = lttng_poll_add(&events, thread_quit_pipe_fd,
- LPOLLIN | LPOLLERR);
+ ret = lttng_poll_add(&events, thread_quit_pipe_fd, LPOLLIN);
if (ret < 0) {
goto error_tcp_socket;
}
if (ret < 0) {
goto error_tcp_socket;
}
mark_thread_as_ready(notifiers);
/* Add TCP socket to the poll set. */
mark_thread_as_ready(notifiers);
/* Add TCP socket to the poll set. */
- ret = lttng_poll_add(&events, reg_sock->fd,
- LPOLLIN | LPOLLERR | LPOLLHUP | LPOLLRDHUP);
+ ret = lttng_poll_add(&events, reg_sock->fd, LPOLLIN | LPOLLRDHUP);
if (ret < 0) {
goto error;
}
if (ret < 0) {
goto error;
}
* read), only add poll error event to only
* detect shutdown.
*/
* read), only add poll error event to only
* detect shutdown.
*/
- ret = lttng_poll_add(&events, new_app_socket_fd,
- LPOLLERR | LPOLLHUP | LPOLLRDHUP);
+ ret = lttng_poll_add(&events, new_app_socket_fd, LPOLLRDHUP);
if (ret < 0) {
agent_destroy_app(new_app);
continue;
if (ret < 0) {
agent_destroy_app(new_app);
continue;
}
/* Add thread quit pipe */
}
/* Add thread quit pipe */
- ret = lttng_poll_add(&events, thread_quit_pipe_fd, LPOLLIN | LPOLLERR);
+ ret = lttng_poll_add(&events, thread_quit_pipe_fd, LPOLLIN);
if (ret < 0) {
goto error;
}
if (ret < 0) {
goto error;
}
cds_list_for_each_entry_safe(wait_node, tmp_wait_node,
&wait_queue->head, head) {
LTTNG_ASSERT(wait_node->app);
cds_list_for_each_entry_safe(wait_node, tmp_wait_node,
&wait_queue->head, head) {
LTTNG_ASSERT(wait_node->app);
- ret = lttng_poll_add(&events, wait_node->app->sock,
- LPOLLHUP | LPOLLERR);
+ ret = lttng_poll_add(&events, wait_node->app->sock, LPOLLIN);
if (ret < 0) {
goto error;
}
if (ret < 0) {
goto error;
}
- ret = lttng_poll_add(&events, thread_quit_pipe_fd, LPOLLIN | LPOLLERR);
+ ret = lttng_poll_add(&events, thread_quit_pipe_fd, LPOLLIN);
if (ret < 0) {
goto error;
}
if (ret < 0) {
goto error;
}
- ret = lttng_poll_add(&events, thread_quit_pipe_fd, LPOLLIN | LPOLLERR);
+ ret = lttng_poll_add(&events, thread_quit_pipe_fd, LPOLLIN);
if (ret < 0) {
goto error;
}
if (ret < 0) {
goto error;
}
* Since this is a command socket (write then read),
* we only monitor the error events of the socket.
*/
* Since this is a command socket (write then read),
* we only monitor the error events of the socket.
*/
- ret = lttng_poll_add(&events, sock,
- LPOLLERR | LPOLLHUP | LPOLLRDHUP);
+ ret = lttng_poll_add(&events, sock, LPOLLRDHUP);
if (ret < 0) {
goto error;
}
if (ret < 0) {
goto error;
}
- ret = lttng_poll_add(&events, thread_quit_pipe_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;
#include "lttng-sessiond.hpp"
#include "kernel.hpp"
#include "lttng-sessiond.hpp"
#include "kernel.hpp"
-#define CLIENT_POLL_EVENTS_IN (LPOLLIN | LPOLLERR | LPOLLHUP | LPOLLRDHUP)
+#define CLIENT_POLL_EVENTS_IN (LPOLLIN | LPOLLRDHUP)
#define CLIENT_POLL_EVENTS_IN_OUT (CLIENT_POLL_EVENTS_IN | LPOLLOUT)
/* The tracers currently limit the capture size to PIPE_BUF (4kb on linux). */
#define CLIENT_POLL_EVENTS_IN_OUT (CLIENT_POLL_EVENTS_IN | LPOLLOUT)
/* The tracers currently limit the capture size to PIPE_BUF (4kb on linux). */
lttng_domain_type_str(domain_type));
/* Adding the read side pipe to the event poll. */
lttng_domain_type_str(domain_type));
/* Adding the read side pipe to the event poll. */
- ret = lttng_poll_add(&state->events, tracer_event_source_fd, LPOLLPRI | LPOLLIN | LPOLLERR);
+ ret = lttng_poll_add(&state->events, tracer_event_source_fd, LPOLLPRI | LPOLLIN);
if (ret < 0) {
ERR("Failed to add tracer event source to poll set: tracer_event_source_fd = %d, domain = '%s'",
tracer_event_source_fd,
if (ret < 0) {
ERR("Failed to add tracer event source to poll set: tracer_event_source_fd = %d, domain = '%s'",
tracer_event_source_fd,
- ret = lttng_poll_add(poll_set, notification_channel_socket,
- LPOLLIN | LPOLLERR | LPOLLHUP | LPOLLRDHUP);
+ ret = lttng_poll_add(poll_set, notification_channel_socket, LPOLLIN | LPOLLRDHUP);
if (ret < 0) {
ERR("Failed to add notification channel socket to pollset");
goto error;
}
if (ret < 0) {
ERR("Failed to add notification channel socket to pollset");
goto error;
}
- ret = lttng_poll_add(poll_set, handle->cmd_queue.event_fd,
- LPOLLIN | LPOLLERR);
+ ret = lttng_poll_add(poll_set, handle->cmd_queue.event_fd, LPOLLIN);
if (ret < 0) {
ERR("Failed to add notification command queue event fd to pollset");
goto error;
}
ret = lttng_poll_add(poll_set,
if (ret < 0) {
ERR("Failed to add notification command queue event fd to pollset");
goto error;
}
ret = lttng_poll_add(poll_set,
- handle->channel_monitoring_pipes.ust32_consumer,
- LPOLLIN | LPOLLERR);
+ handle->channel_monitoring_pipes.ust32_consumer, LPOLLIN);
if (ret < 0) {
ERR("Failed to add ust-32 channel monitoring pipe fd to pollset");
goto error;
}
ret = lttng_poll_add(poll_set,
if (ret < 0) {
ERR("Failed to add ust-32 channel monitoring pipe fd to pollset");
goto error;
}
ret = lttng_poll_add(poll_set,
- handle->channel_monitoring_pipes.ust64_consumer,
- LPOLLIN | LPOLLERR);
+ handle->channel_monitoring_pipes.ust64_consumer, LPOLLIN);
if (ret < 0) {
ERR("Failed to add ust-64 channel monitoring pipe fd to pollset");
goto error;
if (ret < 0) {
ERR("Failed to add ust-64 channel monitoring pipe fd to pollset");
goto error;
goto end;
}
ret = lttng_poll_add(poll_set,
goto end;
}
ret = lttng_poll_add(poll_set,
- handle->channel_monitoring_pipes.kernel_consumer,
- LPOLLIN | LPOLLERR);
+ handle->channel_monitoring_pipes.kernel_consumer, LPOLLIN);
if (ret < 0) {
ERR("Failed to add kernel channel monitoring pipe fd to pollset");
goto error;
if (ret < 0) {
ERR("Failed to add kernel channel monitoring pipe fd to pollset");
goto error;
/* Add notify pipe to the pollset. */
ret = lttng_poll_add(&events, notifiers->apps_cmd_notify_pipe_read_fd,
/* Add notify pipe to the pollset. */
ret = lttng_poll_add(&events, notifiers->apps_cmd_notify_pipe_read_fd,
- LPOLLIN | LPOLLERR | LPOLLHUP | LPOLLRDHUP);
if (ret < 0) {
goto error;
}
if (ret < 0) {
goto error;
}
- ret = lttng_poll_add(&events, thread_quit_pipe_fd,
- LPOLLIN | LPOLLERR);
+ ret = lttng_poll_add(&events, thread_quit_pipe_fd, LPOLLIN);
if (ret < 0) {
goto error;
}
if (ret < 0) {
goto error;
}
- ret = lttng_poll_add(&events, sock,
- LPOLLIN | LPOLLERR | LPOLLHUP | LPOLLRDHUP);
+ ret = lttng_poll_add(&events, sock, LPOLLIN | LPOLLRDHUP);
if (ret < 0) {
/*
* It's possible we've reached the max poll fd allowed.
if (ret < 0) {
/*
* It's possible we've reached the max poll fd allowed.
}
ret = lttng_poll_add(poll_set,
}
ret = lttng_poll_add(poll_set,
- lttng_pipe_get_readfd(handle->quit_pipe),
- LPOLLIN | LPOLLERR);
+ lttng_pipe_get_readfd(handle->quit_pipe), LPOLLIN);
if (ret < 0) {
ERR("Failed to add quit pipe read fd to poll set");
goto error;
if (ret < 0) {
ERR("Failed to add quit pipe read fd to poll set");
goto error;
ret = lttng_poll_add(poll_set,
lttng_pipe_get_readfd(handle->rotation_timer_queue->event_pipe),
ret = lttng_poll_add(poll_set,
lttng_pipe_get_readfd(handle->rotation_timer_queue->event_pipe),
if (ret < 0) {
ERR("Failed to add rotate_pending fd to poll set");
goto error;
if (ret < 0) {
ERR("Failed to add rotate_pending fd to poll set");
goto error;
goto end;
}
ret = lttng_poll_add(&state->events, rotate_notification_channel->socket,
goto end;
}
ret = lttng_poll_add(&state->events, rotate_notification_channel->socket,
if (ret < 0) {
ERR("Failed to add notification fd to pollset");
goto end;
if (ret < 0) {
ERR("Failed to add notification fd to pollset");
goto end;
- ret = lttng_poll_add(&events, main_quit_pipe[0], LPOLLIN | LPOLLERR);
+ ret = lttng_poll_add(&events, main_quit_pipe[0], LPOLLIN);
if (ret < 0) {
PERROR("Failed to add file descriptor to poll/epoll set");
ret = -1;
if (ret < 0) {
PERROR("Failed to add file descriptor to poll/epoll set");
ret = -1;
}
/* Add main quit pipe */
}
/* Add main quit pipe */
- ret = lttng_poll_add(events, main_quit_pipe[0], LPOLLIN | LPOLLERR);
+ ret = lttng_poll_add(events, main_quit_pipe[0], LPOLLIN);
if (ret < 0) {
goto error;
}
if (ret < 0) {
goto error;
}
stream->wait_fd);
/* Add metadata stream to the global poll events list */
stream->wait_fd);
/* Add metadata stream to the global poll events list */
- lttng_poll_add(&events, stream->wait_fd,
- LPOLLIN | LPOLLPRI | LPOLLHUP);
- } else if (revents & (LPOLLERR | LPOLLHUP)) {
+ lttng_poll_add(&events, stream->wait_fd, LPOLLIN | LPOLLPRI);
+ }else if (revents & (LPOLLERR | LPOLLHUP)) {
DBG("Metadata thread pipe hung up");
/*
* Remove the pipe from the poll set and continue the loop
DBG("Metadata thread pipe hung up");
/*
* Remove the pipe from the poll set and continue the loop
&chan->wait_fd_node);
rcu_read_unlock();
/* Add channel to the global poll events list */
&chan->wait_fd_node);
rcu_read_unlock();
/* Add channel to the global poll events list */
- lttng_poll_add(&events, chan->wait_fd,
- LPOLLERR | LPOLLHUP);
+ // FIXME: Empty flag on a pipe pollset, this might hang on FreeBSD.
+ lttng_poll_add(&events, chan->wait_fd, 0);
break;
case CONSUMER_CHANNEL_DEL:
{
break;
case CONSUMER_CHANNEL_DEL:
{
status = LTTNG_NOTIFICATION_CHANNEL_STATUS_ERROR;
goto end_unlock;
}
status = LTTNG_NOTIFICATION_CHANNEL_STATUS_ERROR;
goto end_unlock;
}
- ret = lttng_poll_add(&events, channel->socket, LPOLLIN | LPOLLERR);
+ ret = lttng_poll_add(&events, channel->socket, LPOLLIN);
if (ret < 0) {
status = LTTNG_NOTIFICATION_CHANNEL_STATUS_ERROR;
goto end_clean_poll;
if (ret < 0) {
status = LTTNG_NOTIFICATION_CHANNEL_STATUS_ERROR;
goto end_clean_poll;
status = LTTNG_NOTIFICATION_CHANNEL_STATUS_ERROR;
goto end_unlock;
}
status = LTTNG_NOTIFICATION_CHANNEL_STATUS_ERROR;
goto end_unlock;
}
- ret = lttng_poll_add(&events, channel->socket, LPOLLIN | LPOLLERR);
+ ret = lttng_poll_add(&events, channel->socket, LPOLLIN);
if (ret < 0) {
status = LTTNG_NOTIFICATION_CHANNEL_STATUS_ERROR;
goto end_clean_poll;
if (ret < 0) {
status = LTTNG_NOTIFICATION_CHANNEL_STATUS_ERROR;
goto end_clean_poll;
}
ret = lttng_poll_add(&handle->communication.events, sessiond_socket,
}
ret = lttng_poll_add(&handle->communication.events, sessiond_socket,
- LPOLLIN | LPOLLHUP | LPOLLRDHUP | LPOLLERR);
}
ret = lttng_poll_add(&handle->communication.events, sessiond_socket,
}
ret = lttng_poll_add(&handle->communication.events, sessiond_socket,
- LPOLLIN | LPOLLHUP | LPOLLRDHUP | LPOLLERR);
childok(lttng_poll_create(&cpoll_events, 1, 0) == 0, "Create valid poll set succeeds");
childok(lttng_poll_mod(NULL, infd[0], LPOLLIN) == -1, "lttng_poll_mod with invalid input returns an error");
childok(lttng_poll_mod(&cpoll_events, infd[0], LPOLLIN) == -1, "lttng_poll_mod with invalid input returns an error");
childok(lttng_poll_create(&cpoll_events, 1, 0) == 0, "Create valid poll set succeeds");
childok(lttng_poll_mod(NULL, infd[0], LPOLLIN) == -1, "lttng_poll_mod with invalid input returns an error");
childok(lttng_poll_mod(&cpoll_events, infd[0], LPOLLIN) == -1, "lttng_poll_mod with invalid input returns an error");
- childok(lttng_poll_add(&cpoll_events, infd[0], LPOLLHUP) == 0, "Add valid FD succeeds");
+ childok(lttng_poll_add(&cpoll_events, infd[0], LPOLLIN) == 0, "Add valid FD succeeds");
childok(lttng_poll_mod(&cpoll_events, -1, LPOLLIN) == -1, "lttng_poll_mod with invalid input returns an error");
childok(lttng_poll_mod(&cpoll_events, hupfd[0], LPOLLIN) == 0, "lttng_poll_mod on unincluded FD goes on");
childok(lttng_poll_mod(&cpoll_events, infd[0], LPOLLIN) == 0, "Modify event type succeeds");
childok(lttng_poll_mod(&cpoll_events, -1, LPOLLIN) == -1, "lttng_poll_mod with invalid input returns an error");
childok(lttng_poll_mod(&cpoll_events, hupfd[0], LPOLLIN) == 0, "lttng_poll_mod on unincluded FD goes on");
childok(lttng_poll_mod(&cpoll_events, infd[0], LPOLLIN) == 0, "Modify event type succeeds");
ok(lttng_poll_create(&poll_events, 1, 0) == 0, "Create valid poll set succeeds");
ok(lttng_poll_wait(&poll_events, -1) == -1, "lttng_poll_wait call with invalid input returns error");
ok(lttng_poll_create(&poll_events, 1, 0) == 0, "Create valid poll set succeeds");
ok(lttng_poll_wait(&poll_events, -1) == -1, "lttng_poll_wait call with invalid input returns error");
- ok(lttng_poll_add(&poll_events, hupfd[0], LPOLLHUP) == 0, "Add valid FD succeeds");
+ ok(lttng_poll_add(&poll_events, hupfd[0], LPOLLIN) == 0, "Add valid FD succeeds");
ok(lttng_write(infd[1], &tbuf, 1) == 1, "Write to pipe succeeds");
ok(lttng_poll_wait(&poll_events, -1) == 1, "Wakes up on one event");
ok(lttng_poll_del(&poll_events, hupfd[0]) == 0, "Removing valid FD succeeds");
ok(lttng_write(infd[1], &tbuf, 1) == 1, "Write to pipe succeeds");
ok(lttng_poll_wait(&poll_events, -1) == 1, "Wakes up on one event");
ok(lttng_poll_del(&poll_events, hupfd[0]) == 0, "Removing valid FD succeeds");