procfs: implement execargs for pr_psargs translator support
PATCH v4 1/1 procfs: implement execargs for pr_psargs translator support
Implement a new execargs built-in variable to provide the ps-style argument string for the current task. It is used in the psinfo translator for the pr_psargs member.
Due to BPF limitations, it is only possible to retrieve this information for the current task. The data is stored in the task's address space, and the only BPF helper that can access data in another task's address space is not allowed to be used in non-sleepable programs (such as tracing programs).
Signed-off-by Kris Van Hees <[email protected]>
Reviewed-by Eugene Loh <[email protected]>
--- bpf/Build | 1 + bpf/bvar_execargs.S | 97 +++++++++++++++++++ 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 | 5 +- dlibs/x86_64/5.12/procfs.d | 5 +- dlibs/x86_64/5.14/procfs.d | 5 +- dlibs/x86_64/5.16/procfs.d | 5 +- dlibs/x86_64/5.2/procfs.d | 5 +- dlibs/x86_64/5.6/procfs.d | 5 +- dlibs/x86_64/6.1/procfs.d | 5 +- dlibs/x86_64/6.10/procfs.d | 5 +- include/dtrace/dif_defines.h | 1 + libdtrace/dt_bpf.h | 21 ++-- libdtrace/dt_cc.c | 33 ++++++- libdtrace/dt_cg.c | 26 ++++- libdtrace/dt_dlibs.c | 3 + libdtrace/dt_open.c | 2 + libdtrace/procfs.d.in | 5 +- .../builtinvar/tst.psinfo-bug21974606.d | 4 +- .../builtinvar/tst.psinfo-bug22561297.d | 8 +- test/unittest/builtinvar/tst.psinfo.d | 8 +- test/unittest/builtinvar/tst.psinfo1.d | 8 +- test/unittest/proc/tst.pr_psargs.d | 36 +++++++ test/unittest/proc/tst.pr_psargs.r | 2 + test/unittest/proc/tst.pr_psargs_other_task.d | 37 +++++++ test/unittest/proc/tst.pr_psargs_other_task.r | 2 + test/unittest/variables/bvar/tst.execargs.d | 23 +++++ 34 files changed, 312 insertions(+), 77 deletions(-) create mode 100644 bpf/bvar_execargs.S create mode 100644 test/unittest/proc/tst.pr_psargs.d create mode 100644 test/unittest/proc/tst.pr_psargs.r create mode 100644 test/unittest/proc/tst.pr_psargs_other_task.d create mode 100644 test/unittest/proc/tst.pr_psargs_other_task.r create mode 100644 test/unittest/variables/bvar/tst.execargs.d
bpf/Build +1 -0
@@ -23,6 +23,7 @@ bpf_dlib_SRCDEPS = $(objdir)/include/.dir.stamp $(objdir)/include/bpf_asm_helper bpf_dlib_SOURCES = \ agg_lqbin.c agg_qbin.c \ basename.S \ + bvar_execargs.S \ cleanpath.S \ dirname.S \ get_agg.c \
bpf/bvar_execargs.S new file +97 -0
97 lines not on this page · raw message
dlibs/aarch64/5.11/procfs.d +1 -3
@@ -141,9 +141,7 @@ translator psinfo_t < struct task_struct *T > { : (struct tty_struct *)-1; pr_fname = T->comm; -/* - pr_psargs = stringof(get_psinfo(T)->__psinfo(psargs)); - */ + pr_psargs = d_execargs(T); pr_wstat = 0; /* pr_argc = get_psinfo(T)->__psinfo(argc);
dlibs/aarch64/5.12/procfs.d +1 -3
@@ -141,9 +141,7 @@ translator psinfo_t < struct task_struct *T > { : (struct tty_struct *)-1; pr_fname = T->comm; -/* - pr_psargs = stringof(get_psinfo(T)->__psinfo(psargs)); - */ + pr_psargs = d_execargs(T); pr_wstat = 0; /* pr_argc = get_psinfo(T)->__psinfo(argc);
dlibs/aarch64/5.14/procfs.d +1 -3
@@ -141,9 +141,7 @@ translator psinfo_t < struct task_struct *T > { : (struct tty_struct *)-1; pr_fname = T->comm; -/* - pr_psargs = stringof(get_psinfo(T)->__psinfo(psargs)); - */ + pr_psargs = d_execargs(T); pr_wstat = 0; /* pr_argc = get_psinfo(T)->__psinfo(argc);
dlibs/aarch64/5.16/procfs.d +1 -3
@@ -141,9 +141,7 @@ translator psinfo_t < struct task_struct *T > { : (struct tty_struct *)-1; pr_fname = T->comm; -/* - pr_psargs = stringof(get_psinfo(T)->__psinfo(psargs)); - */ + pr_psargs = d_execargs(T); pr_wstat = 0; /* pr_argc = get_psinfo(T)->__psinfo(argc);
dlibs/aarch64/5.2/procfs.d +1 -3
@@ -141,9 +141,7 @@ translator psinfo_t < struct task_struct *T > { : (struct tty_struct *)-1; pr_fname = T->comm; -/* - pr_psargs = stringof(get_psinfo(T)->__psinfo(psargs)); - */ + pr_psargs = d_execargs(T); pr_wstat = 0; /* pr_argc = get_psinfo(T)->__psinfo(argc);
dlibs/aarch64/5.6/procfs.d +1 -3
@@ -141,9 +141,7 @@ translator psinfo_t < struct task_struct *T > { : (struct tty_struct *)-1; pr_fname = T->comm; -/* - pr_psargs = stringof(get_psinfo(T)->__psinfo(psargs)); - */ + pr_psargs = d_execargs(T); pr_wstat = 0; /* pr_argc = get_psinfo(T)->__psinfo(argc);
dlibs/aarch64/6.1/procfs.d +1 -3
@@ -141,9 +141,7 @@ translator psinfo_t < struct task_struct *T > { : (struct tty_struct *)-1; pr_fname = T->comm; -/* - pr_psargs = stringof(get_psinfo(T)->__psinfo(psargs)); - */ + pr_psargs = d_execargs(T); pr_wstat = 0; /* pr_argc = get_psinfo(T)->__psinfo(argc);
dlibs/aarch64/6.10/procfs.d +1 -3
@@ -141,9 +141,7 @@ translator psinfo_t < struct task_struct *T > { : (struct tty_struct *)-1; pr_fname = T->comm; -/* - pr_psargs = stringof(get_psinfo(T)->__psinfo(psargs)); - */ + pr_psargs = d_execargs(T); pr_wstat = 0; /* pr_argc = get_psinfo(T)->__psinfo(argc);
dlibs/x86_64/5.11/procfs.d +2 -3
@@ -141,9 +141,8 @@ translator psinfo_t < struct task_struct *T > { : (struct tty_struct *)-1; pr_fname = T->comm; -/* - pr_psargs = stringof(get_psinfo(T)->__psinfo(psargs)); - */ + pr_psargs = T == curthread ? execargs + : "<unknown>"; pr_wstat = 0; /* pr_argc = get_psinfo(T)->__psinfo(argc);
dlibs/x86_64/5.12/procfs.d +2 -3
@@ -141,9 +141,8 @@ translator psinfo_t < struct task_struct *T > { : (struct tty_struct *)-1; pr_fname = T->comm; -/* - pr_psargs = stringof(get_psinfo(T)->__psinfo(psargs)); - */ + pr_psargs = T == curthread ? execargs + : "<unknown>"; pr_wstat = 0; /* pr_argc = get_psinfo(T)->__psinfo(argc);
dlibs/x86_64/5.14/procfs.d +2 -3
@@ -141,9 +141,8 @@ translator psinfo_t < struct task_struct *T > { : (struct tty_struct *)-1; pr_fname = T->comm; -/* - pr_psargs = stringof(get_psinfo(T)->__psinfo(psargs)); - */ + pr_psargs = T == curthread ? execargs + : "<unknown>"; pr_wstat = 0; /* pr_argc = get_psinfo(T)->__psinfo(argc);
dlibs/x86_64/5.16/procfs.d +2 -3
@@ -141,9 +141,8 @@ translator psinfo_t < struct task_struct *T > { : (struct tty_struct *)-1; pr_fname = T->comm; -/* - pr_psargs = stringof(get_psinfo(T)->__psinfo(psargs)); - */ + pr_psargs = T == curthread ? execargs + : "<unknown>"; pr_wstat = 0; /* pr_argc = get_psinfo(T)->__psinfo(argc);
dlibs/x86_64/5.2/procfs.d +2 -3
@@ -141,9 +141,8 @@ translator psinfo_t < struct task_struct *T > { : (struct tty_struct *)-1; pr_fname = T->comm; -/* - pr_psargs = stringof(get_psinfo(T)->__psinfo(psargs)); - */ + pr_psargs = T == curthread ? execargs + : "<unknown>"; pr_wstat = 0; /* pr_argc = get_psinfo(T)->__psinfo(argc);
dlibs/x86_64/5.6/procfs.d +2 -3
@@ -141,9 +141,8 @@ translator psinfo_t < struct task_struct *T > { : (struct tty_struct *)-1; pr_fname = T->comm; -/* - pr_psargs = stringof(get_psinfo(T)->__psinfo(psargs)); - */ + pr_psargs = T == curthread ? execargs + : "<unknown>"; pr_wstat = 0; /* pr_argc = get_psinfo(T)->__psinfo(argc);
dlibs/x86_64/6.1/procfs.d +2 -3
@@ -141,9 +141,8 @@ translator psinfo_t < struct task_struct *T > { : (struct tty_struct *)-1; pr_fname = T->comm; -/* - pr_psargs = stringof(get_psinfo(T)->__psinfo(psargs)); - */ + pr_psargs = T == curthread ? execargs + : "<unknown>"; pr_wstat = 0; /* pr_argc = get_psinfo(T)->__psinfo(argc);
dlibs/x86_64/6.10/procfs.d +2 -3
@@ -141,9 +141,8 @@ translator psinfo_t < struct task_struct *T > { : (struct tty_struct *)-1; pr_fname = T->comm; -/* - pr_psargs = stringof(get_psinfo(T)->__psinfo(psargs)); - */ + pr_psargs = T == curthread ? execargs + : "<unknown>"; pr_wstat = 0; /* pr_argc = get_psinfo(T)->__psinfo(argc);
include/dtrace/dif_defines.h +1 -0
@@ -162,6 +162,7 @@#define DIF_VAR_GID 0x011f#define DIF_VAR_ERRNO 0x0120#define DIF_VAR_CURCPU 0x0121 +#define DIF_VAR_EXECARGS 0x0122#define DIF_SUBR_RAND 0#define DIF_SUBR_MUTEX_OWNED 1
libdtrace/dt_bpf.h +12 -9
@@ -47,15 +47,18 @@ extern "C" {#define DT_CONST_TASK_TGID 12#define DT_CONST_TASK_REAL_PARENT 13#define DT_CONST_TASK_COMM 14 -#define DT_CONST_MUTEX_OWNER 15 -#define DT_CONST_RWLOCK_CNTS 16 -#define DT_CONST_DCTX_RODATA 17 -#define DT_CONST_RODATA_OFF 18 -#define DT_CONST_RODATA_SIZE 19 -#define DT_CONST_ZERO_OFF 20 -#define DT_CONST_STACK_OFF 21 -#define DT_CONST_STACK_SKIP 22 -#define DT_CONST_NPROBES 23 +#define DT_CONST_TASK_MM 15 +#define DT_CONST_TASK_MM_ARG_START 16 +#define DT_CONST_TASK_MM_ARG_END 17 +#define DT_CONST_MUTEX_OWNER 18 +#define DT_CONST_RWLOCK_CNTS 19 +#define DT_CONST_DCTX_RODATA 20 +#define DT_CONST_RODATA_OFF 21 +#define DT_CONST_RODATA_SIZE 22 +#define DT_CONST_ZERO_OFF 23 +#define DT_CONST_STACK_OFF 24 +#define DT_CONST_STACK_SKIP 25 +#define DT_CONST_NPROBES 26#define DT_BPF_LOG_SIZE_DEFAULT (UINT32_MAX >> 8)#define DT_BPF_LOG_SIZE_SMALL 4096
libdtrace/dt_cc.c +32 -1
@@ -1082,7 +1082,8 @@ dt_link_construct(dtrace_hdl_t *dtp, const dt_probe_t *prp, dtrace_difo_t *dp,case DT_CONST_TASK_PID :case DT_CONST_TASK_TGID :case DT_CONST_TASK_REAL_PARENT : -case DT_CONST_TASK_COMM : { +case DT_CONST_TASK_COMM : +case DT_CONST_TASK_MM : {ctf_file_t *cfp = dtp->dt_shared_ctf;ctf_id_t type;ctf_membinfo_t ctm;
@@ -1108,6 +1109,36 @@ dt_link_construct(dtrace_hdl_t *dtp, const dt_probe_t *prp, dtrace_difo_t *dp,case DT_CONST_TASK_COMM : rc =ctf_member_info (cfp, type,"comm" , &ctm);break ; +case DT_CONST_TASK_MM : + rc =ctf_member_info (cfp, type,"mm" , &ctm); +break ; + } +if (rc ==CTF_ERR ) + goto err_ctf; + nrp->dofr_data = ctm.ctm_offset /NBBY ; +continue ; + } +case DT_CONST_TASK_MM_ARG_START : +case DT_CONST_TASK_MM_ARG_END : { +ctf_file_t *cfp = dtp->dt_shared_ctf; +ctf_id_t type; +ctf_membinfo_t ctm; +int rc =0 ; + +if (!cfp) +return dt_set_errno (dtp,EDT_NOCTF ); + + type =ctf_lookup_by_name (cfp,"struct mm_struct" ); +if (type ==CTF_ERR ) + goto err_ctf; + +switch (idp->di_id) { +case DT_CONST_TASK_MM_ARG_START : + rc =ctf_member_info (cfp, type,"arg_start" , &ctm); +break ; +case DT_CONST_TASK_MM_ARG_END : + rc =ctf_member_info (cfp, type,"arg_end" , &ctm); +break ; }if (rc ==CTF_ERR ) goto err_ctf;
libdtrace/dt_cg.c +25 -1
@@ -3341,7 +3341,6 @@ dt_cg_load_var(dt_node_t *dnp, dt_irlist_t *dlp, dt_regset_t *drp) }/* built-in variables (note: args[] is handled in dt_cg_array_op) */ -/* Special case for arg0 through arg9; encode as args[n] */ if (idp->di_id >=DIF_VAR_ARG0 && idp->di_id <=DIF_VAR_ARG9 ) { fnp =dt_dlib_get_func (yypcb->pcb_hdl,"dt_bvar_args" ); idx = idp->di_id -DIF_VAR_ARG0 ;
@@ -3351,6 +3350,31 @@ dt_cg_load_var(dt_node_t *dnp, dt_irlist_t *dlp, dt_regset_t *drp) idp->di_id == DIF_VAR_PROBENAME) { fnp =dt_dlib_get_func (yypcb->pcb_hdl,"dt_bvar_probedesc" ); idx = idp->di_id; + } else if (idp->di_id == DIF_VAR_EXECARGS) { + fnp =dt_dlib_get_func (yypcb->pcb_hdl,"dt_bvar_execargs" ); +assert (fnp !=NULL ); + +if ((dnp->dn_reg =dt_regset_alloc (drp)) ==-1 ) +longjmp (yypcb->pcb_jmpbuf,EDT_NOREG ); + +dt_cg_tstring_alloc (yypcb, dnp); + +if (dt_regset_xalloc_args (drp) ==-1 ) +longjmp (yypcb->pcb_jmpbuf,EDT_NOREG ); + +dt_cg_access_dctx (BPF_REG_1 , dlp, drp,-1 ); +emit (dlp,BPF_LOAD (BPF_DW ,BPF_REG_2 ,BPF_REG_1 ,DCTX_MEM )); +emit (dlp,BPF_ALU64_IMM (BPF_ADD ,BPF_REG_2 , dnp->dn_tstring->dn_value)); +dt_regset_xalloc (drp,BPF_REG_0 ); +emite (dlp,BPF_CALL_FUNC (fnp->di_id), fnp); +dt_regset_free_args (drp); + +dt_cg_check_fault (yypcb); + +emit (dlp,BPF_MOV_REG (dnp->dn_reg,BPF_REG_0 )); +dt_regset_free (drp,BPF_REG_0 ); + +return ; } else {char *fn;
libdtrace/dt_dlibs.c +3 -0
@@ -89,6 +89,9 @@ static const dt_ident_t dt_bpf_symbols[] = {DT_BPF_SYMBOL_ID (TASK_TGID ,DT_IDENT_SCALAR ,DT_CONST_TASK_TGID ),DT_BPF_SYMBOL_ID (TASK_REAL_PARENT ,DT_IDENT_SCALAR ,DT_CONST_TASK_REAL_PARENT ),DT_BPF_SYMBOL_ID (TASK_COMM ,DT_IDENT_SCALAR ,DT_CONST_TASK_COMM ), +DT_BPF_SYMBOL_ID (TASK_MM ,DT_IDENT_SCALAR ,DT_CONST_TASK_MM ), +DT_BPF_SYMBOL_ID (TASK_MM_ARG_START ,DT_IDENT_SCALAR ,DT_CONST_TASK_MM_ARG_START ), +DT_BPF_SYMBOL_ID (TASK_MM_ARG_END ,DT_IDENT_SCALAR ,DT_CONST_TASK_MM_ARG_END ),DT_BPF_SYMBOL_ID (MUTEX_OWNER ,DT_IDENT_SCALAR ,DT_CONST_MUTEX_OWNER ),DT_BPF_SYMBOL_ID (RWLOCK_CNTS ,DT_IDENT_SCALAR ,DT_CONST_RWLOCK_CNTS ), DT_BPF_SYMBOL_ID(DCTX_RODATA, DT_IDENT_SCALAR, DT_CONST_DCTX_RODATA),
libdtrace/dt_open.c +2 -0
@@ -153,6 +153,8 @@ static const dt_ident_t _dtrace_globals[] = { &dt_idops_type, "uint64_t" }, {"errno" ,DT_IDENT_SCALAR ,0 ,DIF_VAR_ERRNO ,DT_ATTR_STABCMN ,DT_VERS_1_0 , &dt_idops_type, "int" }, +{ "execargs", DT_IDENT_SCALAR, 0, DIF_VAR_EXECARGS, + DT_ATTR_STABCMN, DT_VERS_2_0, &dt_idops_type, "string" }, { "execname", DT_IDENT_SCALAR, 0, DIF_VAR_EXECNAME, DT_ATTR_STABCMN, DT_VERS_1_0, &dt_idops_type, "string" }, { "exit", DT_IDENT_ACTFUNC, 0, DT_ACT_EXIT, DT_ATTR_STABCMN, DT_VERS_1_0,
libdtrace/procfs.d.in +2 -3
@@ -179,9 +179,8 @@ translator psinfo_t < struct task_struct *T > { : (struct tty_struct *)-1; pr_fname = T->comm; -/* - pr_psargs = stringof(get_psinfo(T)->__psinfo(psargs)); - */ + pr_psargs = T == curthread ? execargs + : "<unknown>"; pr_wstat = 0; /* pr_argc = get_psinfo(T)->__psinfo(argc);
test/unittest/builtinvar/tst.psinfo-bug21974606.d +1 -3
@@ -4,11 +4,9 @@ * Licensed under the Universal Permissive License v 1.0 as shown at * http://oss.oracle.com/licenses/upl. */ -/* @@xfail: dtv2 */ /* - * ASSERTION: - * To ensure pr_psargs does not have an (extra) trailing space. + * ASSERTION: To ensure pr_psargs does not have an (extra) trailing space. * * SECTION: Variables/Built-in Variables */
test/unittest/builtinvar/tst.psinfo-bug22561297.d +4 -4
@@ -4,11 +4,9 @@ * Licensed under the Universal Permissive License v 1.0 as shown at * http://oss.oracle.com/licenses/upl. */ -/* @@xfail: dtv2 */ /* - * ASSERTION: - * To print psinfo structure values from profile. + * ASSERTION: To print psinfo structure values from profile. * * SECTION: Variables/Built-in Variables */
@@ -32,12 +30,14 @@ tick-10ms printf("address of process = %p\n", curpsinfo->pr_addr); printf("address of controlling tty = %p\n", curpsinfo->pr_ttydev); printf("process name = %s\n", curpsinfo->pr_fname); - /* These are still getting faked */ printf("initial chars of arg list = %s\n", curpsinfo->pr_psargs); printf("wait status for zombie = %d\n", curpsinfo->pr_wstat); +/* + * These are not implemented yet. printf("initial argument count = %d\n", curpsinfo->pr_argc); printf("initial argument vector = %p\n", curpsinfo->pr_argv); printf("initial environment vector = %p\n", curpsinfo->pr_envp); + */ printf("process data model = %d\n", curpsinfo->pr_dmodel); printf("task id = %d\n", curpsinfo->pr_taskid); printf("project id = %d\n", curpsinfo->pr_projid);
test/unittest/builtinvar/tst.psinfo.d +4 -4
@@ -4,11 +4,9 @@ * Licensed under the Universal Permissive License v 1.0 as shown at * http://oss.oracle.com/licenses/upl. */ -/* @@xfail: dtv2 */ /* - * ASSERTION: - * To print psinfo structure values from profile. + * ASSERTION: To print psinfo structure values from profile. * * SECTION: Variables/Built-in Variables */
@@ -31,12 +29,14 @@ tick-10ms printf("address of process = %p\n", curpsinfo->pr_addr); printf("address of controlling tty = %p\n", curpsinfo->pr_ttydev); printf("process name = %s\n", curpsinfo->pr_fname); - /* These are still getting faked */ printf("initial chars of arg list = %s\n", curpsinfo->pr_psargs); printf("wait status for zombie = %d\n", curpsinfo->pr_wstat); +/* + * These are not implemented yet. printf("initial argument count = %d\n", curpsinfo->pr_argc); printf("initial argument vector = %p\n", curpsinfo->pr_argv); printf("initial environment vector = %p\n", curpsinfo->pr_envp); + */ printf("process data model = %d\n", curpsinfo->pr_dmodel); printf("task id = %d\n", curpsinfo->pr_taskid); printf("project id = %d\n", curpsinfo->pr_projid);
test/unittest/builtinvar/tst.psinfo1.d +4 -4
@@ -4,11 +4,9 @@ * Licensed under the Universal Permissive License v 1.0 as shown at * http://oss.oracle.com/licenses/upl. */ -/* @@xfail: dtv2 */ /* - * ASSERTION: - * To print psinfo structure values. + * ASSERTION: To print psinfo structure values. * * SECTION: Variables/Built-in Variables */
@@ -29,12 +27,14 @@ BEGIN printf("address of process = %p\n", curpsinfo->pr_addr); printf("address of controlling tty = %p\n", curpsinfo->pr_ttydev); printf("process name = %s\n", curpsinfo->pr_fname); - /* These are still getting faked */ printf("initial chars of arg list = %s\n", curpsinfo->pr_psargs); printf("wait status for zombie = %d\n", curpsinfo->pr_wstat); +/* + * These are not implemented yet. printf("initial argument count = %d\n", curpsinfo->pr_argc); printf("initial argument vector = %p\n", curpsinfo->pr_argv); printf("initial environment vector = %p\n", curpsinfo->pr_envp); + */ printf("process data model = %d\n", curpsinfo->pr_dmodel); printf("task id = %d\n", curpsinfo->pr_taskid); printf("project id = %d\n", curpsinfo->pr_projid);
test/unittest/proc/tst.pr_psargs.d new file +36 -0
@@ -0,0 +1,36 @@ +/* + * Oracle Linux DTrace. + * Copyright (c) 2025, Oracle and/or its affiliates. All rights reserved. + * Licensed under the Universal Permissive License v 1.0 as shown at + * http://oss.oracle.com/licenses/upl. + */ + +/* + * ASSERTION: psinfo->pr_psargs provides correct results. + */ + +#pragma D option destructive +#pragma D option quiet + +BEGIN +{ + mypid = pid; + system("/bin/echo TEST a b c "); +} + +proc:::exec-success +/progenyof(mypid) && curpsinfo->pr_psargs == "/bin/echo TEST a b c"/ +{ + trace(curpsinfo->pr_psargs); + exit(0); +} + +tick-1s +{ + exit(1); +} + +ERROR +{ + exit(1); +}
test/unittest/proc/tst.pr_psargs.r new file +2 -0
@@ -0,0 +1,2 @@ +TEST a b c +/bin/echo TEST a b c
test/unittest/proc/tst.pr_psargs_other_task.d new file +37 -0
@@ -0,0 +1,37 @@ +/* + * Oracle Linux DTrace. + * Copyright (c) 2025, Oracle and/or its affiliates. All rights reserved. + * Licensed under the Universal Permissive License v 1.0 as shown at + * http://oss.oracle.com/licenses/upl. + */ + +/* + * ASSERTION: psinfo->pr_psargs is only implemented for curthread + */ + +#pragma D option destructive +#pragma D option quiet + +BEGIN +{ + mypid = pid; + tsk = curthread; + system("/bin/echo TEST a b c "); +} + +proc:::exec-success +/progenyof(mypid) && curpsinfo->pr_psargs == "/bin/echo TEST a b c"/ +{ + trace(xlate < psinfo_t > (tsk).pr_psargs); + exit(0); +} + +tick-1s +{ + exit(1); +} + +ERROR +{ + exit(1); +}
test/unittest/proc/tst.pr_psargs_other_task.r new file +2 -0
@@ -0,0 +1,2 @@ +TEST a b c +<unknown>
test/unittest/variables/bvar/tst.execargs.d new file +23 -0
@@ -0,0 +1,23 @@ +/* + * Oracle Linux DTrace. + * Copyright (c) 2025, Oracle and/or its affiliates. All rights reserved. + * Licensed under the Universal Permissive License v 1.0 as shown at + * http://oss.oracle.com/licenses/upl. + */ + +/* + * ASSERTION: The 'execargs' variable value can be retrieved. + * + * SECTION: Variables/Built-in Variables/execargs + */ + +#pragma D option quiet + +BEGIN { + trace(execargs); + exit(0); +} + +ERROR { + exit(1); +}
Signature · 1 line
2.45.2