ioctl_tty.2: Update DTR example
[man-pages.git] / man2 / io_cancel.2
blob248fe57917d108e3c145fe77e3ea2ba30ade8bb2
1 .\" Copyright (C) 2003 Free Software Foundation, Inc.
2 .\"
3 .\" %%%LICENSE_START(GPL_NOVERSION_ONELINE)
4 .\" This file is distributed according to the GNU General Public License.
5 .\" %%%LICENSE_END
6 .\"
7 .TH IO_CANCEL 2 2021-03-22 "Linux" "Linux Programmer's Manual"
8 .SH NAME
9 io_cancel \- cancel an outstanding asynchronous I/O operation
10 .SH SYNOPSIS
11 .nf
12 .BR "#include <linux/aio_abi.h>" "    /* Definition of needed types */"
13 .BR "#include <sys/syscall.h>" "      /* Definition of " SYS_* " constants */"
14 .B #include <unistd.h>
15 .PP
16 .BI "int syscall(SYS_io_cancel, aio_context_t " ctx_id ", struct iocb *" iocb ,
17 .BI "            struct io_event *" result );
18 .fi
19 .SH DESCRIPTION
20 .IR Note :
21 this page describes the raw Linux system call interface.
22 The wrapper function provided by
23 .I libaio
24 uses a different type for the
25 .I ctx_id
26 argument.
27 See NOTES.
28 .PP
29 The
30 .BR io_cancel ()
31 system call
32 attempts to cancel an asynchronous I/O operation previously submitted with
33 .BR io_submit (2).
34 The
35 .I iocb
36 argument describes the operation to be canceled and the
37 .I ctx_id
38 argument is the AIO context to which the operation was submitted.
39 If the operation is successfully canceled, the event will be copied into
40 the memory pointed to by
41 .I result
42 without being placed into the
43 completion queue.
44 .SH RETURN VALUE
45 On success,
46 .BR io_cancel ()
47 returns 0.
48 For the failure return, see NOTES.
49 .SH ERRORS
50 .TP
51 .B EAGAIN
52 The \fIiocb\fP specified was not canceled.
53 .TP
54 .B EFAULT
55 One of the data structures points to invalid data.
56 .TP
57 .B EINVAL
58 The AIO context specified by \fIctx_id\fP is invalid.
59 .TP
60 .B ENOSYS
61 .BR io_cancel ()
62 is not implemented on this architecture.
63 .SH VERSIONS
64 The asynchronous I/O system calls first appeared in Linux 2.5.
65 .SH CONFORMING TO
66 .BR io_cancel ()
67 is Linux-specific and should not be used
68 in programs that are intended to be portable.
69 .SH NOTES
70 You probably want to use the
71 .BR io_cancel ()
72 wrapper function provided by
73 .\" http://git.fedorahosted.org/git/?p=libaio.git
74 .IR libaio .
75 .PP
76 Note that the
77 .I libaio
78 wrapper function uses a different type
79 .RI ( io_context_t )
80 .\" But glibc is confused, since <libaio.h> uses 'io_context_t' to declare
81 .\" the system call.
82 for the
83 .I ctx_id
84 argument.
85 Note also that the
86 .I libaio
87 wrapper does not follow the usual C library conventions for indicating errors:
88 on error it returns a negated error number
89 (the negative of one of the values listed in ERRORS).
90 If the system call is invoked via
91 .BR syscall (2),
92 then the return value follows the usual conventions for
93 indicating an error: \-1, with
94 .I errno
95 set to a (positive) value that indicates the error.
96 .SH SEE ALSO
97 .BR io_destroy (2),
98 .BR io_getevents (2),
99 .BR io_setup (2),
100 .BR io_submit (2),
101 .BR aio (7)
102 .\" .SH AUTHOR
103 .\" Kent Yoder.