This is the mail archive of the systemtap@sourceware.org mailing list for the systemtap project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: dereferencing pointer to incomplete type ‘struct workqueue_struct’


jbusch175 / dsmith wrote:

>> [...]  However, the problem is iterating through that list in script
>> language. To do that correctly, you'd need embedded-C as you've got
>> here.  [...]

Iterating through the list in script language is possible though.
The workqueue structure is available via 
   p = @var("system_wq")
Its list_head field is accessible via
   n = @cast(p, "workqueue_struct")->list->next
One can get back to the workqueue_struct from a list pointer via
   p = & @container_of(n, "workqueue_struct", list)

So putting it together:

# stap -DMAXACTION=50000  -e '
probe oneshot { 
  p=@var("system_wq")
  while (max++ < 5000) {
    printf("p=%p name=%s\n", p, @cast(p,"workqueue_struct")->name$);
    n = @cast(p, "workqueue_struct")->list->next;
    ne = & @cast(p, "workqueue_struct")->list;
    if (n == ne) break;
    p = & @container_of(n, "workqueue_struct", list);
  }
}
'

- FChE


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]