[DTrace-devel] [PATCH 02/13] slight code refactoring to eliminate gratuitous differences between providers

Kris Van Hees kris.van.hees at oracle.com
Mon Jul 6 08:22:12 PDT 2020


I am OK with all but the last change.  That one should be put aside until a
later time when we can restructure the beginning of these files altogether.

On Wed, Jul 01, 2020 at 10:41:07PM -0400, eugene.loh at oracle.com wrote:
> From: Eugene Loh <eugene.loh at oracle.com>
> 
> Signed-off-by: Eugene Loh <eugene.loh at oracle.com>
> ---
>  libdtrace/dt_prov_dtrace.c  |  3 +--
>  libdtrace/dt_prov_fbt.c     |  2 +-
>  libdtrace/dt_prov_sdt.c     |  2 +-
>  libdtrace/dt_prov_syscall.c | 26 +++++++++++++-------------
>  4 files changed, 16 insertions(+), 17 deletions(-)
> 
> diff --git a/libdtrace/dt_prov_dtrace.c b/libdtrace/dt_prov_dtrace.c
> index 4f3ad4eb..507aa60f 100644
> --- a/libdtrace/dt_prov_dtrace.c
> +++ b/libdtrace/dt_prov_dtrace.c
> @@ -36,7 +36,6 @@ static int populate(dtrace_hdl_t *dtp)
>  	dt_provider_t	*prv;
>  	int		n = 0;
>  
> -
>  	prv = dt_provider_create(dtp, prvname, &dt_dtrace, &pattr);
>  	if (prv == NULL)
>  		return 0;
> @@ -60,7 +59,7 @@ static int populate(dtrace_hdl_t *dtp)
>   *	int dt_dtrace(dt_pt_regs *regs)
>   *
>   * The trampoline will populate a dt_bpf_context struct and then call the
> - * function that implements tha compiled D clause.  It returns the value that
> + * function that implements the compiled D clause.  It returns the value that
>   * it gets back from that function.
>   */
>  static void trampoline(dt_pcb_t *pcb)
> diff --git a/libdtrace/dt_prov_fbt.c b/libdtrace/dt_prov_fbt.c
> index 0efed358..2296fb41 100644
> --- a/libdtrace/dt_prov_fbt.c
> +++ b/libdtrace/dt_prov_fbt.c
> @@ -156,7 +156,7 @@ static int populate(dtrace_hdl_t *dtp)
>   *	int dt_fbt(dt_pt_regs *regs)
>   *
>   * The trampoline will populate a dt_bpf_context struct and then call the
> - * function that implements tha compiled D clause.  It returns the value that
> + * function that implements the compiled D clause.  It returns the value that
>   * it gets back from that function.
>   */
>  static void trampoline(dt_pcb_t *pcb)
> diff --git a/libdtrace/dt_prov_sdt.c b/libdtrace/dt_prov_sdt.c
> index 584291c8..380a1ef8 100644
> --- a/libdtrace/dt_prov_sdt.c
> +++ b/libdtrace/dt_prov_sdt.c
> @@ -307,7 +307,7 @@ static void trampoline(dt_pcb_t *pcb)
>  	dt_irlist_t	*dlp = &pcb->pcb_ir;
>  	struct bpf_insn	instr;
>  	uint_t		lbl_exit = dt_irlist_label(dlp);
> -	dt_ident_t	*idp = dt_dlib_get_var(pcb->pcb_hdl, "EPID");
> +	dt_ident_t	*idp;
>  
>  #define DCTX_FP(off)	(-(ushort_t)DCTX_SIZE + (ushort_t)(off))
>  
> diff --git a/libdtrace/dt_prov_syscall.c b/libdtrace/dt_prov_syscall.c
> index 16b18aa2..8f671f38 100644
> --- a/libdtrace/dt_prov_syscall.c
> +++ b/libdtrace/dt_prov_syscall.c
> @@ -40,19 +40,6 @@ static const char		modname[] = "vmlinux";
>  
>  #define SYSCALLSFS		EVENTSFS "syscalls/"
>  
> -/*
> - * We need to skip over an extra field: __syscall_nr.
> - */
> -#define SKIP_EXTRA_FIELDS	1
> -
> -static const dtrace_pattr_t	pattr = {
> -{ DTRACE_STABILITY_EVOLVING, DTRACE_STABILITY_EVOLVING, DTRACE_CLASS_COMMON },
> -{ DTRACE_STABILITY_PRIVATE, DTRACE_STABILITY_PRIVATE, DTRACE_CLASS_UNKNOWN },
> -{ DTRACE_STABILITY_PRIVATE, DTRACE_STABILITY_PRIVATE, DTRACE_CLASS_ISA },
> -{ DTRACE_STABILITY_EVOLVING, DTRACE_STABILITY_EVOLVING, DTRACE_CLASS_COMMON },
> -{ DTRACE_STABILITY_PRIVATE, DTRACE_STABILITY_PRIVATE, DTRACE_CLASS_ISA },
> -};
> -
>  struct syscall_data {
>  	dt_pt_regs	*regs;
>  	long		syscall_nr;
> @@ -67,6 +54,19 @@ struct syscall_data {
>  #define ENTRY_PREFIX	"sys_enter_"
>  #define EXIT_PREFIX	"sys_exit_"
>  
> +/*
> + * We need to skip over an extra field: __syscall_nr.
> + */
> +#define SKIP_EXTRA_FIELDS	1
> +
> +static const dtrace_pattr_t	pattr = {
> +{ DTRACE_STABILITY_EVOLVING, DTRACE_STABILITY_EVOLVING, DTRACE_CLASS_COMMON },
> +{ DTRACE_STABILITY_PRIVATE, DTRACE_STABILITY_PRIVATE, DTRACE_CLASS_UNKNOWN },
> +{ DTRACE_STABILITY_PRIVATE, DTRACE_STABILITY_PRIVATE, DTRACE_CLASS_ISA },
> +{ DTRACE_STABILITY_EVOLVING, DTRACE_STABILITY_EVOLVING, DTRACE_CLASS_COMMON },
> +{ DTRACE_STABILITY_PRIVATE, DTRACE_STABILITY_PRIVATE, DTRACE_CLASS_ISA },
> +};
> +
>  /* Scan the PROBE_LIST file and add probes for any syscalls events. */
>  static int populate(dtrace_hdl_t *dtp)
>  {
> -- 
> 2.18.2
> 
> 
> _______________________________________________
> DTrace-devel mailing list
> DTrace-devel at oss.oracle.com
> https://oss.oracle.com/mailman/listinfo/dtrace-devel



More information about the DTrace-devel mailing list