Skip to content

io_cancel

Intro

io_cancel() - cancels asynchronously submitted I/O operations

Description

io_cancel() cancels asynchronous I/O operations previously submitted using the io_submit() system call or other related system calls. The ctx_id argument specifies the I/O context from which cancellations are done. This argument must point to an existing I/O context which must initially be obtained using the io_setup() system call. The iocb argument points to the I/O control block previously submitted for the corresponding I/O operation which should be cancelled. Finally, the result argument, if non NULL, points to a struct io_event structure which will be written to with the results of the cancelled op. If NULL is passed as the result argument, this indicates that no results should be returned.

This call is useful when attempting to cancel previously-submitted I/O operations; however, since the I/O operations are already in progress, some operations may complete before being cancelled. Therefore, it is possible that some I/O operations may return even after this call. If this behaviour is undesired, an application should use the io_getevents() system call with a timeout of 0 and/or a small number of events to drain completed I/O operations before calling io_cancel().

Arguments

  • ctx_id:io_context_t - the I/O context from which cancellations are done
  • iocb:struct iocb* - pointer to the I/O control block previously submitted for an I/O operation
  • result:struct io_event*[OPT] - pointer to thestruct io_event structure which will be written to with the results of the cancelled op.

Available Tags

K - Originated from kernel-space. U - Originated from user space (for example, pointer to user space memory used to get it)

Hooks

do_io_cancel()

Type

Kprobe

Purpose

Hooked to capture instances of the io_cancel() syscall.

Example Use Case

The io_cancel() syscall can be used to cancel asynchronous I/O operations that have already been submitted, allowing the application to reclaim resources and/or abort operations that are no longer necessary.

Issues

It is possible that some I/O operations may return even after the io_cancel() syscall. If this behaviour is undesired, an application should use the io_getevents() system call with a timeout of 0 and/or a small number of events to drain completed I/O operations before calling io_cancel().

  • io_submit()
  • io_setup()
  • io_getevents()

This document was automatically generated by OpenAI and needs review. It might not be accurate and might contain errors. The authors of Tracee recommend that the user reads the "events.go" source file to understand the events and their arguments better.