* Update a fd according to what we just received
*/
static void change_fd_state(int sessiond_fd,
* Update a fd according to what we just received
*/
static void change_fd_state(int sessiond_fd,
{
struct ltt_kconsumerd_fd *iter;
cds_list_for_each_entry(iter, &kconsumerd_fd_list.head, list) {
{
struct ltt_kconsumerd_fd *iter;
cds_list_for_each_entry(iter, &kconsumerd_fd_list.head, list) {
* Returns the size of received data
*/
static int consumerd_recv_fd(int sfd, int size,
* Returns the size of received data
*/
static int consumerd_recv_fd(int sfd, int size,
DBG("Receive : expecting %d fds", nb_fd);
for (i = 0; i < nb_fd; i++) {
switch (cmd_type) {
DBG("Receive : expecting %d fds", nb_fd);
for (i = 0; i < nb_fd; i++) {
switch (cmd_type) {
DBG("add_fd %s (%d)", buf[i].path_name, ((int *)CMSG_DATA(cmsg))[i]);
ret = add_fd(&buf[i], ((int *)CMSG_DATA(cmsg))[i]);
if (ret < 0) {
DBG("add_fd %s (%d)", buf[i].path_name, ((int *)CMSG_DATA(cmsg))[i]);
ret = add_fd(&buf[i], ((int *)CMSG_DATA(cmsg))[i]);
if (ret < 0) {
}
DBG("Sending ready command to ltt-sessiond");
ret = send_error(KCONSUMERD_COMMAND_SOCK_READY);
if (ret < 0) {
ERR("Error sending ready command to ltt-sessiond");
}
DBG("Sending ready command to ltt-sessiond");
ret = send_error(KCONSUMERD_COMMAND_SOCK_READY);
if (ret < 0) {
ERR("Error sending ready command to ltt-sessiond");
}
/* Blocking call, waiting for transmission */
sock = lttcomm_accept_unix_sock(client_socket);
if (sock <= 0) {
WARN("On accept");
}
/* Blocking call, waiting for transmission */
sock = lttcomm_accept_unix_sock(client_socket);
if (sock <= 0) {
WARN("On accept");
}
while (1) {
/* We first get the number of fd we are about to receive */
ret = lttcomm_recv_unix_sock(sock, &tmp,
sizeof(struct lttcomm_kconsumerd_header));
if (ret <= 0) {
}
while (1) {
/* We first get the number of fd we are about to receive */
ret = lttcomm_recv_unix_sock(sock, &tmp,
sizeof(struct lttcomm_kconsumerd_header));
if (ret <= 0) {
ret = consumerd_recv_fd(sock, tmp.payload_size, tmp.cmd_type);
if (ret <= 0) {
ERR("Receiving the FD, exiting");
ret = consumerd_recv_fd(sock, tmp.payload_size, tmp.cmd_type);
if (ret <= 0) {
ERR("Receiving the FD, exiting");
switch(pollfd[i].revents) {
case POLLERR:
ERR("Error returned in polling fd %d.", pollfd[i].fd);
switch(pollfd[i].revents) {
case POLLERR:
ERR("Error returned in polling fd %d.", pollfd[i].fd);
/* If every buffer FD has hung up, we end the read loop here */
if (nb_fd > 0 && num_hup == nb_fd) {
DBG("every buffer FD has hung up\n");
/* If every buffer FD has hung up, we end the read loop here */
if (nb_fd > 0 && num_hup == nb_fd) {
DBG("every buffer FD has hung up\n");