Scroll to navigation

UTRACE_ATTACH_TASK(9) utrace core API UTRACE_ATTACH_TASK(9)

NAME

utrace_attach_task - attach new engine, or look up an attached engine

SYNOPSIS

struct utrace_engine * utrace_attach_task(struct task_struct * target, int flags, const struct utrace_engine_ops * ops, void * data);

ARGUMENTS

target

thread to attach to

flags

flag bits combined with OR, see below

ops

callback table for new engine

data

engine private data pointer

DESCRIPTION

The caller must ensure that the target thread does not get freed, i.e. hold a ref or be its parent. It is always safe to call this on current, or on the child pointer in a report_clone callback. For most other cases, it´s easier to use utrace_attach_pid instead.

UTRACE_ATTACH_CREATE

Create a new engine. If UTRACE_ATTACH_CREATE is not specified, you only look up an existing engine already attached to the thread.

UTRACE_ATTACH_EXCLUSIVE

Attempting to attach a second (matching) engine fails with -EEXIST.

UTRACE_ATTACH_MATCH_OPS

Only consider engines matching ops.

UTRACE_ATTACH_MATCH_DATA

Only consider engines matching data.

Calls with neither UTRACE_ATTACH_MATCH_OPS nor UTRACE_ATTACH_MATCH_DATA match the first among any engines attached to target. That means that UTRACE_ATTACH_EXCLUSIVE in such a call fails with -EEXIST if there are any engines on target at all.

May 2024 Kernel Hackers Manual 2.6.