+
+/**
+ * Set socket path
+ *
+ * @param sock_path Socket path
+ * @param pid Traced process ID
+ * @return 0 if successful, or error
+ */
+int ustcmd_set_sock_path(const char *sock_path, pid_t pid)
+{
+ int result;
+ struct ustcomm_header req_header, res_header;
+ struct ustcomm_single_field sock_path_msg;
+
+ result = ustcomm_pack_single_field(&req_header,
+ &sock_path_msg,
+ sock_path);
+ if (result < 0) {
+ errno = -result;
+ return -1;
+ }
+
+ req_header.command = SET_SOCK_PATH;
+
+ return do_cmd(pid, &req_header, (char *)&sock_path_msg,
+ &res_header, NULL);
+}
+
+/**
+ * Get socket path
+ *
+ * @param sock_path Pointer to where the socket path will be returned
+ * @param pid Traced process ID
+ * @return 0 if successful, or error
+ */
+int ustcmd_get_sock_path(char **sock_path, pid_t pid)
+{
+ int result;
+ struct ustcomm_header req_header, res_header;
+ struct ustcomm_single_field *sock_path_msg;
+
+ req_header.command = GET_SOCK_PATH;
+ req_header.size = 0;
+
+ result = do_cmd(pid, &req_header, NULL, &res_header,
+ (char **)&sock_path_msg);
+ if (result < 0) {
+ return -1;
+ }
+
+ result = ustcomm_unpack_single_field(sock_path_msg);
+ if (result < 0) {
+ return result;
+ }
+
+ *sock_path = strdup(sock_path_msg->field);
+
+ free(sock_path_msg);
+
+ return 0;
+}
+
+int ustcmd_force_switch(pid_t pid)
+{
+ struct ustcomm_header req_header, res_header;
+
+ req_header.command = FORCE_SUBBUF_SWITCH;
+ req_header.size = 0;
+
+ return do_cmd(pid, &req_header, NULL, &res_header, NULL);
+}
+