use*_*828 0 c linux task linux-kernel android-kernel
给予struct task_struct合作。确定进程有多老的最佳方法是什么?
用于task_struct保存指向其下一个最小的兄弟姐妹和最大的孩子的特定指针。这在某些内核版本中似乎不再可用。
我专门使用 Android goldfish 内核。我一直在尝试学习如何使用该list_head结构来迭代进程,但我似乎无法弄清楚如何确定每个子进程或兄弟进程的年龄。
那么,什么成员或用法task_struct可以做到这一点?
我认为你可以在task_struct中使用real_start_time或start_time。它在流程创建时更新
struct timespec start_time; /* monotonic time */
struct timespec real_start_time; /* boot based time */
Run Code Online (Sandbox Code Playgroud)
注意:这是普通内核,不知道 Android 内核