+#include "../hashtable/hash.h"
+
+/*
+ * Init command for tracer with cmd type and correct handle.
+ */
+static void init_command(int cmd, int handle, struct lttcomm_ust_msg *command)
+{
+ memset(command, 0, sizeof(struct lttcomm_ust_msg));
+
+ command->cmd = cmd;
+ command->handle = handle;
+}
+
+/*
+ * Generic send command to ust tracer. Caller must free reply.
+ */
+static struct lttcomm_ust_reply *send_command(int sock,
+ struct lttcomm_ust_msg *command)
+{
+ struct lttcomm_ust_reply *reply;
+
+ reply = ustcomm_send_command(sock, command);
+ if (reply == NULL) {
+ goto error;
+ }
+
+ if (reply->ret_code != LTTCOMM_OK) {
+ ERR("Return code (%d): %s", reply->ret_code,
+ lttcomm_get_readable_code(reply->ret_code));
+ goto error;
+ }
+
+ return reply;
+
+error:
+ return NULL;
+}