Clean-up: Remove java-doc annotations from function header
[lttng-tools.git] / src / lib / lttng-ctl / lttng-ctl.c
index 004b0ccebf1c7b24e49674e2f3d66d53bfde7abe..779ee675fc92257e58c910dc4ee44703b3cfa08d 100644 (file)
@@ -1880,6 +1880,7 @@ int lttng_data_pending(const char *session_name)
 {
        int ret;
        struct lttcomm_session_msg lsm;
+       uint8_t *pending = NULL;
 
        if (session_name == NULL) {
                return -LTTNG_ERR_INVALID;
@@ -1891,18 +1892,18 @@ int lttng_data_pending(const char *session_name)
        lttng_ctl_copy_string(lsm.session.name, session_name,
                        sizeof(lsm.session.name));
 
-       ret = lttng_ctl_ask_sessiond(&lsm, NULL);
-
-       /*
-        * The lttng_ctl_ask_sessiond function negate the return code if it's not
-        * LTTNG_OK so getting -1 means that the reply ret_code was 1 thus meaning
-        * that the data is available. Yes it is hackish but for now this is the
-        * only way.
-        */
-       if (ret == -1) {
-               ret = 1;
+       ret = lttng_ctl_ask_sessiond(&lsm, (void **) &pending);
+       if (ret < 0) {
+               goto end;
+       } else if (ret != 1) {
+               /* Unexpected payload size */
+               ret = -LTTNG_ERR_INVALID;
+               goto end;
        }
 
+       ret = (int) *pending;
+end:
+       free(pending);
        return ret;
 }
 
@@ -1954,7 +1955,7 @@ int lttng_create_session_live(const char *name, const char *url,
        struct lttcomm_session_msg lsm;
        struct lttng_uri *uris = NULL;
 
-       if (name == NULL) {
+       if (name == NULL || timer_interval == 0) {
                return -LTTNG_ERR_INVALID;
        }
 
@@ -1993,17 +1994,18 @@ end:
 /*
  * List PIDs in the tracker.
  *
- * @enabled is set to whether the PID tracker is enabled.
- * @pids is set to an allocated array of PIDs currently tracked. On
- * success, @pids must be freed by the caller.
- * @nr_pids is set to the number of entries contained by the @pids array.
+ * enabled is set to whether the PID tracker is enabled.
+ * pids is set to an allocated array of PIDs currently tracked. On
+ * success, pids must be freed by the caller.
+ * nr_pids is set to the number of entries contained by the pids array.
  *
  * Returns 0 on success, else a negative LTTng error code.
  */
 int lttng_list_tracker_pids(struct lttng_handle *handle,
                int *_enabled, int32_t **_pids, size_t *_nr_pids)
 {
-       int ret, enabled = 1;
+       int ret;
+       int enabled = 1;
        struct lttcomm_session_msg lsm;
        size_t nr_pids;
        int32_t *pids;
This page took 0.023479 seconds and 4 git commands to generate.