---
name: "io_destroy"
section: "2"
platform: "linux"
package: "man-pages"
version: "6.19-1"
release: "Arch Linux 2026-11-01"
platforms: ["linux"]
url: "https://new.carta.tech/io_destroy"
---

# io\_destroy(2)

destroy an asynchronous I/O context

## NAME

io\_destroy - destroy an asynchronous I/O context

## LIBRARY

Standard C library (*libc*, *-lc*)

## SYNOPSIS

```
#include <linux/aio_abi.h>    /* Definition of aio_context_t */
#include <sys/syscall.h>      /* Definition of SYS_* constants */
#include <unistd.h>
```

**int syscall(SYS\_io\_destroy, aio\_context\_t** *ctx\_id***);**

## DESCRIPTION

*Note*: you probably want to use the [**io\_destroy**(3)](/io_destroy/3.md) wrapper function provided by *libaio*; see VERSIONS.

The **io\_destroy**() system call will attempt to cancel all outstanding asynchronous I/O operations against *ctx\_id*, will block on the completion of all operations that could not be canceled, and will destroy the *ctx\_id*.

## RETURN VALUE

On success, **io\_destroy**() returns 0. On error, -1 is returned, and *errno* is set to indicate the error.

## ERRORS

- **EFAULT**

  *ctx\_id* was not a valid address.

- **EINVAL**

  The AIO context specified by *ctx\_id* is invalid.

- **ENOSYS**

  **io\_destroy**() is not implemented on this architecture.

## VERSIONS

*libaio* ⟨https://pagure.io/libaio⟩ provides a wrapper function with the same name, but different prototype and return value. You probably want to use that wrapper.

## STANDARDS

Linux.

## HISTORY

Linux 2.5.

## SEE ALSO

[**io\_cancel**(2)](/io_cancel/2.md), [**io\_getevents**(2)](/io_getevents/2.md), [**io\_setup**(2)](/io_setup/2.md), [**io\_submit**(2)](/io_submit/2.md), [**io\_destroy**(3)](/io_destroy/3.md), [**aio**(7)](/aio/7.md)
