In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
This article introduces the relevant knowledge of "what is the kernel object linked list structure". In the operation process of actual cases, many people will encounter such difficulties. Next, let Xiaobian lead you to learn how to deal with these situations! I hope you can read carefully and learn something!
background
Learning kernel objects requires an understanding of basic data structures.
Most of the more complex data structures are kernel objects and derived data structures, most of which are composite structures based on linked lists.
A deep understanding of how kernel objects are organized and linked is required.
Chain link method 1
The next pointer to the next object structure.
Chain link method II
The next pointer to the (next) member of the linked list of the next object structure.
Entry memory address of kernel object (first address)
RT-Thread kernel object, using linked list link method II.
Therefore, you can get the address of the list of object structure members through the traversal of the linked list (the address of the first next member of the list is the first address of the list itself)
Given the addresses of the structure members, how do I find the first address of the structure itself?
The structure itself does not change, the size does not change, so the position of each member of the structure is fixed.
The address of a struct member is offset by a fixed amount relative to the first address.
RT-Thread Usage: rt_list_entry/** * @brief get the struct for this entry * @param node the entry point * @param type the type of structure * @param member the name of list in structure */#define rt_list_entry(node, type, member) \ rt_container_of(node, type, member)/** * rt_container_of - return the member address of ptr, if the type of ptr is the * struct type. */#define rt_container_of(ptr, type, member) \ ((type *)((char *)(ptr) - (unsigned long)(&((type *)0)->member)))type a; /* temporary variable, mainly to find the offset of the member */* address offset of member m */offset = &a.member -&a;/* if the address of a member m of the structure is known ptr */p = ptr - offset; /* ptr - (&a.m - &a) */
Suppose the first address of the struct is x and the offset of the member is: x+offset.
If the first address of the structure is 0, the address of the structure member is the offset of the member in the structure.
If you know the address of the member, find the offset of the member, and you can calculate the first address of the structure itself.
"What is the kernel object linked list structure" content is introduced here, thank you for reading. If you want to know more about industry-related knowledge, you can pay attention to the website. Xiaobian will output more high-quality practical articles for everyone!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.