From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 27108 invoked by alias); 12 Oct 2005 21:17:51 -0000 Mailing-List: contact systemtap-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Post: List-Help: , Sender: systemtap-owner@sources.redhat.com Received: (qmail 27099 invoked by uid 22791); 12 Oct 2005 21:17:48 -0000 Message-ID: <434D7DC5.6070005@us.ibm.com> Date: Wed, 12 Oct 2005 21:17:00 -0000 From: Kevin Stafford User-Agent: Mozilla Thunderbird 1.0.6-1.1.fc4 (X11/20050720) X-Accept-Language: en-us, en MIME-Version: 1.0 To: "Frank Ch. Eigler" CC: systemtap@sources.redhat.com Subject: Re: deref fault from alias, not from probe handler Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 8bit X-SW-Source: 2005-q4/txt/msg00040.txt.bz2 >> [...] >>> the two pointers being dereferenced are in user space, thus ineligible to use >>> the $ptr->field shortcut. >> [...] >> So here is how I am getting around this: >> /*________________CUT HERE________________*/> >> %{ >> #include >> %} >> probe times = >> kernel.function("sys_times") { >> name = "times" >> buf_tms_utime = __uget_tms_m($tbuf,0) >> buf_tms_stime = __uget_tms_m($tbuf,1) >> buf_tms_cutime = __uget_tms_m($tbuf,2) >> buf_tms_cstime = __uget_tms_m($tbuf,3) >> } >> probe times { >> log(string(buf_tms_utime)) >> log(string(buf_tms_stime)) >> log(string(buf_tms_cutime)) >> log(string(buf_tms_cstime)) >> } >> function __uget_tms_m:long(u_addr:long,member:long) >> %{ >> struct tms t; >> char *ptr = (char *)(unsigned long)THIS->u_addr; >> size_t sz = sizeof(struct tms); >> >> if(copy_from_user(&t,ptr,sz)) >> THIS->__retvalue = -EFAULT; >> switch(THIS->member) { >> case 0: THIS->__retvalue = t.tms_utime; >> break; >> case 1: THIS->__retvalue = t.tms_stime; >> break; >> case 2: THIS->__retvalue = t.tms_cutime; >> break; >> case 3: THIS->__retvalue = t.tms_cstime; >> break; >> default: THIS->__retvalue = -1; >> } >> %} >> /*________________CUT HERE________________*/ >> This script produces the following compiler >> error: >> >> In function ‘function___uget_tms_m’: >> /tmp/stapmFByii/stap_9586.c:194: error: storage size of ‘t’ isn’t known >> /tmp/stapmFByii/stap_9586.c:196: error: invalid application of ‘sizeof’ to >> incomplete type ‘struct tms’ >> >> This is the error one would receive if they had forgotten to include the header >> sys/times.h file. Although a quick verification proves otherwise: >> >> [root@localhost]# stap -vgp3 foo.stp > tmp.c >> [root@localhost]# grep sys/times.h tmp.c >> #include > > is a user-level header file. You probably need simply > or , whichever is the linux kernel standard way. > Any ideas on this one??? Thanks in advance. Thanks Frank. Your suggestion worked. -- Kevin Stafford DES 2 | MS 2M3 Beaverton - OR Linux Technology Center IBM Systems & Technology Phone: 1-503-578-3039 Email: kevinrs@us.ibm.com