Rename data_available to data_pending
authorDavid Goulet <dgoulet@efficios.com>
Thu, 1 Nov 2012 17:02:58 +0000 (13:02 -0400)
committerDavid Goulet <dgoulet@efficios.com>
Thu, 1 Nov 2012 17:33:49 +0000 (13:33 -0400)
This is just a rename and a change of semantic.

The lttng_data_pending returns 0 if _NO_ data is pending meaning that
the buffers are ready to be read safely. A value of 1 means that data is
still pending so the buffers are not ready for any read.

This is the same semantic as lttng_data_available but in reverse order.

Signed-off-by: David Goulet <dgoulet@efficios.com>
19 files changed:
include/lttng/lttng.h
src/bin/lttng-relayd/main.c
src/bin/lttng-sessiond/cmd.c
src/bin/lttng-sessiond/cmd.h
src/bin/lttng-sessiond/consumer.c
src/bin/lttng-sessiond/consumer.h
src/bin/lttng-sessiond/main.c
src/common/consumer.c
src/common/consumer.h
src/common/defaults.h
src/common/kernel-consumer/kernel-consumer.c
src/common/kernel-consumer/kernel-consumer.h
src/common/relayd/relayd.c
src/common/relayd/relayd.h
src/common/sessiond-comm/relayd.h
src/common/sessiond-comm/sessiond-comm.h
src/common/ust-consumer/ust-consumer.c
src/common/ust-consumer/ust-consumer.h
src/lib/lttng-ctl/lttng-ctl.c

index 0a12d9be75e4b97be6728bad11727105f4e68b8c..f4b07e29f94a175b56758dc4fb38a71d1e48cf8f 100644 (file)
@@ -594,13 +594,15 @@ extern int lttng_health_check(enum lttng_health_component c);
 
 /*
  * For a given session name, this call checks if the data is ready to be read
- * or is still being extracted by the consumer(s) hence not ready to be used by
- * any readers.
+ * or is still being extracted by the consumer(s) (pending) hence not ready to
+ * be used by any readers.
  *
- * Return 0 if the data is _NOT_ available else 1 if the data is ready. On
- * error, a negative value is returned and readable by lttng_strerror().
+ * Return 0 if there is _no_ data pending in the buffers thus having a
+ * guarantee that the data can be read safely. Else, return 1 if there is still
+ * traced data is pending. On error, a negative value is returned and readable
+ * by lttng_strerror().
  */
-extern int lttng_data_available(const char *session_name);
+extern int lttng_data_pending(const char *session_name);
 
 #ifdef __cplusplus
 }
index a398a54dc6611725361c683ef6b288d2de4d48e5..18e60d1efbbe40fb45c678adc149b4e3c366468e 100644 (file)
@@ -1317,14 +1317,14 @@ end:
 }
 
 /*
- * Check for data availability for a given stream id from the session daemon.
+ * Check for data pending for a given stream id from the session daemon.
  */
 static
-int relay_data_available(struct lttcomm_relayd_hdr *recv_hdr,
+int relay_data_pending(struct lttcomm_relayd_hdr *recv_hdr,
                struct relay_command *cmd, struct lttng_ht *streams_ht)
 {
        struct relay_session *session = cmd->session;
-       struct lttcomm_relayd_data_available msg;
+       struct lttcomm_relayd_data_pending msg;
        struct lttcomm_relayd_generic_reply reply;
        struct relay_stream *stream;
        int ret;
@@ -1332,7 +1332,7 @@ int relay_data_available(struct lttcomm_relayd_hdr *recv_hdr,
        struct lttng_ht_iter iter;
        uint64_t last_net_seq_num, stream_id;
 
-       DBG("Data available command received");
+       DBG("Data pending command received");
 
        if (!session || session->version_check_done == 0) {
                ERR("Trying to check for data before version check");
@@ -1342,7 +1342,7 @@ int relay_data_available(struct lttcomm_relayd_hdr *recv_hdr,
 
        ret = cmd->sock->ops->recvmsg(cmd->sock, &msg, sizeof(msg), MSG_WAITALL);
        if (ret < sizeof(msg)) {
-               ERR("Relay didn't receive valid data_available struct size : %d", ret);
+               ERR("Relay didn't receive valid data_pending struct size : %d", ret);
                ret = -1;
                goto end_no_session;
        }
@@ -1362,17 +1362,17 @@ int relay_data_available(struct lttcomm_relayd_hdr *recv_hdr,
        stream = caa_container_of(node, struct relay_stream, stream_n);
        assert(stream);
 
-       DBG("Data available for stream id %" PRIu64 " prev_seq %" PRIu64
+       DBG("Data pending for stream id %" PRIu64 " prev_seq %" PRIu64
                        " and last_seq %" PRIu64, stream_id, stream->prev_seq,
                        last_net_seq_num);
 
        /* Avoid wrapping issue */
        if (((int64_t) (stream->prev_seq - last_net_seq_num)) <= 0) {
-               /* Data has in fact been written and is available */
-               ret = 1;
-       } else {
-               /* Data still being streamed. */
+               /* Data has in fact been written and is NOT pending */
                ret = 0;
+       } else {
+               /* Data still being streamed thus pending */
+               ret = 1;
        }
 
 end_unlock:
@@ -1381,7 +1381,7 @@ end_unlock:
        reply.ret_code = htobe32(ret);
        ret = cmd->sock->ops->sendmsg(cmd->sock, &reply, sizeof(reply), 0);
        if (ret < 0) {
-               ERR("Relay data available ret code failed");
+               ERR("Relay data pending ret code failed");
        }
 
 end_no_session:
@@ -1407,7 +1407,7 @@ int relay_quiescent_control(struct lttcomm_relayd_hdr *recv_hdr,
        reply.ret_code = htobe32(LTTNG_OK);
        ret = cmd->sock->ops->sendmsg(cmd->sock, &reply, sizeof(reply), 0);
        if (ret < 0) {
-               ERR("Relay data available ret code failed");
+               ERR("Relay data quiescent control ret code failed");
        }
 
        return ret;
@@ -1443,8 +1443,8 @@ int relay_process_control(struct lttcomm_relayd_hdr *recv_hdr,
        case RELAYD_CLOSE_STREAM:
                ret = relay_close_stream(recv_hdr, cmd, streams_ht);
                break;
-       case RELAYD_DATA_AVAILABLE:
-               ret = relay_data_available(recv_hdr, cmd, streams_ht);
+       case RELAYD_DATA_PENDING:
+               ret = relay_data_pending(recv_hdr, cmd, streams_ht);
                break;
        case RELAYD_QUIESCENT_CONTROL:
                ret = relay_quiescent_control(recv_hdr, cmd);
index 184dd494c74cfa29fe3408da36f94085df91b3ca..1404e7f33f68d0e5ecec0f1d9544f330c7493526 100644 (file)
@@ -2319,10 +2319,10 @@ error:
 }
 
 /*
- * Command LTTNG_DATA_AVAILABLE returning 0 if the data is NOT ready to be read
- * or else 1 if the data is available for trace analysis.
+ * Command LTTNG_DATA_PENDING returning 0 if the data is NOT pending meaning
+ * ready for trace analysis (or anykind of reader) or else 1 for pending data.
  */
-int cmd_data_available(struct ltt_session *session)
+int cmd_data_pending(struct ltt_session *session)
 {
        int ret;
        struct ltt_kernel_session *ksess = session->kernel_session;
@@ -2337,23 +2337,23 @@ int cmd_data_available(struct ltt_session *session)
        }
 
        if (ksess && ksess->consumer) {
-               ret = consumer_is_data_available(ksess->id, ksess->consumer);
-               if (ret == 0) {
+               ret = consumer_is_data_pending(ksess->id, ksess->consumer);
+               if (ret == 1) {
                        /* Data is still being extracted for the kernel. */
                        goto error;
                }
        }
 
        if (usess && usess->consumer) {
-               ret = consumer_is_data_available(usess->id, usess->consumer);
-               if (ret == 0) {
+               ret = consumer_is_data_pending(usess->id, usess->consumer);
+               if (ret == 1) {
                        /* Data is still being extracted for the kernel. */
                        goto error;
                }
        }
 
        /* Data is ready to be read by a viewer */
-       ret = 1;
+       ret = 0;
 
 error:
        return ret;
index 97ddf029c97e9570eb30ac9a8a7d7accce30f977..a95cb994e7104846a99deb2fc500200eb4e1f017 100644 (file)
@@ -82,6 +82,6 @@ ssize_t cmd_list_tracepoint_fields(int domain,
 ssize_t cmd_list_tracepoints(int domain, struct lttng_event **events);
 
 int cmd_calibrate(int domain, struct lttng_calibrate *calibrate);
-int cmd_data_available(struct ltt_session *session);
+int cmd_data_pending(struct ltt_session *session);
 
 #endif /* CMD_H */
index aa050eceb56a48622ddfbf04b02c87d5f88ee9f6..bf477933515502510c284c58762b56d2b4399f75 100644 (file)
@@ -701,28 +701,28 @@ error:
 }
 
 /*
- * Ask the consumer if the data is ready to bread (available) for the specific
+ * Ask the consumer if the data is ready to read (NOT pending) for the specific
  * session id.
  *
  * This function has a different behavior with the consumer i.e. that it waits
- * for a reply from the consumer if yes or no the data is available.
+ * for a reply from the consumer if yes or no the data is pending.
  */
-int consumer_is_data_available(unsigned int id,
+int consumer_is_data_pending(unsigned int id,
                struct consumer_output *consumer)
 {
        int ret;
-       int32_t ret_code = 1;  /* Default is that the data is available */
+       int32_t ret_code = 0;  /* Default is that the data is NOT pending */
        struct consumer_socket *socket;
        struct lttng_ht_iter iter;
        struct lttcomm_consumer_msg msg;
 
        assert(consumer);
 
-       msg.cmd_type = LTTNG_CONSUMER_DATA_AVAILABLE;
+       msg.cmd_type = LTTNG_CONSUMER_DATA_PENDING;
 
-       msg.u.data_available.session_id = (uint64_t) id;
+       msg.u.data_pending.session_id = (uint64_t) id;
 
-       DBG3("Consumer data available for id %u", id);
+       DBG3("Consumer data pending for id %u", id);
 
        /* Send command for each consumer */
        cds_lfht_for_each_entry(consumer->socks->ht, &iter.iter, socket,
@@ -734,30 +734,26 @@ int consumer_is_data_available(unsigned int id,
 
                ret = lttcomm_send_unix_sock(socket->fd, &msg, sizeof(msg));
                if (ret < 0) {
-                       PERROR("send consumer data available command");
+                       PERROR("send consumer data pending command");
                        pthread_mutex_unlock(socket->lock);
                        goto error;
                }
 
-               /*
-                * Waiting for the reply code where 0 the data is not available and 1
-                * it is for trace reading.
-                */
                ret = lttcomm_recv_unix_sock(socket->fd, &ret_code, sizeof(ret_code));
                if (ret < 0) {
-                       PERROR("recv consumer data available status");
+                       PERROR("recv consumer data pending status");
                        pthread_mutex_unlock(socket->lock);
                        goto error;
                }
 
                pthread_mutex_unlock(socket->lock);
 
-               if (ret_code == 0) {
+               if (ret_code == 1) {
                        break;
                }
        }
 
-       DBG("Consumer data available ret %d", ret_code);
+       DBG("Consumer data pending ret %d", ret_code);
        return ret_code;
 
 error:
index acc039a2394b7d1069d7a46f56073d8cc6ec8bde..e45d5b0bf4a99b9311968529e31150bfc0188dad 100644 (file)
@@ -199,7 +199,7 @@ void consumer_init_channel_comm_msg(struct lttcomm_consumer_msg *msg,
                uint64_t mmap_len,
                const char *name,
                unsigned int nb_init_streams);
-int consumer_is_data_available(unsigned int id,
+int consumer_is_data_pending(unsigned int id,
                struct consumer_output *consumer);
 
 #endif /* _CONSUMER_H */
index 9818b39569d9ee77eb84078d15ed5f12ad2f08ad..cedd35611c6ba4ecdca0039b2de79364a7f27dab 100644 (file)
@@ -2134,7 +2134,7 @@ static int process_client_msg(struct command_ctx *cmd_ctx, int sock,
        case LTTNG_LIST_DOMAINS:
        case LTTNG_START_TRACE:
        case LTTNG_STOP_TRACE:
-       case LTTNG_DATA_AVAILABLE:
+       case LTTNG_DATA_PENDING:
                need_domain = 0;
                break;
        default:
@@ -2829,9 +2829,9 @@ skip_domain:
                                bytecode);
                break;
        }
-       case LTTNG_DATA_AVAILABLE:
+       case LTTNG_DATA_PENDING:
        {
-               ret = cmd_data_available(cmd_ctx->session);
+               ret = cmd_data_pending(cmd_ctx->session);
                break;
        }
        default:
index efd9e7eb3d368552685c3e0a7bd3f54362943318..41f8ae53fe67adde7552b54dfb31aa89d4abedcb 100644 (file)
@@ -2703,29 +2703,29 @@ end:
  * Check if for a given session id there is still data needed to be extract
  * from the buffers.
  *
- * Return 1 if data is in fact available to be read or else 0.
+ * Return 1 if data is pending or else 0 meaning ready to be read.
  */
-int consumer_data_available(uint64_t id)
+int consumer_data_pending(uint64_t id)
 {
        int ret;
        struct lttng_ht_iter iter;
        struct lttng_ht *ht;
        struct lttng_consumer_stream *stream;
        struct consumer_relayd_sock_pair *relayd;
-       int (*data_available)(struct lttng_consumer_stream *);
+       int (*data_pending)(struct lttng_consumer_stream *);
 
-       DBG("Consumer data available command on session id %" PRIu64, id);
+       DBG("Consumer data pending command on session id %" PRIu64, id);
 
        rcu_read_lock();
        pthread_mutex_lock(&consumer_data.lock);
 
        switch (consumer_data.type) {
        case LTTNG_CONSUMER_KERNEL:
-               data_available = lttng_kconsumer_data_available;
+               data_pending = lttng_kconsumer_data_pending;
                break;
        case LTTNG_CONSUMER32_UST:
        case LTTNG_CONSUMER64_UST:
-               data_available = lttng_ustconsumer_data_available;
+               data_pending = lttng_ustconsumer_data_pending;
                break;
        default:
                ERR("Unknown consumer data type");
@@ -2742,7 +2742,7 @@ int consumer_data_available(uint64_t id)
                /* If this call fails, the stream is being used hence data pending. */
                ret = stream_try_lock(stream);
                if (!ret) {
-                       goto data_not_available;
+                       goto data_not_pending;
                }
 
                /*
@@ -2754,10 +2754,10 @@ int consumer_data_available(uint64_t id)
                ret = cds_lfht_is_node_deleted(&stream->node.node);
                if (!ret) {
                        /* Check the stream if there is data in the buffers. */
-                       ret = data_available(stream);
-                       if (ret == 0) {
+                       ret = data_pending(stream);
+                       if (ret == 1) {
                                pthread_mutex_unlock(&stream->lock);
-                               goto data_not_available;
+                               goto data_not_pending;
                        }
                }
 
@@ -2772,20 +2772,20 @@ int consumer_data_available(uint64_t id)
                                 * are or will be marked for deletion hence no data pending.
                                 */
                                pthread_mutex_unlock(&stream->lock);
-                               goto data_not_available;
+                               goto data_not_pending;
                        }
 
                        pthread_mutex_lock(&relayd->ctrl_sock_mutex);
                        if (stream->metadata_flag) {
                                ret = relayd_quiescent_control(&relayd->control_sock);
                        } else {
-                               ret = relayd_data_available(&relayd->control_sock,
+                               ret = relayd_data_pending(&relayd->control_sock,
                                                stream->relayd_stream_id, stream->next_net_seq_num);
                        }
                        pthread_mutex_unlock(&relayd->ctrl_sock_mutex);
-                       if (ret == 0) {
+                       if (ret == 1) {
                                pthread_mutex_unlock(&stream->lock);
-                               goto data_not_available;
+                               goto data_not_pending;
                        }
                }
                pthread_mutex_unlock(&stream->lock);
@@ -2801,11 +2801,11 @@ int consumer_data_available(uint64_t id)
        /* Data is available to be read by a viewer. */
        pthread_mutex_unlock(&consumer_data.lock);
        rcu_read_unlock();
-       return 1;
+       return 0;
 
-data_not_available:
+data_not_pending:
        /* Data is still being extracted from buffers. */
        pthread_mutex_unlock(&consumer_data.lock);
        rcu_read_unlock();
-       return 0;
+       return 1;
 }
index 0334c497e75e55dbe8585803cab995ff6c84e2a0..be532b58789dea028d6919c38a97d3d8d1eedc4d 100644 (file)
@@ -57,7 +57,7 @@ enum lttng_consumer_command {
        /* Inform the consumer to kill a specific relayd connection */
        LTTNG_CONSUMER_DESTROY_RELAYD,
        /* Return to the sessiond if there is data pending for a session */
-       LTTNG_CONSUMER_DATA_AVAILABLE,
+       LTTNG_CONSUMER_DATA_PENDING,
 };
 
 /* State of each fd in consumer */
@@ -431,6 +431,6 @@ int consumer_add_relayd_socket(int net_seq_idx, int sock_type,
                struct pollfd *consumer_sockpoll, struct lttcomm_sock *relayd_sock);
 void consumer_flag_relayd_for_destroy(
                struct consumer_relayd_sock_pair *relayd);
-int consumer_data_available(uint64_t id);
+int consumer_data_pending(uint64_t id);
 
 #endif /* LIB_CONSUMER_H */
index 8bb1190e7e8887b12014b49ec0c6087f11d72909..9853fbc9e81d7ebaa024d2baeac4be859dfe2eae 100644 (file)
 #define DEFAULT_HEALTH_CHECK_DELTA_NS       0
 
 /*
- * Wait period before retrying the lttng_data_available command in the lttng
+ * Wait period before retrying the lttng_data_pending command in the lttng
  * stop command of liblttng-ctl.
  */
 #define DEFAULT_DATA_AVAILABILITY_WAIT_TIME 200000  /* usec */
index 196deee9a153e521447703915d9ee9d2790502a4..0b0592adb8a3bbe008141a4cb92196e020b752c8 100644 (file)
@@ -280,19 +280,19 @@ int lttng_kconsumer_recv_cmd(struct lttng_consumer_local_data *ctx,
 
                goto end_nosignal;
        }
-       case LTTNG_CONSUMER_DATA_AVAILABLE:
+       case LTTNG_CONSUMER_DATA_PENDING:
        {
                int32_t ret;
-               uint64_t id = msg.u.data_available.session_id;
+               uint64_t id = msg.u.data_pending.session_id;
 
-               DBG("Kernel consumer data available command for id %" PRIu64, id);
+               DBG("Kernel consumer data pending command for id %" PRIu64, id);
 
-               ret = consumer_data_available(id);
+               ret = consumer_data_pending(id);
 
                /* Send back returned value to session daemon */
                ret = lttcomm_send_unix_sock(sock, &ret, sizeof(ret));
                if (ret < 0) {
-                       PERROR("send data available ret code");
+                       PERROR("send data pending ret code");
                }
                break;
        }
@@ -488,10 +488,10 @@ error:
  * stream. Consumer data lock MUST be acquired before calling this function
  * and the stream lock.
  *
- * Return 0 if the traced data are still getting read else 1 meaning that the
+ * Return 1 if the traced data are still getting read else 0 meaning that the
  * data is available for trace viewer reading.
  */
-int lttng_kconsumer_data_available(struct lttng_consumer_stream *stream)
+int lttng_kconsumer_data_pending(struct lttng_consumer_stream *stream)
 {
        int ret;
 
@@ -502,11 +502,12 @@ int lttng_kconsumer_data_available(struct lttng_consumer_stream *stream)
                /* There is still data so let's put back this subbuffer. */
                ret = kernctl_put_subbuf(stream->wait_fd);
                assert(ret == 0);
+               ret = 1;   /* Data is pending */
                goto end;
        }
 
-       /* Data is available to be read for this stream. */
-       ret = 1;
+       /* Data is NOT pending and ready to be read. */
+       ret = 0;
 
 end:
        return ret;
index e836a841aa9f91488399d02792e3e21fd7741cb1..8ae1834020f1a6d2cb7701bd9f45bc9a7423a203 100644 (file)
@@ -46,6 +46,6 @@ int lttng_kconsumer_recv_cmd(struct lttng_consumer_local_data *ctx,
 ssize_t lttng_kconsumer_read_subbuffer(struct lttng_consumer_stream *stream,
                struct lttng_consumer_local_data *ctx);
 int lttng_kconsumer_on_recv_stream(struct lttng_consumer_stream *stream);
-int lttng_kconsumer_data_available(struct lttng_consumer_stream *stream);
+int lttng_kconsumer_data_pending(struct lttng_consumer_stream *stream);
 
 #endif /* _LTTNG_KCONSUMER_H */
index db476080ec207d505938ddcb9b351cd1b4d10ac7..daaf44ef04561a40725afdc618e7b91061ef83ae 100644 (file)
@@ -348,25 +348,25 @@ error:
 /*
  * Check for data availability for a given stream id.
  *
- * Return 0 if NOT available, 1 if so and a negative value on error.
+ * Return 0 if NOT pending, 1 if so and a negative value on error.
  */
-int relayd_data_available(struct lttcomm_sock *sock, uint64_t stream_id,
+int relayd_data_pending(struct lttcomm_sock *sock, uint64_t stream_id,
                uint64_t last_net_seq_num)
 {
        int ret;
-       struct lttcomm_relayd_data_available msg;
+       struct lttcomm_relayd_data_pending msg;
        struct lttcomm_relayd_generic_reply reply;
 
        /* Code flow error. Safety net. */
        assert(sock);
 
-       DBG("Relayd data available for stream id %" PRIu64, stream_id);
+       DBG("Relayd data pending for stream id %" PRIu64, stream_id);
 
        msg.stream_id = htobe64(stream_id);
        msg.last_net_seq_num = htobe64(last_net_seq_num);
 
        /* Send command */
-       ret = send_command(sock, RELAYD_DATA_AVAILABLE, (void *) &msg,
+       ret = send_command(sock, RELAYD_DATA_PENDING, (void *) &msg,
                        sizeof(msg), 0);
        if (ret < 0) {
                goto error;
@@ -383,14 +383,14 @@ int relayd_data_available(struct lttcomm_sock *sock, uint64_t stream_id,
        /* Return session id or negative ret code. */
        if (reply.ret_code >= LTTNG_OK) {
                ret = -reply.ret_code;
-               ERR("Relayd data available replied error %d", ret);
+               ERR("Relayd data pending replied error %d", ret);
        }
 
        /* At this point, the ret code is either 1 or 0 */
        ret = reply.ret_code;
 
-       DBG("Relayd data is %s available for stream id %" PRIu64,
-                       ret == 1 ? "" : "NOT", stream_id);
+       DBG("Relayd data is %s pending for stream id %" PRIu64,
+                       ret == 1 ? "NOT" : "", stream_id);
 
 error:
        return ret;
@@ -431,7 +431,7 @@ int relayd_quiescent_control(struct lttcomm_sock *sock)
        }
 
        /* Control socket is quiescent */
-       return 1;
+       return 0;
 
 error:
        return ret;
index 29903cfae679e6bdb76017b4f23e7e2cc41d17a6..8857bc9fbb058e73b5383f47c2711c35b33b0a88 100644 (file)
@@ -39,7 +39,7 @@ int relayd_start_data(struct lttcomm_sock *sock);
 int relayd_send_metadata(struct lttcomm_sock *sock, size_t len);
 int relayd_send_data_hdr(struct lttcomm_sock *sock,
                struct lttcomm_relayd_data_hdr *hdr, size_t size);
-int relayd_data_available(struct lttcomm_sock *sock, uint64_t stream_id,
+int relayd_data_pending(struct lttcomm_sock *sock, uint64_t stream_id,
                uint64_t last_net_seq_num);
 int relayd_quiescent_control(struct lttcomm_sock *sock);
 
index 5be2328b9794676462f1c0cd96a588a0e97fc406..b897714d719ea1e618af6f9b2695c46d301007da 100644 (file)
@@ -108,10 +108,10 @@ struct lttcomm_relayd_close_stream {
 } __attribute__ ((__packed__));
 
 /*
- * Used to test if for a given stream id the data is available on the relayd
- * side for reading.
+ * Used to test if for a given stream id the data is pending on the relayd side
+ * for reading.
  */
-struct lttcomm_relayd_data_available {
+struct lttcomm_relayd_data_pending {
        uint64_t stream_id;
        uint64_t last_net_seq_num; /* Sequence number of the last packet */
 } __attribute__ ((__packed__));
index 5884fb8423006c3b1ad2474d2689625b5e6b7018..b94d3fb8d6229300fea7fda8203e4dda1b7fe27d 100644 (file)
@@ -85,11 +85,11 @@ enum lttcomm_sessiond_command {
        RELAYD_VERSION,
        RELAYD_SEND_METADATA,
        RELAYD_CLOSE_STREAM,
-       RELAYD_DATA_AVAILABLE,
+       RELAYD_DATA_PENDING,
        RELAYD_QUIESCENT_CONTROL,
        LTTNG_SET_FILTER,
        LTTNG_HEALTH_CHECK,
-       LTTNG_DATA_AVAILABLE,
+       LTTNG_DATA_PENDING,
 };
 
 /*
@@ -288,7 +288,7 @@ struct lttcomm_consumer_msg {
                } destroy_relayd;
                struct {
                        uint64_t session_id;
-               } data_available;
+               } data_pending;
        } u;
 };
 
index 4d3671a34bbcbe027ae9520f44aca94a51b92af0..5a716859a386236fd480fbf1bb133b96a52012e7 100644 (file)
@@ -310,19 +310,19 @@ int lttng_ustconsumer_recv_cmd(struct lttng_consumer_local_data *ctx,
                rcu_read_unlock();
                return -ENOSYS;
        }
-       case LTTNG_CONSUMER_DATA_AVAILABLE:
+       case LTTNG_CONSUMER_DATA_PENDING:
        {
                int32_t ret;
-               uint64_t id = msg.u.data_available.session_id;
+               uint64_t id = msg.u.data_pending.session_id;
 
-               DBG("UST consumer data available command for id %" PRIu64, id);
+               DBG("UST consumer data pending command for id %" PRIu64, id);
 
-               ret = consumer_data_available(id);
+               ret = consumer_data_pending(id);
 
                /* Send back returned value to session daemon */
                ret = lttcomm_send_unix_sock(sock, &ret, sizeof(ret));
                if (ret < 0) {
-                       PERROR("send data available ret code");
+                       PERROR("send data pending ret code");
                }
                break;
        }
@@ -529,27 +529,28 @@ error:
  * stream. Consumer data lock MUST be acquired before calling this function
  * and the stream lock.
  *
- * Return 0 if the traced data are still getting read else 1 meaning that the
+ * Return 1 if the traced data are still getting read else 0 meaning that the
  * data is available for trace viewer reading.
  */
-int lttng_ustconsumer_data_available(struct lttng_consumer_stream *stream)
+int lttng_ustconsumer_data_pending(struct lttng_consumer_stream *stream)
 {
        int ret;
 
        assert(stream);
 
-       DBG("UST consumer checking data availability");
+       DBG("UST consumer checking data pending");
 
        ret = ustctl_get_next_subbuf(stream->chan->handle, stream->buf);
        if (ret == 0) {
                /* There is still data so let's put back this subbuffer. */
                ret = ustctl_put_subbuf(stream->chan->handle, stream->buf);
                assert(ret == 0);
+               ret = 1;  /* Data is pending */
                goto end;
        }
 
-       /* Data is available to be read for this stream. */
-       ret = 1;
+       /* Data is NOT pending so ready to be read. */
+       ret = 0;
 
 end:
        return ret;
index a8a167239f49759c34e2b065ab479ba3a00ad5c3..812c98df4e7f4ad42516a4050a9aa88f737de608 100644 (file)
@@ -61,7 +61,7 @@ void lttng_ustconsumer_on_stream_hangup(struct lttng_consumer_stream *stream);
 extern int lttng_ustctl_get_mmap_read_offset(
                struct lttng_ust_shm_handle *handle,
                struct lttng_ust_lib_ring_buffer *buf, unsigned long *off);
-int lttng_ustconsumer_data_available(struct lttng_consumer_stream *stream);
+int lttng_ustconsumer_data_pending(struct lttng_consumer_stream *stream);
 
 #else /* HAVE_LIBLTTNG_UST_CTL */
 
@@ -153,7 +153,7 @@ int lttng_ustctl_get_mmap_read_offset(struct lttng_ust_shm_handle *handle,
        return -ENOSYS;
 }
 static inline
-int lttng_ustconsumer_data_available(struct lttng_consumer_stream *stream)
+int lttng_ustconsumer_data_pending(struct lttng_consumer_stream *stream)
 {
        return -ENOSYS;
 }
index bab62458b2b1967eb012df9e9dcb990e2f7775b8..ab64d56c0ff3df7ef52bfc511bbec5cf95838a34 100644 (file)
@@ -708,7 +708,7 @@ static int _lttng_stop_tracing(const char *session_name, int wait)
 
        /* Check for data availability */
        do {
-               data_ret = lttng_data_available(session_name);
+               data_ret = lttng_data_pending(session_name);
                if (data_ret < 0) {
                        /* Return the data available call error. */
                        ret = data_ret;
@@ -719,11 +719,11 @@ static int _lttng_stop_tracing(const char *session_name, int wait)
                 * Data sleep time before retrying (in usec). Don't sleep if the call
                 * returned value indicates availability.
                 */
-               if (!data_ret) {
+               if (data_ret) {
                        usleep(DEFAULT_DATA_AVAILABILITY_WAIT_TIME);
                        _MSG(".");
                }
-       } while (data_ret != 1);
+       } while (data_ret != 0);
 
        MSG("");
 
@@ -1643,7 +1643,7 @@ int _lttng_create_session_ext(const char *name, const char *url,
  * or is still being extracted by the consumer(s) hence not ready to be used by
  * any readers.
  */
-int lttng_data_available(const char *session_name)
+int lttng_data_pending(const char *session_name)
 {
        int ret;
        struct lttcomm_session_msg lsm;
@@ -1652,7 +1652,7 @@ int lttng_data_available(const char *session_name)
                return -LTTNG_ERR_INVALID;
        }
 
-       lsm.cmd_type = LTTNG_DATA_AVAILABLE;
+       lsm.cmd_type = LTTNG_DATA_PENDING;
 
        copy_string(lsm.session.name, session_name, sizeof(lsm.session.name));
 
This page took 0.04339 seconds and 5 git commands to generate.