* Send command. Fill up the header and append the data.
*/
static int send_command(struct lttcomm_sock *sock,
- enum lttcomm_sessiond_command cmd, void *data, size_t size,
+ enum lttcomm_relayd_command cmd, void *data, size_t size,
int flags)
{
int ret;
/* Return session id or negative ret code. */
if (reply.ret_code != LTTNG_OK) {
- ret = -reply.ret_code;
- ERR("Relayd create session replied error %d", ret);
+ ret = -1;
+ ERR("Relayd create session replied error %d", reply.ret_code);
goto error;
} else {
ret = 0;
/* Return session id or negative ret code. */
if (reply.ret_code != LTTNG_OK) {
- ret = -reply.ret_code;
- ERR("Relayd add stream replied error %d", ret);
+ ret = -1;
+ ERR("Relayd add stream replied error %d", reply.ret_code);
} else {
/* Success */
ret = 0;
/* Return session id or negative ret code. */
if (reply.ret_code != LTTNG_OK) {
- ret = -reply.ret_code;
- ERR("Relayd close stream replied error %d", ret);
+ ret = -1;
+ ERR("Relayd close stream replied error %d", reply.ret_code);
} else {
/* Success */
ret = 0;
/* Return session id or negative ret code. */
if (reply.ret_code >= LTTNG_OK) {
- ret = -reply.ret_code;
- ERR("Relayd data pending replied error %d", ret);
+ ERR("Relayd data pending replied error %d", reply.ret_code);
}
/* At this point, the ret code is either 1 or 0 */
ret = reply.ret_code;
DBG("Relayd data is %s pending for stream id %" PRIu64,
- ret == 1 ? "NOT" : "", stream_id);
+ ret == 1 ? "" : "NOT", stream_id);
error:
return ret;
/*
* Check on the relayd side for a quiescent state on the control socket.
*/
-int relayd_quiescent_control(struct lttcomm_sock *sock)
+int relayd_quiescent_control(struct lttcomm_sock *sock,
+ uint64_t metadata_stream_id)
{
int ret;
+ struct lttcomm_relayd_quiescent_control msg;
struct lttcomm_relayd_generic_reply reply;
/* Code flow error. Safety net. */
DBG("Relayd checking quiescent control state");
+ msg.stream_id = htobe64(metadata_stream_id);
+
/* Send command */
- ret = send_command(sock, RELAYD_QUIESCENT_CONTROL, NULL, 0, 0);
+ ret = send_command(sock, RELAYD_QUIESCENT_CONTROL, &msg, sizeof(msg), 0);
if (ret < 0) {
goto error;
}
/* Return session id or negative ret code. */
if (reply.ret_code != LTTNG_OK) {
- ret = -reply.ret_code;
- ERR("Relayd quiescent control replied error %d", ret);
+ ret = -1;
+ ERR("Relayd quiescent control replied error %d", reply.ret_code);
goto error;
}
/* Return session id or negative ret code. */
if (reply.ret_code != LTTNG_OK) {
- ret = -reply.ret_code;
- ERR("Relayd begin data pending replied error %d", ret);
+ ret = -1;
+ ERR("Relayd begin data pending replied error %d", reply.ret_code);
goto error;
}