Add a complex list to task_struct in the linux kernel
How do I add a field to the struct task_struct in the sched.h file, the field consists of a linked list with a special non primitive node?
say i have this structure:
struct Node{
int counter;
char* buffer;
int sum;
}
and so on, and I want to add a list of such nodes? I don't want to re-implement the list with
struct Node{
int counter;
char* buffer;
int sum;
Node* next;
}
but I want to use struct list_head with the generic kernel list and not my implementation. But adding struct list_head to the task_struct just gives me another instance of task_struct while I want to add my special list with my specific fields.
In terms of C++, i want to add List to the struct_task so the file scehd.h will look something like
struct task_struct {
.
.
.
List<Node> myList;
.
.
}
How do i do that and how do I then how do initialize my node in the INIT_TASK macro?
What i'm trying to do is save a list of messages sent to each process, so i'm trying to make each process hold the string and the total number of messages the process received as my node. I have no idea how to implement it with the kernel list, and I don't want to add my own list.