Linux DTrace development list
 help / color / mirror / Atom feed
From: Kris Van Hees <kris.van.hees@oracle.com>
To: Kris Van Hees <kris.van.hees@oracle.com>
Cc: Eugene Loh <eugene.loh@oracle.com>,
	dtrace@lists.linux.dev, dtrace-devel@oss.oracle.com
Subject: Re: [PATCH 5/6] procfs: add 'execargs' global variable as inline
Date: Wed, 29 Jan 2025 01:45:52 -0500	[thread overview]
Message-ID: <Z5nOoPF05zuDGWr2@oracle.com> (raw)
In-Reply-To: <Z5mY0VUgun8jSNq/@oracle.com>

Actually, I am withdrawing this patch.  I forgot that we have curpsinfo as a
builtin, so execargs can be obtained as curpsinfo->pr_psargs, so there is no
need for a shorthand.

On Tue, Jan 28, 2025 at 09:56:17PM -0500, Kris Van Hees wrote:
> On Tue, Jan 28, 2025 at 07:53:51PM -0500, Eugene Loh wrote:
> > I'd like a little more context here.
> > 
> > Features:  There is a new execargs global variable.  I take it this is new
> > to D or an extension to the D language?  Would it make sense to call this a
> > built-in variable?  Are we also exposing a new function d_execargs()? 
> > Shouldn't there be tests for using execargs or d_execargs() in scripts?  I
> > cannot tell if we are adding new user features (which should be tested) or
> > not.
> 
> Yes, execargs is essentially a new built-in variable.  It is defined as an
> inline, simply doing d_execargs(curthread), so it is a short-hand to get to
> the pr_psargs info for the current task.
> 
> So it depends 100% on the d_execargs() implementation, which is a function
> that I added in order to implement the psinfo->pr_psargs translator
> functionality.
> 
> > Testing:  I see that the following patch (6/6) lifts some XFAILs on some
> > pr_psargs tests.  Should tst.psinfo.d be added to them? And should the
> > removal of XFAIL for test/unittest/builtinvar/tst.psinfo-bug21974606.d be
> > moved from that patch to this one?  And should there be correctness checks
> > for this output:  not simply "does this script not blow up?" but actually
> > "does this script produce correct or even just sensible output?"?
> 
> None of the existing tests should be moved here because they do not use the
> ezecargs variable (since it is new).  I'll add a few tests for this built-in
> specifically.  I'd be happy to even drop this patch and not add a new
> built-in, but it seems somehow odd not to provide it.
> 
> > I'll look more but am certainly unclear if we're talking new D features here
> > (and if so, why they're not tested).
> 
> > On 1/28/25 01:31, Kris Van Hees wrote:
> > 
> > > The 'execargs' global variable provides the psargs for curthread.
> > > 
> > > Signed-off-by: Kris Van Hees <kris.van.hees@oracle.com>
> > > ---
> > >   dlibs/aarch64/5.11/procfs.d | 4 ++++
> > >   dlibs/aarch64/5.12/procfs.d | 4 ++++
> > >   dlibs/aarch64/5.14/procfs.d | 4 ++++
> > >   dlibs/aarch64/5.16/procfs.d | 4 ++++
> > >   dlibs/aarch64/5.2/procfs.d  | 4 ++++
> > >   dlibs/aarch64/5.6/procfs.d  | 4 ++++
> > >   dlibs/aarch64/6.1/procfs.d  | 4 ++++
> > >   dlibs/aarch64/6.10/procfs.d | 4 ++++
> > >   dlibs/x86_64/5.11/procfs.d  | 4 ++++
> > >   dlibs/x86_64/5.12/procfs.d  | 4 ++++
> > >   dlibs/x86_64/5.14/procfs.d  | 4 ++++
> > >   dlibs/x86_64/5.16/procfs.d  | 4 ++++
> > >   dlibs/x86_64/5.2/procfs.d   | 4 ++++
> > >   dlibs/x86_64/5.6/procfs.d   | 4 ++++
> > >   dlibs/x86_64/6.1/procfs.d   | 4 ++++
> > >   dlibs/x86_64/6.10/procfs.d  | 4 ++++
> > >   libdtrace/procfs.d.in       | 4 ++++
> > >   17 files changed, 68 insertions(+)
> > > 
> > > diff --git a/dlibs/aarch64/5.11/procfs.d b/dlibs/aarch64/5.11/procfs.d
> > > index 70a43ddf..9c06fe1f 100644
> > > --- a/dlibs/aarch64/5.11/procfs.d
> > > +++ b/dlibs/aarch64/5.11/procfs.d
> > > @@ -261,6 +261,10 @@ inline string root = d_path(&(curthread->fs->root));
> > >   #pragma D attributes Stable/Stable/Common root
> > >   #pragma D binding "1.0" root
> > > +inline string execargs = d_execargs(curthread);
> > > +#pragma D attributes Stable/Stable/Common root
> > > +#pragma D binding "2.0" execargs
> > > +
> > >   inline int CLD_EXITED = 1;
> > >   #pragma D binding "1.0" CLD_EXITED
> > >   inline int CLD_KILLED = 2;
> > > diff --git a/dlibs/aarch64/5.12/procfs.d b/dlibs/aarch64/5.12/procfs.d
> > > index 70a43ddf..9c06fe1f 100644
> > > --- a/dlibs/aarch64/5.12/procfs.d
> > > +++ b/dlibs/aarch64/5.12/procfs.d
> > > @@ -261,6 +261,10 @@ inline string root = d_path(&(curthread->fs->root));
> > >   #pragma D attributes Stable/Stable/Common root
> > >   #pragma D binding "1.0" root
> > > +inline string execargs = d_execargs(curthread);
> > > +#pragma D attributes Stable/Stable/Common root
> > > +#pragma D binding "2.0" execargs
> > > +
> > >   inline int CLD_EXITED = 1;
> > >   #pragma D binding "1.0" CLD_EXITED
> > >   inline int CLD_KILLED = 2;
> > > diff --git a/dlibs/aarch64/5.14/procfs.d b/dlibs/aarch64/5.14/procfs.d
> > > index ef27bb70..2824d137 100644
> > > --- a/dlibs/aarch64/5.14/procfs.d
> > > +++ b/dlibs/aarch64/5.14/procfs.d
> > > @@ -261,6 +261,10 @@ inline string root = d_path(&(curthread->fs->root));
> > >   #pragma D attributes Stable/Stable/Common root
> > >   #pragma D binding "1.0" root
> > > +inline string execargs = d_execargs(curthread);
> > > +#pragma D attributes Stable/Stable/Common root
> > > +#pragma D binding "2.0" execargs
> > > +
> > >   inline int CLD_EXITED = 1;
> > >   #pragma D binding "1.0" CLD_EXITED
> > >   inline int CLD_KILLED = 2;
> > > diff --git a/dlibs/aarch64/5.16/procfs.d b/dlibs/aarch64/5.16/procfs.d
> > > index cad2d2c5..daf30745 100644
> > > --- a/dlibs/aarch64/5.16/procfs.d
> > > +++ b/dlibs/aarch64/5.16/procfs.d
> > > @@ -261,6 +261,10 @@ inline string root = d_path(&(curthread->fs->root));
> > >   #pragma D attributes Stable/Stable/Common root
> > >   #pragma D binding "1.0" root
> > > +inline string execargs = d_execargs(curthread);
> > > +#pragma D attributes Stable/Stable/Common root
> > > +#pragma D binding "2.0" execargs
> > > +
> > >   inline int CLD_EXITED = 1;
> > >   #pragma D binding "1.0" CLD_EXITED
> > >   inline int CLD_KILLED = 2;
> > > diff --git a/dlibs/aarch64/5.2/procfs.d b/dlibs/aarch64/5.2/procfs.d
> > > index 6b1b1b9c..3594e5e9 100644
> > > --- a/dlibs/aarch64/5.2/procfs.d
> > > +++ b/dlibs/aarch64/5.2/procfs.d
> > > @@ -261,6 +261,10 @@ inline string root = d_path(&(curthread->fs->root));
> > >   #pragma D attributes Stable/Stable/Common root
> > >   #pragma D binding "1.0" root
> > > +inline string execargs = d_execargs(curthread);
> > > +#pragma D attributes Stable/Stable/Common root
> > > +#pragma D binding "2.0" execargs
> > > +
> > >   inline int CLD_EXITED = 1;
> > >   #pragma D binding "1.0" CLD_EXITED
> > >   inline int CLD_KILLED = 2;
> > > diff --git a/dlibs/aarch64/5.6/procfs.d b/dlibs/aarch64/5.6/procfs.d
> > > index 70a43ddf..9c06fe1f 100644
> > > --- a/dlibs/aarch64/5.6/procfs.d
> > > +++ b/dlibs/aarch64/5.6/procfs.d
> > > @@ -261,6 +261,10 @@ inline string root = d_path(&(curthread->fs->root));
> > >   #pragma D attributes Stable/Stable/Common root
> > >   #pragma D binding "1.0" root
> > > +inline string execargs = d_execargs(curthread);
> > > +#pragma D attributes Stable/Stable/Common root
> > > +#pragma D binding "2.0" execargs
> > > +
> > >   inline int CLD_EXITED = 1;
> > >   #pragma D binding "1.0" CLD_EXITED
> > >   inline int CLD_KILLED = 2;
> > > diff --git a/dlibs/aarch64/6.1/procfs.d b/dlibs/aarch64/6.1/procfs.d
> > > index 4cb7b77c..2d52f079 100644
> > > --- a/dlibs/aarch64/6.1/procfs.d
> > > +++ b/dlibs/aarch64/6.1/procfs.d
> > > @@ -261,6 +261,10 @@ inline string root = d_path(&(curthread->fs->root));
> > >   #pragma D attributes Stable/Stable/Common root
> > >   #pragma D binding "1.0" root
> > > +inline string execargs = d_execargs(curthread);
> > > +#pragma D attributes Stable/Stable/Common root
> > > +#pragma D binding "2.0" execargs
> > > +
> > >   inline int CLD_EXITED = 1;
> > >   #pragma D binding "1.0" CLD_EXITED
> > >   inline int CLD_KILLED = 2;
> > > diff --git a/dlibs/aarch64/6.10/procfs.d b/dlibs/aarch64/6.10/procfs.d
> > > index 4cb7b77c..2d52f079 100644
> > > --- a/dlibs/aarch64/6.10/procfs.d
> > > +++ b/dlibs/aarch64/6.10/procfs.d
> > > @@ -261,6 +261,10 @@ inline string root = d_path(&(curthread->fs->root));
> > >   #pragma D attributes Stable/Stable/Common root
> > >   #pragma D binding "1.0" root
> > > +inline string execargs = d_execargs(curthread);
> > > +#pragma D attributes Stable/Stable/Common root
> > > +#pragma D binding "2.0" execargs
> > > +
> > >   inline int CLD_EXITED = 1;
> > >   #pragma D binding "1.0" CLD_EXITED
> > >   inline int CLD_KILLED = 2;
> > > diff --git a/dlibs/x86_64/5.11/procfs.d b/dlibs/x86_64/5.11/procfs.d
> > > index c2be76d8..7679db2e 100644
> > > --- a/dlibs/x86_64/5.11/procfs.d
> > > +++ b/dlibs/x86_64/5.11/procfs.d
> > > @@ -261,6 +261,10 @@ inline string root = d_path(&(curthread->fs->root));
> > >   #pragma D attributes Stable/Stable/Common root
> > >   #pragma D binding "1.0" root
> > > +inline string execargs = d_execargs(curthread);
> > > +#pragma D attributes Stable/Stable/Common root
> > > +#pragma D binding "2.0" execargs
> > > +
> > >   inline int CLD_EXITED = 1;
> > >   #pragma D binding "1.0" CLD_EXITED
> > >   inline int CLD_KILLED = 2;
> > > diff --git a/dlibs/x86_64/5.12/procfs.d b/dlibs/x86_64/5.12/procfs.d
> > > index c2be76d8..7679db2e 100644
> > > --- a/dlibs/x86_64/5.12/procfs.d
> > > +++ b/dlibs/x86_64/5.12/procfs.d
> > > @@ -261,6 +261,10 @@ inline string root = d_path(&(curthread->fs->root));
> > >   #pragma D attributes Stable/Stable/Common root
> > >   #pragma D binding "1.0" root
> > > +inline string execargs = d_execargs(curthread);
> > > +#pragma D attributes Stable/Stable/Common root
> > > +#pragma D binding "2.0" execargs
> > > +
> > >   inline int CLD_EXITED = 1;
> > >   #pragma D binding "1.0" CLD_EXITED
> > >   inline int CLD_KILLED = 2;
> > > diff --git a/dlibs/x86_64/5.14/procfs.d b/dlibs/x86_64/5.14/procfs.d
> > > index 28fada6d..3a348ebc 100644
> > > --- a/dlibs/x86_64/5.14/procfs.d
> > > +++ b/dlibs/x86_64/5.14/procfs.d
> > > @@ -261,6 +261,10 @@ inline string root = d_path(&(curthread->fs->root));
> > >   #pragma D attributes Stable/Stable/Common root
> > >   #pragma D binding "1.0" root
> > > +inline string execargs = d_execargs(curthread);
> > > +#pragma D attributes Stable/Stable/Common root
> > > +#pragma D binding "2.0" execargs
> > > +
> > >   inline int CLD_EXITED = 1;
> > >   #pragma D binding "1.0" CLD_EXITED
> > >   inline int CLD_KILLED = 2;
> > > diff --git a/dlibs/x86_64/5.16/procfs.d b/dlibs/x86_64/5.16/procfs.d
> > > index cad2d2c5..daf30745 100644
> > > --- a/dlibs/x86_64/5.16/procfs.d
> > > +++ b/dlibs/x86_64/5.16/procfs.d
> > > @@ -261,6 +261,10 @@ inline string root = d_path(&(curthread->fs->root));
> > >   #pragma D attributes Stable/Stable/Common root
> > >   #pragma D binding "1.0" root
> > > +inline string execargs = d_execargs(curthread);
> > > +#pragma D attributes Stable/Stable/Common root
> > > +#pragma D binding "2.0" execargs
> > > +
> > >   inline int CLD_EXITED = 1;
> > >   #pragma D binding "1.0" CLD_EXITED
> > >   inline int CLD_KILLED = 2;
> > > diff --git a/dlibs/x86_64/5.2/procfs.d b/dlibs/x86_64/5.2/procfs.d
> > > index 08696cf7..6ad926ee 100644
> > > --- a/dlibs/x86_64/5.2/procfs.d
> > > +++ b/dlibs/x86_64/5.2/procfs.d
> > > @@ -261,6 +261,10 @@ inline string root = d_path(&(curthread->fs->root));
> > >   #pragma D attributes Stable/Stable/Common root
> > >   #pragma D binding "1.0" root
> > > +inline string execargs = d_execargs(curthread);
> > > +#pragma D attributes Stable/Stable/Common root
> > > +#pragma D binding "2.0" execargs
> > > +
> > >   inline int CLD_EXITED = 1;
> > >   #pragma D binding "1.0" CLD_EXITED
> > >   inline int CLD_KILLED = 2;
> > > diff --git a/dlibs/x86_64/5.6/procfs.d b/dlibs/x86_64/5.6/procfs.d
> > > index c2be76d8..7679db2e 100644
> > > --- a/dlibs/x86_64/5.6/procfs.d
> > > +++ b/dlibs/x86_64/5.6/procfs.d
> > > @@ -261,6 +261,10 @@ inline string root = d_path(&(curthread->fs->root));
> > >   #pragma D attributes Stable/Stable/Common root
> > >   #pragma D binding "1.0" root
> > > +inline string execargs = d_execargs(curthread);
> > > +#pragma D attributes Stable/Stable/Common root
> > > +#pragma D binding "2.0" execargs
> > > +
> > >   inline int CLD_EXITED = 1;
> > >   #pragma D binding "1.0" CLD_EXITED
> > >   inline int CLD_KILLED = 2;
> > > diff --git a/dlibs/x86_64/6.1/procfs.d b/dlibs/x86_64/6.1/procfs.d
> > > index 4cb7b77c..2d52f079 100644
> > > --- a/dlibs/x86_64/6.1/procfs.d
> > > +++ b/dlibs/x86_64/6.1/procfs.d
> > > @@ -261,6 +261,10 @@ inline string root = d_path(&(curthread->fs->root));
> > >   #pragma D attributes Stable/Stable/Common root
> > >   #pragma D binding "1.0" root
> > > +inline string execargs = d_execargs(curthread);
> > > +#pragma D attributes Stable/Stable/Common root
> > > +#pragma D binding "2.0" execargs
> > > +
> > >   inline int CLD_EXITED = 1;
> > >   #pragma D binding "1.0" CLD_EXITED
> > >   inline int CLD_KILLED = 2;
> > > diff --git a/dlibs/x86_64/6.10/procfs.d b/dlibs/x86_64/6.10/procfs.d
> > > index 4cb7b77c..2d52f079 100644
> > > --- a/dlibs/x86_64/6.10/procfs.d
> > > +++ b/dlibs/x86_64/6.10/procfs.d
> > > @@ -261,6 +261,10 @@ inline string root = d_path(&(curthread->fs->root));
> > >   #pragma D attributes Stable/Stable/Common root
> > >   #pragma D binding "1.0" root
> > > +inline string execargs = d_execargs(curthread);
> > > +#pragma D attributes Stable/Stable/Common root
> > > +#pragma D binding "2.0" execargs
> > > +
> > >   inline int CLD_EXITED = 1;
> > >   #pragma D binding "1.0" CLD_EXITED
> > >   inline int CLD_KILLED = 2;
> > > diff --git a/libdtrace/procfs.d.in b/libdtrace/procfs.d.in
> > > index e9d50349..827d6b81 100644
> > > --- a/libdtrace/procfs.d.in
> > > +++ b/libdtrace/procfs.d.in
> > > @@ -307,6 +307,10 @@ inline string root = d_path(&(curthread->fs->root));
> > >   #pragma D attributes Stable/Stable/Common root
> > >   #pragma D binding "1.0" root
> > > +inline string execargs = d_execargs(curthread);
> > > +#pragma D attributes Stable/Stable/Common root
> > > +#pragma D binding "2.0" execargs
> > > +
> > >   inline int CLD_EXITED = 1;
> > >   #pragma D binding "1.0" CLD_EXITED
> > >   inline int CLD_KILLED = 2;

  reply	other threads:[~2025-01-29  6:46 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-01-28  6:31 [PATCH 5/6] procfs: add 'execargs' global variable as inline Kris Van Hees
2025-01-29  0:53 ` Eugene Loh
2025-01-29  2:56   ` Kris Van Hees
2025-01-29  6:45     ` Kris Van Hees [this message]
2025-01-30  3:59       ` Eugene Loh
2025-01-30  4:46         ` Kris Van Hees

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=Z5nOoPF05zuDGWr2@oracle.com \
    --to=kris.van.hees@oracle.com \
    --cc=dtrace-devel@oss.oracle.com \
    --cc=dtrace@lists.linux.dev \
    --cc=eugene.loh@oracle.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