This is the mail archive of the
systemtap@sourceware.org
mailing list for the systemtap project.
Re: dereferencing pointer to incomplete type ‘struct workqueue_struct’
- From: John Busch <jbusch175 at gmail dot com>
- To: Arkady <arkady dot miasnikov at gmail dot com>
- Cc: systemtap at sourceware dot org
- Date: Thu, 27 Apr 2017 09:02:02 -0400
- Subject: Re: dereferencing pointer to incomplete type ‘struct workqueue_struct’
- Authentication-results: sourceware.org; auth=none
- References: <CAFjMt-QXRXEaJWODDz98fw631H79WuGmRb1djspO9LcYA9a7tQ@mail.gmail.com> <CANA-60q+0+qcQotH0ocLLwF6hMF_f2Opr-tsUrfaupP7vemV=w@mail.gmail.com>
This worked for me. Thank you Arkady!
On Thu, Apr 27, 2017 at 3:07 AM, Arkady <arkady.miasnikov@gmail.com> wrote:
> The simplest way to resolve the problem is top copy the struct to the
> inline C code
>
> http://lxr.free-electrons.com/source/kernel/workqueue.c#L239
>
> On Wed, Apr 26, 2017 at 6:20 PM, John Busch <jbusch175@gmail.com> wrote:
>> Hello,
>>
>> I’m new to SystemTap, and trying to print information about kernel
>> work queues. I’ve used the example code in section 4.3 [1] of the
>> tutorial as my starting point, and I’m working on an up-to-date Fedora
>> 25 system.
>>
>> The example code in the tutorial works just fine. However, when I
>> essentially swap out variable and struct names to modify the example
>> to walk through workqueue_structs (instead of task_structs), I get a
>> “dereferencing pointer to incomplete type ‘struct workqueue_struct’”
>> compilation error on the line containing list_for_each_safe. Code
>> sample below.
>>
>> workqueue_struct is defined in workqueue.h [2] and workqueue.c [4],
>> and I’m trying to access the global variable system_wq [3, 5]. How
>> would I gain access to these objects in systemtap? I must be doing
>> something wrong, but can't figure out what it is.
>>
>> Thanks!
>>
>> [1] https://sourceware.org/systemtap/tutorial/Tapsets.html
>> [2] http://lxr.free-electrons.com/source/include/linux/workqueue.h#L16
>> [3] http://lxr.free-electrons.com/source/include/linux/workqueue.h#L365
>> [4] http://lxr.free-electrons.com/source/kernel/workqueue.c#L239
>> [5] http://lxr.free-electrons.com/source/kernel/workqueue.c#L338
>>
>> %{
>> #include <linux/workqueue.h>
>> #include <linux/list.h>
>> %}
>>
>> function read_wq_list:long ()
>> %{
>> int ret = 0;
>> struct workqueue_struct *wq;
>> struct list_head *p, *n;
>>
>> list_for_each_safe(p, n, system_wq->list) {
>> wq = list_entry(p, struct workqueue_struct, list);
>> _stp_printf("workqueue struct %s\n", wq->name);
>> }
>>
>> STAP_RETURN(ret);
>> %}
>>
>> probe begin
>> {
>> printf("reading list of workqueues\n")
>> read_wq_list()
>> exit()
>> }