X-Git-Url: http://git.lttng.org/?p=ust.git;a=blobdiff_plain;f=libustcmd%2Fustcmd.c;h=1c5894be4dd41657c88b721a62f1864db512fcb2;hp=c2a98459ce6fb069730966a441da0cafee6d87f7;hb=b2fb2f91912b59447459eecc4b41baf8154be1bf;hpb=d159ac37826eaebf4c1d87b8db0c5e5a8ccc0b00 diff --git a/libustcmd/ustcmd.c b/libustcmd/ustcmd.c index c2a9845..1c5894b 100644 --- a/libustcmd/ustcmd.c +++ b/libustcmd/ustcmd.c @@ -420,6 +420,56 @@ int ustcmd_get_cmsf(struct marker_status **cmsf, const pid_t pid) return 0; } +/** + * 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) +{ + char *cmd; + int result; + + asprintf(&cmd, "%s %s", "set_sock_path", sock_path); + + result = ustcmd_send_cmd(cmd, pid, NULL); + if (result != 1) { + free(cmd); + return USTCMD_ERR_GEN; + } + + free(cmd); + return 0; +} + +/** + * 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) +{ + char *cmd, *reply; + int result; + + asprintf(&cmd, "%s", "get_sock_path"); + + result = ustcmd_send_cmd(cmd, pid, &reply); + if (result != 1) { + free(cmd); + free(reply); + return USTCMD_ERR_GEN; + } + + free(cmd); + *sock_path = reply; + return 0; +} + /** * Sends a given command to a traceable process *