if (session->consumer_fds_sent == 0 && session->consumer != NULL) {
cds_lfht_for_each_entry(session->consumer->socks->ht, &iter.iter,
socket, node.node) {
- /* Code flow error */
- assert(socket->fd);
-
pthread_mutex_lock(socket->lock);
ret = kernel_consumer_send_session(socket, session);
pthread_mutex_unlock(socket->lock);
/* For each consumer socket, send relayd sockets */
cds_lfht_for_each_entry(usess->consumer->socks->ht, &iter.iter,
socket, node.node) {
- /* Code flow error */
- assert(socket->fd);
-
pthread_mutex_lock(socket->lock);
ret = send_consumer_relayd_sockets(LTTNG_DOMAIN_UST, session->id,
usess->consumer, socket);
&& ksess->consumer->enabled) {
cds_lfht_for_each_entry(ksess->consumer->socks->ht, &iter.iter,
socket, node.node) {
- /* Code flow error */
- assert(socket->fd);
-
pthread_mutex_lock(socket->lock);
ret = send_consumer_relayd_sockets(LTTNG_DOMAIN_KERNEL, session->id,
ksess->consumer, socket);
ssize_t size;
assert(socket);
- assert(socket->fd);
+ assert(socket->fd_ptr);
assert(msg);
/* Consumer socket is invalid. Stopping. */
- fd = *socket->fd;
+ fd = *socket->fd_ptr;
if (fd < 0) {
goto error;
}
/* This call will PERROR on error. */
(void) lttcomm_close_unix_sock(fd);
- *socket->fd = -1;
+ *socket->fd_ptr = -1;
goto error;
}
ssize_t size;
assert(socket);
- assert(socket->fd);
+ assert(socket->fd_ptr);
assert(msg);
/* Consumer socket is invalid. Stopping. */
- fd = *socket->fd;
+ fd = *socket->fd_ptr;
if (fd < 0) {
goto error;
}
/* This call will PERROR on error. */
(void) lttcomm_close_unix_sock(fd);
- *socket->fd = -1;
+ *socket->fd_ptr = -1;
goto error;
}
assert(consumer);
assert(sock);
- DBG2("Sending destroy relayd command to consumer sock %d", *sock->fd);
+ DBG2("Sending destroy relayd command to consumer sock %d", *sock->fd_ptr);
msg.cmd_type = LTTNG_CONSUMER_DESTROY_RELAYD;
msg.u.destroy_relayd.net_seq_idx = consumer->net_seq_index;
goto error;
}
- socket->fd = fd;
+ socket->fd_ptr = fd;
lttng_ht_node_init_ulong(&socket->node, *fd);
error:
* consumer was registered,
*/
if (sock->registered) {
- DBG3("Consumer socket was registered. Closing fd %d", *sock->fd);
- lttcomm_close_unix_sock(*sock->fd);
+ DBG3("Consumer socket was registered. Closing fd %d", *sock->fd_ptr);
+ lttcomm_close_unix_sock(*sock->fd_ptr);
}
call_rcu(&sock->node.head, destroy_socket_rcu);
rcu_read_lock();
cds_lfht_for_each_entry(src->socks->ht, &iter.iter, socket, node.node) {
/* Ignore socket that are already there. */
- copy_sock = consumer_find_socket(*socket->fd, dst);
+ copy_sock = consumer_find_socket(*socket->fd_ptr, dst);
if (copy_sock) {
continue;
}
/* Create new socket object. */
- copy_sock = consumer_allocate_socket(socket->fd);
+ copy_sock = consumer_allocate_socket(socket->fd_ptr);
if (copy_sock == NULL) {
rcu_read_unlock();
ret = -ENOMEM;
assert(fds);
assert(sock);
- assert(sock->fd);
assert(nb_fd > 0);
- ret = lttcomm_send_fds_unix_sock(*sock->fd, fds, nb_fd);
+ ret = lttcomm_send_fds_unix_sock(*sock->fd_ptr, fds, nb_fd);
if (ret < 0) {
/* The above call will print a PERROR on error. */
- DBG("Error when sending consumer fds on sock %d", *sock->fd);
+ DBG("Error when sending consumer fds on sock %d", *sock->fd_ptr);
goto error;
}
assert(msg);
assert(sock);
- assert(sock->fd);
ret = consumer_socket_send(sock, msg, sizeof(struct lttcomm_consumer_msg));
if (ret < 0) {
assert(msg);
assert(sock);
- assert(sock->fd);
ret = consumer_send_msg(sock, msg);
if (ret < 0) {
assert(msg);
assert(dst);
assert(sock);
- assert(sock->fd);
assert(fds);
ret = consumer_send_msg(sock, msg);
assert(rsock);
assert(consumer);
assert(consumer_sock);
- assert(consumer_sock->fd);
/* Bail out if consumer is disabled */
if (!consumer->enabled) {
msg.u.relayd_sock.session_id = session_id;
memcpy(&msg.u.relayd_sock.sock, rsock, sizeof(msg.u.relayd_sock.sock));
- DBG3("Sending relayd sock info to consumer on %d", *consumer_sock->fd);
+ DBG3("Sending relayd sock info to consumer on %d", *consumer_sock->fd_ptr);
ret = consumer_send_msg(consumer_sock, &msg);
if (ret < 0) {
goto error;
rcu_read_lock();
cds_lfht_for_each_entry(consumer->socks->ht, &iter.iter, socket,
node.node) {
- /* Code flow error */
- assert(socket->fd);
-
pthread_mutex_lock(socket->lock);
ret = consumer_socket_send(socket, &msg, sizeof(msg));
if (ret < 0) {
struct lttcomm_consumer_msg msg;
assert(socket);
- assert(socket->fd);
DBG2("Consumer flush channel key %" PRIu64, key);
struct lttcomm_consumer_msg msg;
assert(socket);
- assert(socket->fd);
DBG2("Consumer close metadata channel key %" PRIu64, metadata_key);
struct lttcomm_consumer_msg msg;
assert(socket);
- assert(socket->fd);
DBG2("Consumer setup metadata channel key %" PRIu64, metadata_key);
struct lttcomm_consumer_msg msg;
assert(socket);
- assert(socket->fd);
- DBG2("Consumer push metadata to consumer socket %d", *socket->fd);
+ DBG2("Consumer push metadata to consumer socket %d", *socket->fd_ptr);
msg.cmd_type = LTTNG_CONSUMER_PUSH_METADATA;
msg.u.push_metadata.key = metadata_key;
goto end;
}
- DBG3("Consumer pushing metadata on sock %d of len %zu", *socket->fd, len);
+ DBG3("Consumer pushing metadata on sock %d of len %zu", *socket->fd_ptr,
+ len);
ret = consumer_socket_send(socket, metadata_str, len);
if (ret < 0) {
struct lttcomm_consumer_msg msg;
assert(socket);
- assert(socket->fd);
assert(output);
assert(output->consumer);
rcu_read_lock();
cds_lfht_for_each_entry(ksess->consumer->socks->ht,
&iter.iter, socket, node.node) {
- /* Code flow error */
- assert(socket->fd);
-
pthread_mutex_lock(socket->lock);
ret = kernel_consumer_send_channel_stream(socket,
channel, ksess,
signal_consumer_condition(consumer_data, -1);
goto error;
}
- consumer_data->metadata_sock.fd = &consumer_data->metadata_fd;
+ consumer_data->metadata_sock.fd_ptr = &consumer_data->metadata_fd;
/* Create metadata socket lock. */
consumer_data->metadata_sock.lock = zmalloc(sizeof(pthread_mutex_t));
if (consumer_data->metadata_sock.lock == NULL) {
}
consumer_data->cmd_sock = -1;
}
- if (*consumer_data->metadata_sock.fd >= 0) {
- ret = close(*consumer_data->metadata_sock.fd);
+ if (*consumer_data->metadata_sock.fd_ptr >= 0) {
+ ret = close(*consumer_data->metadata_sock.fd_ptr);
if (ret) {
PERROR("close");
}
assert(ua_chan);
assert(consumer);
assert(socket);
- assert(socket->fd);
assert(registry);
if (!consumer->enabled) {
assert(ua_chan);
assert(socket);
- assert(socket->fd);
msg.cmd_type = LTTNG_CONSUMER_GET_CHANNEL;
msg.u.get_channel.key = ua_chan->key;
}
/* First, get the channel from consumer. */
- ret = ustctl_recv_channel_from_consumer(*socket->fd, &ua_chan->obj);
+ ret = ustctl_recv_channel_from_consumer(*socket->fd_ptr, &ua_chan->obj);
if (ret < 0) {
if (ret != -EPIPE) {
ERR("Error recv channel from consumer %d with ret %d",
- *socket->fd, ret);
+ *socket->fd_ptr, ret);
} else {
DBG3("UST app recv channel from consumer. Consumer is dead.");
}
}
/* Stream object is populated by this call if successful. */
- ret = ustctl_recv_stream_from_consumer(*socket->fd, &stream->obj);
+ ret = ustctl_recv_stream_from_consumer(*socket->fd_ptr, &stream->obj);
if (ret < 0) {
free(stream);
if (ret == -LTTNG_UST_ERR_NOENT) {
}
if (ret != -EPIPE) {
ERR("Recv stream from consumer %d with ret %d",
- *socket->fd, ret);
+ *socket->fd_ptr, ret);
} else {
DBG3("UST app recv stream from consumer. Consumer is dead.");
}
assert(ua_chan);
assert(socket);
- assert(socket->fd);
msg.cmd_type = LTTNG_CONSUMER_DESTROY_CHANNEL;
msg.u.destroy_channel.key = ua_chan->key;