@cast
operator (first available in SystemTap 0.9) can be used to indicate the correct type of the object.
task.stp
tapset. The function returns the value of the state
field from a task_struct
pointed to by the long task
. The first argument of the @cast
operator, task
, is the pointer to the object. The second argument is the type to cast the object to, task_struct
. The third arument lists what file that the type definition information comes from and is optional. With the @cast
operator the various fields of this particular task_struct
task
can be accessed; in this example the state
field is obtained.
function task_state:long (task:long) { return @cast(task, "task_struct", "kernel<linux/sched.h>")->state }