I have written a func.bt file to use a structure in my kprobe routine.
/* func.bt */
struct FUNC_PARAMS
{
unsigned int client;
void * params;
unsigned int paramsSize;
unsigned int status;
};
/* This script provides a reasonable estimate of the time spent
* in processessing ioctls.
*/
BEGIN
But, when I run bpftrace func.bt
, I get the following error:
func.bt:34:19-41: ERROR: Unknown struct/union: 'FUNC_PARAMS'
Complete script:
struct FUNC_PARAMS
{
unsigned int client;
unsigned int paramsSize;
void *data;
unsigned int status;
};
kprobe:is_ioctl
{
@start[comm] = nsecs;
$temp = arg3;
@call_count[comm,$temp] = count(); // per process, per ioctl number count of ioctl calls
$client = ((FUNC_PARAMS *)arg2)->client;
printf("client: %x \n", $client);
}
kretprobe:is_ioctl /@start[comm]/
{
$delta = nsecs - @start[comm];
delete(@start[comm]);
}
Can someone please provide some pointers on how to use this structure correctly?