The member state of task_struct has been renamed to __state and its type
changed from long to unsigned int.
https://lore.kernel.org/linux-arch/20210611082810.970791107@infradead.org/
Signed-off-by: Alexander Egorenkov <egorenar(a)linux.ibm.com>
---
defs.h | 1 +
task.c | 8 +++++++-
2 files changed, 8 insertions(+), 1 deletion(-)
diff --git a/defs.h b/defs.h
index 6bb00e2..cd5bc1a 100644
--- a/defs.h
+++ b/defs.h
@@ -2290,6 +2290,7 @@ struct size_table { /* stash of commonly-used sizes */
long sk_buff_head_qlen;
long sk_buff_len;
long orc_entry;
+ long task_struct_state;
long task_struct_policy;
long pid;
long bpf_prog;
diff --git a/task.c b/task.c
index 36cf259..dfaf704 100644
--- a/task.c
+++ b/task.c
@@ -297,6 +297,9 @@ task_init(void)
}
MEMBER_OFFSET_INIT(task_struct_state, "task_struct",
"state");
+ MEMBER_SIZE_INIT(task_struct_state, "task_struct", "state");
+ if (INVALID_MEMBER(task_struct_state))
+ MEMBER_OFFSET_INIT(task_struct_state, "task_struct", "__state");
MEMBER_OFFSET_INIT(task_struct_exit_state, "task_struct",
"exit_state");
MEMBER_OFFSET_INIT(task_struct_pid, "task_struct", "pid");
MEMBER_OFFSET_INIT(task_struct_comm, "task_struct", "comm");
@@ -5926,7 +5929,10 @@ task_state(ulong task)
if (!tt->last_task_read)
return 0;
- state = ULONG(tt->task_struct + OFFSET(task_struct_state));
+ if (SIZE(task_struct_state) == sizeof(ulong))
+ state = ULONG(tt->task_struct + OFFSET(task_struct_state));
+ else
+ state = UINT(tt->task_struct + OFFSET(task_struct_state));
exit_state = VALID_MEMBER(task_struct_exit_state) ?
ULONG(tt->task_struct + OFFSET(task_struct_exit_state)) : 0;
--
2.31.1