[ltt-dev] [UST PATCH 4/6] Add list-pids command to ustctl
Mathieu Desnoyers
compudj at krystal.dyndns.org
Thu Mar 31 15:31:09 EDT 2011
* Nils Carlson (nils.carlson at ericsson.com) wrote:
> Signed-off-by: Nils Carlson <nils.carlson at ericsson.com>
> ---
> ustctl/ustctl.c | 28 ++++++++++++++++++++++++++++
> 1 files changed, 28 insertions(+), 0 deletions(-)
>
> diff --git a/ustctl/ustctl.c b/ustctl/ustctl.c
> index 807af8c..040995b 100644
> --- a/ustctl/ustctl.c
> +++ b/ustctl/ustctl.c
> @@ -213,6 +213,25 @@ static int get_sock_path(int argc, char *argv[])
> return 0;
> }
>
> +static int list_pids(int argc, char *argv[])
> +{
> + pid_t *pid_list;
> + int i;
> +
> + pid_list = ustctl_get_online_pids();
> + if (!pid_list) {
> + return -1;
> + }
> +
> + for (i = 0; pid_list[i]; i++) {
> + printf("%d\n", pid_list[i]);
missing cast from pid_t to int here. If pid_t can ever become a long, I
would recomment a %ld format string.
Thanks,
Mathieu
> + }
> +
> + free(pid_list);
> +
> + return 0;
> +}
> +
> struct cli_cmd __cli_cmds general_cmds[] = {
> {
> .name = "list-trace-events",
> @@ -241,4 +260,13 @@ struct cli_cmd __cli_cmds general_cmds[] = {
> .desired_args = 1,
> .desired_args_op = CLI_EQ,
> },
> + {
> + .name = "list-pids",
> + .description = "List traceable pids",
> + .help_text = "list-pids\n"
> + "List the traceable pids for the current user\n",
> + .function = list_pids,
> + .desired_args = 0,
> + .desired_args_op = CLI_EQ,
> + },
> };
> --
> 1.7.1
>
>
> _______________________________________________
> ltt-dev mailing list
> ltt-dev at lists.casi.polymtl.ca
> http://lists.casi.polymtl.ca/cgi-bin/mailman/listinfo/ltt-dev
>
--
Mathieu Desnoyers
Operating System Efficiency R&D Consultant
EfficiOS Inc.
http://www.efficios.com
More information about the lttng-dev
mailing list