[DTrace-devel] [PATCH] Update procfs.d.in for T->state to T->__state change

Eugene Loh eugene.loh at oracle.com
Thu Sep 23 13:14:33 PDT 2021


Reviewed-by: Eugene Loh <eugene.loh at oracle.com>

On 9/23/21 3:06 PM, Kris Van Hees wrote:
> Starting with v5.14 kernels, the 'state' member in the task_struct has
> been renamed as '__state'.
>
> Signed-off-by: Kris Van Hees<kris.van.hees at oracle.com>
> ---
>   libdtrace/procfs.d.in | 43 ++++++++++++++++++++++++-------------------
>   1 file changed, 24 insertions(+), 19 deletions(-)
>
> diff --git a/libdtrace/procfs.d.in b/libdtrace/procfs.d.in
> index b7a2b8d9..1c3caaf6 100644
> --- a/libdtrace/procfs.d.in
> +++ b/libdtrace/procfs.d.in
> @@ -157,6 +157,11 @@ define_for_kernel([[__task_sid]], [[ m4_dnl
>   	(m4_kver(4, 19, 0), [[T->signal->pids[PIDTYPE_SID]->numbers[0].nr]])]], m4_dnl
>   	[[T->group_leader->pids[2].pid->numbers[0].nr]]) m4_dnl
>   
> +m4_dnl 5.14 and above renamed state to be __state.
> +define_for_kernel([[__task_state]], [[ m4_dnl
> +	(m4_kver(5, 14, 0), [[T->__state]])]], m4_dnl
> +	[[T->state]]) m4_dnl
> +
>   #pragma D binding "1.0" translator
>   translator psinfo_t < struct task_struct *T > {
>   	pr_nlwp = 1;
> @@ -228,7 +233,7 @@ inline char SWAIT = 7;
>   m4_dnl 4.9 and above moved on_cpu into the task_struct
>   #pragma D binding "1.0" translator
>   translator lwpsinfo_t < struct task_struct *T > {
> -	pr_flag = (T->state & __TASK_STOPPED) ? PR_STOPPED : 0;
> +	pr_flag = (__task_state & __TASK_STOPPED) ? PR_STOPPED : 0;
>   /*
>   	pr_flag = ((T->t_state == TS_STOPPED) ? (PR_STOPPED |
>   	    ((!(T->t_schedflag & TS_PSTART)) ? PR_ISTOP : 0)) :
> @@ -257,24 +262,24 @@ translator lwpsinfo_t < struct task_struct *T > {
>   	pr_wchan = NULL;
>   	pr_stype = 0;
>   
> -	pr_state = (T->state & TASK_INTERRUPTIBLE) ? SSLEEP :
> -		   (T->state & TASK_UNINTERRUPTIBLE) ? SSLEEP :
> -		   (T->state & __TASK_STOPPED) ? SSTOP :
> -		   (T->state & __TASK_TRACED) ? SSTOP :
> -		   (T->state & EXIT_ZOMBIE) ? SZOMB :
> -		   (T->state & EXIT_DEAD) ? SZOMB :
> -		   (T->state & TASK_DEAD) ? SZOMB :
> -		   (T->state & TASK_WAKEKILL) ? SWAIT :
> -		   (T->state & TASK_WAKING) ? SWAIT : SRUN;
> -	pr_sname = (T->state & TASK_INTERRUPTIBLE) ? 'S' :
> -		   (T->state & TASK_UNINTERRUPTIBLE) ? 'S' :
> -		   (T->state & __TASK_STOPPED) ? 'T' :
> -		   (T->state & __TASK_TRACED) ? 'T' :
> -		   (T->state & EXIT_ZOMBIE) ? 'Z' :
> -		   (T->state & EXIT_DEAD) ? 'Z' :
> -		   (T->state & TASK_DEAD) ? 'Z' :
> -		   (T->state & TASK_WAKEKILL) ? 'W' :
> -		   (T->state & TASK_WAKING) ? 'W' : 'R';
> +	pr_state = (__task_state & TASK_INTERRUPTIBLE) ? SSLEEP :
> +		   (__task_state & TASK_UNINTERRUPTIBLE) ? SSLEEP :
> +		   (__task_state & __TASK_STOPPED) ? SSTOP :
> +		   (__task_state & __TASK_TRACED) ? SSTOP :
> +		   (__task_state & EXIT_ZOMBIE) ? SZOMB :
> +		   (__task_state & EXIT_DEAD) ? SZOMB :
> +		   (__task_state & TASK_DEAD) ? SZOMB :
> +		   (__task_state & TASK_WAKEKILL) ? SWAIT :
> +		   (__task_state & TASK_WAKING) ? SWAIT : SRUN;
> +	pr_sname = (__task_state & TASK_INTERRUPTIBLE) ? 'S' :
> +		   (__task_state & TASK_UNINTERRUPTIBLE) ? 'S' :
> +		   (__task_state & __TASK_STOPPED) ? 'T' :
> +		   (__task_state & __TASK_TRACED) ? 'T' :
> +		   (__task_state & EXIT_ZOMBIE) ? 'Z' :
> +		   (__task_state & EXIT_DEAD) ? 'Z' :
> +		   (__task_state & TASK_DEAD) ? 'Z' :
> +		   (__task_state & TASK_WAKEKILL) ? 'W' :
> +		   (__task_state & TASK_WAKING) ? 'W' : 'R';
>   
>   	pr_pri = T->prio;
>   	pr_name = T->comm;
> -- 2.33.0 _______________________________________________ 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