Mirror of the lttng-dev mailing list
 help / color / mirror / Atom feed
From: nils.carlson@ericsson.com (Nils Carlson)
Subject: [ltt-dev] [UST PATCH 4/6] Add list-pids command to ustctl
Date: Fri, 1 Apr 2011 09:32:18 +0200	[thread overview]
Message-ID: <1301643140-6880-4-git-send-email-nils.carlson@ericsson.com> (raw)
In-Reply-To: <1301643140-6880-1-git-send-email-nils.carlson@ericsson.com>

Changes since v1:
	* Case pid_t to long

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..18f7d30 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("%ld\n", (long)pid_list[i]);
+	}
+
+	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





  parent reply	other threads:[~2011-04-01  7:32 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-04-01  7:32 [ltt-dev] [UST PATCH 1/6] Make app socket directories per-user v2 Nils Carlson
2011-04-01  7:14 ` Nils Carlson
2011-04-01  7:32 ` [ltt-dev] [UST PATCH 2/6] Add mode setting to socket directory creation Nils Carlson
2011-04-01  7:15   ` Nils Carlson
2011-04-01  7:32 ` [ltt-dev] [UST PATCH 3/6] Restructure the ustctl_get_online_pids command v2 Nils Carlson
2011-04-01  7:15   ` Nils Carlson
2011-04-01  7:32 ` Nils Carlson [this message]
2011-04-01  7:16   ` [ltt-dev] [UST PATCH 4/6] Add list-pids command to ustctl Nils Carlson
2011-04-01  7:32 ` [ltt-dev] [UST PATCH 5/6] Make root see all available pids Nils Carlson
2011-04-01  7:17   ` Nils Carlson
2011-04-01  7:32 ` [ltt-dev] [UST PATCH 6/6] Make root able to connect to any traceable app Nils Carlson
2011-04-01  7:17   ` Nils Carlson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1301643140-6880-4-git-send-email-nils.carlson@ericsson.com \
    --to=nils.carlson@ericsson.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox