I'll try to read this code tomorrow, right now I don't really understand
what does it do and why.

However,

On 06/04, Jiri Olsa wrote:
>
>  struct uprobe_consumer {
> +     /*
> +      * The handler callback return value controls removal of the uprobe.
> +      *  0 on success, uprobe stays
> +      *  1 on failure, remove the uprobe
> +      *    console warning for anything else
> +      */
>       int (*handler)(struct uprobe_consumer *self, struct pt_regs *regs);

This is misleading. It is not about success/failure, it is about filtering.

consumer->handler() returns UPROBE_HANDLER_REMOVE if this consumer is not
interested in this task, so this uprobe can be removed (unless another
consumer returns 0).

> +/*
> + * Make sure all the uprobe consumers have only one type of entry
> + * callback registered (either handler or handler_session) due to
> + * different return value actions.
> + */
> +static int consumer_check(struct uprobe_consumer *curr, struct 
> uprobe_consumer *uc)
> +{
> +     if (!curr)
> +             return 0;
> +     if (curr->handler_session || uc->handler_session)
> +             return -EBUSY;
> +     return 0;
> +}

Hmm, I don't understand this code, it doesn't match the comment...

The comment says "all the uprobe consumers have only one type" but
consumer_check() will always fail if the the 1st or 2nd consumer has
->handler_session != NULL ?

Perhaps you meant

        if (!!curr->handler != !!uc->handler)
                return -EBUSY;

?

Oleg.


Reply via email to