Bug 519314

Summary: "type definition 'task_struct' not found" in task_pid() function
Product: Red Hat Enterprise Linux 5 Reporter: dongjibing <hdong>
Component: systemtapAssignee: Frank Ch. Eigler <fche>
Status: CLOSED ERRATA QA Contact: BaseOS QE <qe-baseos-auto>
Severity: medium Docs Contact:
Priority: low    
Version: 5.4CC: mjw, qcai, syeghiay
Target Milestone: rc   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2010-03-30 09:06:18 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On: 515829    
Bug Blocks:    

Description dongjibing 2009-08-26 03:15:18 UTC
Description of problem:
when call task_pid() function in systemtap script,an semantic error happen:

semantic error: type definition 'task_struct' not found: identifier '@cast' at /usr/share/systemtap/tapset/task.stp:62:12
        source:     return @cast(task, "task_struct", "kernel")->tgid
                           ^
Pass 2: analysis failed.  Try again with another '--vp 01' option.

Version-Release number of selected component (if applicable):

SystemTap translator/driver (version 0.9.7/0.141 non-git sources)

How reproducible:
100%

Steps to Reproduce:
1.
2.
3.
  
Actual results:


Expected results:


Additional info:

Comment 1 dongjibing 2009-08-26 03:28:33 UTC
require to have the kernel debuginfo package installed

-- 
Fedora Bugzappers volunteer triage team
https://fedoraproject.org/wiki/BugZappers

Comment 2 Mark Wielaard 2009-08-26 08:16:40 UTC
Could you give a full example?

With the following version:

$ stap -V SystemTap translator/driver (version 0.9.7/0.141 non-git sources)
Copyright (C) 2005-2009 Red Hat, Inc. and others
This is free software; see the source for copying conditions.
$ rpm -q systemtap kernel kernel-debuginfo
systemtap-0.9.7-5.el5
kernel-2.6.18-155.el5
kernel-debuginfo-2.6.18-155.el5

The following works fine for me:

$ stap -e 'probe begin { printf("pid: %d\n", task_pid(task_current())); exit(); }'
pid: 3190

Comment 3 Frank Ch. Eigler 2009-08-26 11:24:08 UTC
Without kernel-debuginfo, @cast() can do the job, but only if one
identifies the header file that declares the type. 

 @cast(ptr,"task_struct","kernel<linux/sched.h>"

Perhaps this change belongs to the tapset.

Comment 5 Frank Ch. Eigler 2009-10-20 17:21:38 UTC
systemtap upstream commit 8aa140d includes the fix from comment #3.

Comment 10 errata-xmlrpc 2010-03-30 09:06:18 UTC
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on therefore solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.

http://rhn.redhat.com/errata/RHBA-2010-0308.html