Skip to content

KFunc bpf_timer_cancel_async

v7.0

Try to deactivate a timer without waiting for completion in all contexts.

Definition

Parameters

timer: bpf_timer to stop

Returns

  • 0 - the timer was not active
  • 1 - the timer was active
  • -1 - the timer callback is currently running and cannot be stopped
  • -ECANCELED - the timer will be cancelled asynchronously
  • -ENOMEM - out of memory while queueing async cancel
  • -EINVAL - the timer was not initialized
  • -ENOENT - racing with timer deletion

Signature

int bpf_timer_cancel_async(struct bpf_timer *timer)

Usage

Unlike bpf_timer_cancel, this helper can return -ECANCELED when cancellation is deferred asynchronously, which makes it suitable for contexts where waiting is undesirable.

Program types

The following program types can make use of this kfunc:

Example

Docs could be improved

This part of the docs is incomplete, contributions are very welcome