public inbox for systemtap@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] Add pgrp() context tapset function. Describe sid().
@ 2009-06-13 15:10 Przemyslaw Pawelczyk
  2009-06-15 19:51 ` Josh Stone
  0 siblings, 1 reply; 4+ messages in thread
From: Przemyslaw Pawelczyk @ 2009-06-13 15:10 UTC (permalink / raw)
  To: systemtap

* tapset/context.stp: Add pgrp() function.
* testsuite/buildok/context_test.stp: Add pgrp() call.
* stapfuncs.3stap.in: Describe pgrp() and sid().
---
 stapfuncs.3stap.in                 |    6 ++++++
 tapset/context.stp                 |   13 +++++++++++++
 testsuite/buildok/context_test.stp |    1 +
 3 files changed, 20 insertions(+), 0 deletions(-)

diff --git a/stapfuncs.3stap.in b/stapfuncs.3stap.in
index b9326fd..518ff2b 100644
--- a/stapfuncs.3stap.in
+++ b/stapfuncs.3stap.in
@@ -210,6 +210,12 @@ Return the id of the current process.
 ppid:long ()
 Return the id of the parent process.
 .TP
+pgrp:long ()
+Return the pgrp of the current process.
+.TP
+sid:long ()
+Return the sid of the current process.
+.TP
 uid:long ()
 Return the uid of the current process.
 .TP
diff --git a/tapset/context.stp b/tapset/context.stp
index 468421a..5be9f21 100644
--- a/tapset/context.stp
+++ b/tapset/context.stp
@@ -64,6 +64,19 @@ function ppid:long () %{ /* pure */
 %}
 
 /**
+ * sfunction pgrp - Returns the process group ID of the current process.
+ */
+function pgrp:long () %{ /* pure */
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 24)
+	struct signal_struct *ss = kread( &(current->signal) );
+	THIS->__retvalue = kread ( &(ss->pgrp) );
+	CATCH_DEREF_FAULT();
+#else
+	THIS->__retvalue = task_pgrp_nr_ns(current, &init_pid_ns);
+#endif
+%}
+
+/**
  * sfunction sid - Returns the session ID of the current process.
  * 
  * The session ID of a process is the process group ID of the session
diff --git a/testsuite/buildok/context_test.stp b/testsuite/buildok/context_test.stp
index acc4ea0..e58c899 100755
--- a/testsuite/buildok/context_test.stp
+++ b/testsuite/buildok/context_test.stp
@@ -18,5 +18,6 @@ probe begin {
 	printf("gid is %d\n", gid())
 	printf("egid is %d\n", egid())
 	printf("pp is %s\n", pp())
+	printf("pgrp is %d\n", pgrp())
 	printf("sid is %d\n", sid())
 }
-- 
1.5.6.5

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] Add pgrp() context tapset function. Describe sid().
  2009-06-13 15:10 [PATCH] Add pgrp() context tapset function. Describe sid() Przemyslaw Pawelczyk
@ 2009-06-15 19:51 ` Josh Stone
  2009-06-16  9:28   ` Mark Wielaard
  0 siblings, 1 reply; 4+ messages in thread
From: Josh Stone @ 2009-06-15 19:51 UTC (permalink / raw)
  To: Przemyslaw Pawelczyk; +Cc: systemtap

On 06/13/2009 07:58 AM, Przemyslaw Pawelczyk wrote:
> * tapset/context.stp: Add pgrp() function.
> * testsuite/buildok/context_test.stp: Add pgrp() call.
> * stapfuncs.3stap.in: Describe pgrp() and sid().

Applied, thanks.

Josh

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] Add pgrp() context tapset function. Describe sid().
  2009-06-15 19:51 ` Josh Stone
@ 2009-06-16  9:28   ` Mark Wielaard
  2009-06-16 13:11     ` Frank Ch. Eigler
  0 siblings, 1 reply; 4+ messages in thread
From: Mark Wielaard @ 2009-06-16  9:28 UTC (permalink / raw)
  To: Josh Stone; +Cc: Przemyslaw Pawelczyk, systemtap

On Mon, 2009-06-15 at 12:51 -0700, Josh Stone wrote:
> On 06/13/2009 07:58 AM, Przemyslaw Pawelczyk wrote:
> > * tapset/context.stp: Add pgrp() function.
> > * testsuite/buildok/context_test.stp: Add pgrp() call.
> > * stapfuncs.3stap.in: Describe pgrp() and sid().

Is there a way we can automate this? I have not been added new tapset
functions to the stapfuncs manual page since I thought they would be
autogenerated in the manual from the tapset description strings. They do
show up automagically in the tapset reference guide. It would be nice if
the stapfuncs.3stap man page could also be generated from that data.

Cheers,

Mark

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] Add pgrp() context tapset function. Describe sid().
  2009-06-16  9:28   ` Mark Wielaard
@ 2009-06-16 13:11     ` Frank Ch. Eigler
  0 siblings, 0 replies; 4+ messages in thread
From: Frank Ch. Eigler @ 2009-06-16 13:11 UTC (permalink / raw)
  To: Mark Wielaard; +Cc: Josh Stone, Przemyslaw Pawelczyk, systemtap


Mark Wielaard <mjw@redhat.com> writes:

> Is there a way we can automate this? [...]  They do show up
> automagically in the tapset reference guide. It would be nice if the
> stapfuncs.3stap man page could also be generated from that data.

Good idea.  It should not be too hard to make stapfuncs.3stap be a
generated table-of-contents of all the functions listed in the
generated tapset reference pages.

- FChE

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2009-06-16 13:11 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-06-13 15:10 [PATCH] Add pgrp() context tapset function. Describe sid() Przemyslaw Pawelczyk
2009-06-15 19:51 ` Josh Stone
2009-06-16  9:28   ` Mark Wielaard
2009-06-16 13:11     ` Frank Ch. Eigler

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).