X-Git-Url: http://git.lttng.org/?a=blobdiff_plain;f=ustctl%2Fustctl.c;fp=ustctl%2Fustctl.c;h=b9acc238670ac13a3bd545fb330df5482b3ff26e;hb=8b26d56b9988ac0c09999c14a08bc28d42551367;hp=c1bbe8ce0155289e2975325b6d5631d5ce45e254;hpb=bc549f166d7ece1bfd6d1a937019a7568b38b332;p=ust.git diff --git a/ustctl/ustctl.c b/ustctl/ustctl.c index c1bbe8c..b9acc23 100644 --- a/ustctl/ustctl.c +++ b/ustctl/ustctl.c @@ -106,21 +106,20 @@ int main(int argc, char *argv[]) static int list_trace_events(int argc, char *argv[]) { struct trace_event_status *tes = NULL; - int i; - pid_t pid; + int i, sock; - pid = parse_pid(argv[1]); + sock = parse_and_connect_pid(argv[1]); - if (ustctl_get_tes(&tes, pid)) { + if (ustctl_get_tes(sock, &tes)) { ERR("error while trying to list " - "trace_events for PID %u\n", - pid); + "trace_events for PID %s\n", + argv[1]); return -1; } i = 0; for (i = 0; tes[i].name; i++) { - printf("{PID: %u, trace_event: %s}\n", - pid, + printf("{PID: %s, trace_event: %s}\n", + argv[1], tes[i].name); } ustctl_free_tes(tes); @@ -130,12 +129,12 @@ static int list_trace_events(int argc, char *argv[]) static int set_sock_path(int argc, char *argv[]) { - pid_t pid; + int sock; - pid = parse_pid(argv[1]); + sock = parse_and_connect_pid(argv[1]); - if (ustctl_set_sock_path(argv[2], pid)) { - ERR("error while trying to set sock path for PID %u\n", pid); + if (ustctl_set_sock_path(sock, argv[2])) { + ERR("error while trying to set sock path for PID %s\n", argv[1]); return -1; } @@ -144,13 +143,13 @@ static int set_sock_path(int argc, char *argv[]) static int get_sock_path(int argc, char *argv[]) { - pid_t pid; + int sock; char *sock_path; - pid = parse_pid(argv[1]); + sock = parse_and_connect_pid(argv[1]); - if (ustctl_get_sock_path(&sock_path, pid)) { - ERR("error while trying to get sock path for PID %u\n", pid); + if (ustctl_get_sock_path(sock, &sock_path)) { + ERR("error while trying to get sock path for PID %s\n", argv[1]); return -1; } printf("The socket path is %s\n", sock_path);