Man page - aio(7)
Packages contains this manual
- shm_overview(7)
- nss(5)
- proc_mtrr(5)
- intro(7)
- tcp(7)
- iso_8859-9(7)
- armscii-8(7)
- proc_kpagecount(5)
- initrd(4)
- mouse(4)
- proc_stat(5)
- x25(7)
- proc_interrupts(5)
- fifo(7)
- repertoiremap(5)
- icmp(7)
- futex(7)
- feature_test_macros(7)
- lp(4)
- bpf-helpers(7)
- epoll(7)
- proc_sys_dev(5)
- namespaces(7)
- proc_sysrq-trigger(5)
- proc_bus(5)
- cp1251(7)
- proc_pid_maps(5)
- proc_sys_vm(5)
- proc_pid_projid_map(5)
- st(4)
- proc_pid(5)
- issue(5)
- pid_namespaces(7)
- unicode(7)
- inode(7)
- hosts.equiv(5)
- iso-8859-13(7)
- proc_fb(5)
- proc_modules(5)
- proc_pid_autogroup(5)
- keyrings(7)
- sysvipc(7)
- proc_kmsg(5)
- cgroups(7)
- latin6(7)
- proc_pid_uid_map(5)
- unix(7)
- proc_pid_io(5)
- pts(4)
- packet(7)
- ld-linux.so(8)
- tzselect(8)
- iconv(1)
- proc_pid_syscall(5)
- proc_pid_net(5)
- proc_pid_pagemap(5)
- tty(4)
- proc_profile(5)
- standards(7)
- proc_pid_mounts(5)
- filesystems(5)
- iso-8859-15(7)
- locale(5)
- iso_8859_3(7)
- xattr(7)
- iso-8859-2(7)
- proc_uptime(5)
- persistent-keyring(7)
- credentials(7)
- proc_pid_timers(5)
- utmpx(5)
- vcsa(4)
- proc_pid_exe(5)
- proc_net(5)
- proc_timer_stats(5)
- ip(7)
- proc_pid_fd(5)
- ptmx(4)
- user_namespaces(7)
- resolv.conf(5)
- url(7)
- iso_8859_5(7)
- iso_8859-8(7)
- urn(7)
- process-keyring(7)
- proc_pid_auxv(5)
- proc_ksyms(5)
- proc_ide(5)
- veth(4)
- ldd(1)
- proc_swaps(5)
- landlock(7)
- proc_vmstat(5)
- system_data_types(7)
- cp1252(7)
- lirc(4)
- proc_kpageflags(5)
- random(7)
- precedence(7)
- cpuset(7)
- proc_pid_ns(5)
- acct(5)
- latin4(7)
- proc_pid_cgroup(5)
- proc_cpuinfo(5)
- iso_8859-2(7)
- proc_keys(5)
- charsets(7)
- pldd(1)
- proc_pid_stat(5)
- rtnetlink(7)
- netlink(7)
- ram(4)
- mem(4)
- iso-8859-6(7)
- proc_key-users(5)
- iso_8859_15(7)
- fanotify(7)
- proc_sys_net(5)
- sysfs(5)
- math_error(7)
- latin1(7)
- proc_pid_root(5)
- nptl(7)
- proc_cgroups(5)
- proc_iomem(5)
- proc_pid_statm(5)
- sem_overview(7)
- hier(7)
- full(4)
- proc_pid_status(5)
- proc_pid_cwd(5)
- proc_pid_cpuset(5)
- proc_scsi(5)
- uri(7)
- proc_diskstats(5)
- iso_8859_6(7)
- latin2(7)
- latin5(7)
- man-pages(7)
- ld.so(8)
- uts_namespaces(7)
- proc_pid_mountstats(5)
- intro(3)
- proc_pid_seccomp(5)
- proc_pid_wchan(5)
- attributes(7)
- symlink(7)
- mount_namespaces(7)
- charmap(5)
- tis-620(7)
- iso-8859-10(7)
- getent(1)
- proc_buddyinfo(5)
- ttytype(5)
- rtc(4)
- proc_malloc(5)
- suffixes(7)
- sln(8)
- signal(7)
- proc_sys_abi(5)
- signal-safety(7)
- time_namespaces(7)
- proc_pid_comm(5)
- raw(7)
- gai.conf(5)
- proc_crypto(5)
- locale(1)
- iso-8859-3(7)
- motd(5)
- proc_meminfo(5)
- iso-8859-8(7)
- protocols(5)
- proc_pid_map_files(5)
- pthreads(7)
- null(4)
- proc(5)
- zdump(8)
- socket(7)
- proc_sys_kernel(5)
- ddp(7)
- memusagestat(1)
- hd(4)
- iso-8859-14(7)
- shells(5)
- pipe(7)
- glob(7)
- proc_self(5)
- network_namespaces(7)
- utmp(5)
- proc_kcore(5)
- nsswitch.conf(5)
- sd(4)
- iso-8859-5(7)
- iso_8859_16(7)
- man(7)
- iso_8859-6(7)
- dir_colors(5)
- mq_overview(7)
- vsock(7)
- ascii(7)
- thread-keyring(7)
- fs(5)
- proc_pid_attr(5)
- proc_sys_debug(5)
- proc_sys(5)
- proc_pid_cmdline(5)
- pty(7)
- services(5)
- cgroup_namespaces(7)
- securetty(5)
- netdevice(7)
- iso_8859_13(7)
- host.conf(5)
- proc_pid_setgroups(5)
- proc_slabinfo(5)
- sock_diag(7)
- iso_8859-14(7)
- iso-8859-11(7)
- iso_8859_11(7)
- operator(7)
- regex(7)
- wavelan(4)
- proc_sys_fs(5)
- nologin(5)
- proc_pci(5)
- koi8-r(7)
- erofs(5)
- intro(2)
- utf8(7)
- proc_kallsyms(5)
- proc_sysvipc(5)
- queue(7)
- proc_sys_sunrpc(5)
- intro(5)
- latin8(7)
- mtrace(1)
- ipc_namespaces(7)
- dsp56k(4)
- iso_8859_4(7)
- proc_pid_smaps(5)
- proc_cmdline(5)
- rpc(5)
- proc_tty(5)
- proc_version(5)
- smartpqi(4)
- proc_pid_timerslack_ns(5)
- aio(7)
- session-keyring(7)
- resolver(5)
- slabinfo(5)
- wtmp(5)
- iso_8859_9(7)
- proc_locks(5)
- mailaddr(7)
- proc_pid_oom_score(5)
- kmem(4)
- iconvconfig(8)
- iso_8859-7(7)
- glibc(7)
- hostname(7)
- proc_thread-self(5)
- ipv6(7)
- iso_8859_7(7)
- proc_kpagecgroup(5)
- core(5)
- time(7)
- units(7)
- proc_dma(5)
- loop(4)
- address_families(7)
- zero(4)
- intro(4)
- procfs(5)
- iso_8859-4(7)
- vdso(7)
- tmpfs(5)
- iso-8859-16(7)
- iso_8859_10(7)
- user-session-keyring(7)
- libc(7)
- proc_fs(5)
- koi8-u(7)
- latin3(7)
- proc_tid_children(5)
- proc_pid_limits(5)
- proc_pid_coredump_filter(5)
- iso_8859-15(7)
- arp(7)
- urandom(4)
- iso_8859-10(7)
- hpsa(4)
- proc_pid_environ(5)
- boot(7)
- ftm(7)
- ld-linux(8)
- proc_driver(5)
- loop-control(4)
- iso_8859-16(7)
- proc_filesystems(5)
- tzfile(5)
- sprof(1)
- proc_pid_task(5)
- proc_pid_oom_score_adj(5)
- proc_mounts(5)
- iso-8859-4(7)
- iso_8859-1(7)
- utf-8(7)
- iso_8859-13(7)
- intro(6)
- proc_timer_list(5)
- rtld-audit(7)
- iso_8859-3(7)
- group(5)
- sched(7)
- proc_pid_clear_refs(5)
- hosts(5)
- iso_8859-11(7)
- numa(7)
- iso_8859_2(7)
- locale(7)
- iso-8859-1(7)
- fuse(4)
- proc_tid(5)
- proc_execdomains(5)
- proc_pid_mountinfo(5)
- intro(8)
- iso_8859_8(7)
- proc_loadavg(5)
- proc_pid_oom_adj(5)
- re_format(7)
- iso_8859_14(7)
- zic(8)
- bootparam(7)
- inotify(7)
- posixoptions(7)
- proc_partitions(5)
- iso-8859-9(7)
- proc_pid_mem(5)
- networks(5)
- proc_sys_user(5)
- udp(7)
- proc_zoneinfo(5)
- latin10(7)
- proc_pid_fdinfo(5)
- proc_pid_stack(5)
- memusage(1)
- spufs(7)
- pkeys(7)
- path_resolution(7)
- proc_ioports(5)
- intro(1)
- ldconfig(8)
- msr(4)
- svipc(7)
- port(4)
- proc_pid_personality(5)
- cciss(4)
- latin9(7)
- capabilities(7)
- localedef(1)
- vcs(4)
- iso_8859-5(7)
- elf(5)
- proc_sys_proc(5)
- console_codes(4)
- random(4)
- iso-8859-7(7)
- termcap(5)
- cpuid(4)
- environ(7)
- string_copying(7)
- proc_pid_gid_map(5)
- queue(3)
- termio(7)
- user-keyring(7)
- complex(7)
- latin7(7)
- proc_config.gz(5)
- udplite(7)
- kernel_lockdown(7)
- proc_devices(5)
- proc_apm(5)
- iso_8859_1(7)
- proc_pid_numa_maps(5)
apt-get install manpages
Available languages:
en fr ja ruManual
AIO
名 前説 明
エ ラ ー
バ ー ジ ョ ン
準 拠
注 意
例
プ ロ グ ラ ム の ソ ー ス
関 連 項 目
こ の 文 書 に つ い て
名 前
aio - POSIX 非 同 期 I/O の 概 要
説 明
POSIX 非 同 期 (AIO) イ ン タ ー フ ェ ー ス を 使 う と 、 ア プ リ ケ ー シ ョ ン は 、 非 同 期 に (つ ま り 、 バ ッ ク グ ラ ウ ン ド で ) 実 行 さ れ る I/O 操 作 を 一 つ 以 上 発 行 で き る よ う に な る 。 ア プ リ ケ ー シ ョ ン は I/O 操 作 の 完 了 の 通 知 方 法 を 選 択 す る こ と が で き る 。 選 択 で き る 通 知 方 法 は 、 シ グ ナ ル の 配 送 、 ス レ ッ ド の 起 動 、 通 知 を 行 わ な い で あ る 。
POSIX AIO
イ ン タ ー フ ェ
ー ス は 以 下 の
関 数 で 構 成 さ
れ て い る 。
aio_read
(3)
読 み 出 し リ ク エ ス ト を キ ュ ー に 入 れ る 。 read (2) の 非 同 期 版 で あ る 。
aio_write (3)
書 き 込 み リ ク エ ス ト を キ ュ ー に 入 れ る 。 write (2) の 非 同 期 版 で あ る 。
aio_fsync (3)
フ ァ イ ル デ ィ ス ク リ プ タ ー に 対 し て 行 わ れ た I/O 操 作 の 同 期 (sync) リ ク エ ス ト を キ ュ ー に 入 れ る 。 fsync (2) や fdatasync (2) の 非 同 期 版 で あ る 。
aio_error (3)
キ ュ ー に 入 れ ら れ た I/O リ ク エ ス ト の エ ラ ー 状 態 を 取 得 す る 。
aio_return (3)
完 了 し た I/O リ ク エ ス ト の 終 了 ス テ ー タ ス を 取 得 す る 。
aio_suspend (3)
指 定 さ れ た I/O リ ク エ ス ト の 集 合 (要 素 は 一 つ 以 上 ) が 完 了 す る ま で 、 呼 び 出 し 側 の 実 行 を 停 止 (suspend) す る 。
aio_cancel (3)
指 定 さ れ た フ ァ イ ル デ ィ ス ク リ プ タ ー に 関 す る 完 了 し て い な い I/O リ ク エ ス ト の キ ャ ン セ ル を 試 み る 。
lio_listio (3)
一 回 の 関 数 呼 び 出 し で 複 数 の I/O リ ク エ ス ト を キ ュ ー に 入 れ る 。
aiocb ("非 同 期 I/O 制 御 ブ ロ ッ ク (asynchronous I/O control block)") 構 造 体 は 、 I/O 操 作 を 制 御 す る パ ラ メ ー タ ー を 定 義 す る 。 こ の 型 の 引 数 は 上 記 の 全 て の 関 数 で 使 用 さ れ て い る 。 こ の 構 造 体 は 以 下 の 通 り で あ る 。
#include <aiocb.h>
struct aiocb {
/* The order of these fields is implementation-dependent
*/
int aio_fildes;
/* File descriptor */
off_t aio_offset; /* File offset */
volatile void *aio_buf; /* Location of buffer */
size_t aio_nbytes; /* Length of transfer */
int aio_reqprio; /* Request priority */
struct sigevent aio_sigevent; /* Notification method */
int aio_lio_opcode; /* Operation to be performed;
lio_listio() only */
/* Various
implementation-internal fields not shown */
};
/* Operation codes for 'aio_lio_opcode': */
enum { LIO_READ, LIO_WRITE, LIO_NOP };
こ
の 構 造 体 の フ
ィ ー ル ド は 以
下 の 通 り で あ
る 。
aio_fildes
I/O 操 作 の 実 行 対 象 と な る フ ァ イ ル デ ィ ス ク リ プ タ ー 。
aio_offset
I/O 操 作 を 行 う フ ァ イ ル オ フ セ ッ ト を 示 す 。
aio_buf
読 み 出 し 操 作 、 書 き 込 み 操 作 で デ ー タ 転 送 に 使 用 さ れ る バ ッ フ ァ ー 。
aio_nbytes
aio_buf が 指 す バ ッ フ ァ ー の サ イ ズ 。
aio_reqprio
こ の フ ィ ー ル ド で は 、 呼 び 出 し た ス レ ッ ド の リ ア ル タ イ ム 優 先 度 か ら 減 算 す る 値 を 指 定 す る 。 こ の I/O リ ク エ ス ト の 実 行 の 優 先 度 を 決 定 す る た め に 使 用 さ れ る ( pthread_setschedparam (3) 参 照 )。 指 定 す る 値 は 0 と sysconf(_SC_AIO_PRIO_DELTA_MAX) が 返 す 値 の 間 で な け れ ば な ら な い 。 こ の フ ィ ー ル ド は 、 フ ァ イ ル 同 期 操 作 で は 無 視 さ れ る 。
aio_sigevent
こ の フ ィ ー ル ド は 、 非 同 期 I/O 操 作 が 完 了 し た 際 に 呼 び 出 し 側 に ど の よ う に 通 知 を 行 う か を 指 定 す る 構 造 体 で あ る 。 aio_sigevent.sigev_notify に 指 定 で き る 値 は 、 SIGEV_NONE , SIGEV_SIGNAL , SIGEV_THREAD で あ る 。 詳 細 は sigevent (7) を 参 照 。
aio_lio_opcode
実 行 さ れ る 操 作 の 種 別 。 lio_listio (3) で の み 使 用 さ れ る 。
上
記 の リ ス ト に
あ る 標 準 の 関
数 に 加 え て 、 GNU C
ラ イ ブ ラ リ で
は 以 下 に 示 す POSIX
AIO API に 対 す る 拡
張 が 提 供 さ れ
て い る 。
aio_init
(3)
glibc の POSIX AIO 実 装 の 動 作 を 調 整 す る パ ラ メ ー タ ー を 設 定 す る 。
エ ラ ー
|
EINVAL |
aiocb 構 造 体 の aio_reqprio フ ィ ー ル ド が 、 0 よ り 小 さ い か 、 sysconf(_SC_AIO_PRIO_DELTA_MAX) が 返 す 上 限 よ り も 大 き か っ た 。 |
バ ー ジ ョ ン
POSIX AIO イ ン タ ー フ ェ イ ス は glibc バ ー ジ ョ ン 2.1 以 降 で 提 供 さ れ て い る 。
準 拠
POSIX.1-2001, POSIX.1-2008.
注 意
使 用 前 に 制 御 ブ ロ ッ ク バ ッ フ ァ ー を 0 で 埋 め る の は よ い 考 え で あ る ( memset (3) 参 照 )。 I/O 操 作 が 実 行 中 の 間 は 、 制 御 ブ ロ ッ ク バ ッ フ ァ ー と aio_buf が 指 す バ ッ フ ァ ー を 変 更 し て は な ら な い 。 I/O 操 作 が 完 了 す る ま で 、 こ れ ら の バ ッ フ ァ ー は 有 効 な 状 態 に 保 た な け れ ば な ら な い 。
同 じ aiocb 構 造 体 を 使 っ て 、 同 時 に 複 数 の 非 同 期 の 読 み 出 し 操 作 や 書 き 込 み 操 作 を 行 っ た 場 合 に 、 ど の よ う な 結 果 に な る か は 未 定 義 で あ る 。
現 在 の Linux で は 、 POSIX AIO 実 装 は glibc に よ り ユ ー ザ ー 空 間 で 提 供 さ れ て い る 。 こ の た め 、 制 限 が い く つ か あ り 、 最 も 顕 著 な も の は 、 I/O 操 作 を 実 行 す る 複 数 の ス レ ッ ド の 管 理 コ ス ト が 高 く 、 ス ケ ー ラ ビ リ テ ィ に 欠 け る こ と で あ る 。 し ば ら く の 間 、 カ ー ネ ル の ス テ ー ト マ シ ン に よ る 非 同 期 I/O の 実 装 の 作 業 が 行 わ れ て い る が ( io_submit (2), io_setup (2), io_cancel (2), io_destroy (2), io_getevents (2) 参 照 )、 こ の 実 装 は ま だ POSIX AIO 実 装 を カ ー ネ ル シ ス テ ム コ ー ル に よ り 再 実 装 す る ほ ど 成 熟 し た も の て は な い 。
例
下 記 の プ ロ グ ラ ム は 、 コ マ ン ド ラ イ ン 引 数 で 指 定 さ れ た 名 前 の フ ァ イ ル を そ れ ぞ れ オ ー プ ン し 、 得 ら れ た フ ァ イ ル デ ィ ス ク リ プ タ ー に 対 す る リ ク エ ス ト を aio_read (3) を 使 っ て キ ュ ー に 入 れ る 。 そ の 後 、 こ の プ ロ グ ラ ム は ル ー プ に 入 り 、 定 期 的 に aio_error (3) を 使 っ て ま だ 実 行 中 の 各 I/O 操 作 を 監 視 す る 。 各 I/O リ ク エ ス ト は 、 シ グ ナ ル の 配 送 に よ る 完 了 通 知 が 行 わ れ る よ う に 設 定 さ れ る 。 全 て の I/O リ ク エ ス ト が 完 了 し た 後 、 aio_return (3) を 使 っ て そ れ ぞ れ の ス テ ー タ ス を 取 得 す る 。
SIGQUIT シ グ ナ ル (control-\ を タ イ プ す る と 生 成 で き る ) を 送 る と 、 こ の プ ロ グ ラ ム は aio_cancel (3) を 使 っ て 完 了 し て い な い 各 リ ク エ ス ト に キ ャ ン セ ル 要 求 を 送 る 。
以 下 は こ の プ ロ グ ラ ム を 実 行 し た 際 の 出 力 例 で あ る 。 こ の 例 で は 、 標 準 入 力 に 対 し て 2 つ の リ ク エ ス ト を 行 い 、 "abc" と "x" と い う 2 行 の 入 力 を 行 っ て い る 。
$
./a.out
/dev/stdin /dev/stdin
opened /dev/stdin on descriptor 3
opened /dev/stdin on descriptor 4
aio_error():
for request 0 (descriptor 3): In progress
for request 1 (descriptor 4): In progress
abc
I/O completion signal received
aio_error():
for request 0 (descriptor 3): I/O succeeded
for request 1 (descriptor 4): In progress
aio_error():
for request 1 (descriptor 4): In progress
x
I/O completion signal received
aio_error():
for request 1 (descriptor 4): I/O succeeded
All I/O requests completed
aio_return():
for request 0 (descriptor 3): 4
for request 1 (descriptor 4): 2
プ ロ グ ラ ム の ソ ー ス
#include
<fcntl.h>
#include <stdlib.h>
#include <unistd.h>
#include <stdio.h>
#include <errno.h>
#include <aio.h>
#include <signal.h>
#define BUF_SIZE 20 /* Size of buffers for read operations */
#define errExit(msg) do { perror(msg); exit(EXIT_FAILURE); } while (0)
struct ioRequest
{ /* Application-defined structure for tracking
I/O requests */
int reqNum;
int status;
struct aiocb *aiocbp;
};
static volatile
sig_atomic_t gotSIGQUIT = 0;
/* On delivery of SIGQUIT, we attempt to
cancel all outstanding I/O requests */
static void /*
Handler for SIGQUIT */
quitHandler(int sig)
{
gotSIGQUIT = 1;
}
#define IO_SIGNAL SIGUSR1 /* Signal used to notify I/O completion */
static void /*
Handler for I/O completion signal */
aioSigHandler(int sig, siginfo_t *si, void *ucontext)
{
if (si->si_code == SI_ASYNCIO) {
write(STDOUT_FILENO, "I/O completion signal
received\n", 31);
/* The
corresponding ioRequest structure would be available as
struct ioRequest *ioReq = si->si_value.sival_ptr;
and the file descriptor would then be available via
ioReq->aiocbp->aio_fildes */
}
}
int
main(int argc, char *argv[])
{
struct sigaction sa;
int s;
int numReqs; /* Total number of queued I/O requests */
int openReqs; /* Number of I/O requests still in progress
*/
if (argc < 2)
{
fprintf(stderr, "Usage: %s <pathname>
<pathname>...\n",
argv[0]);
exit(EXIT_FAILURE);
}
numReqs = argc - 1;
/* Allocate our arrays */
struct ioRequest
*ioList = calloc(numReqs, sizeof(*ioList));
if (ioList == NULL)
errExit("calloc");
struct aiocb
*aiocbList = calloc(numReqs, sizeof(*aiocbList));
if (aiocbList == NULL)
errExit("calloc");
/* Establish handlers for SIGQUIT and the I/O completion signal */
sa.sa_flags =
SA_RESTART;
sigemptyset(&sa.sa_mask);
sa.sa_handler =
quitHandler;
if (sigaction(SIGQUIT, &sa, NULL) == -1)
errExit("sigaction");
sa.sa_flags =
SA_RESTART | SA_SIGINFO;
sa.sa_sigaction = aioSigHandler;
if (sigaction(IO_SIGNAL, &sa, NULL) == -1)
errExit("sigaction");
/* Open each
file specified on the command line, and queue
a read request on the resulting file descriptor */
for (int j = 0;
j < numReqs; j++) {
ioList[j].reqNum = j;
ioList[j].status = EINPROGRESS;
ioList[j].aiocbp = &aiocbList[j];
ioList[j].aiocbp->aio_fildes
= open(argv[j + 1], O_RDONLY);
if (ioList[j].aiocbp->aio_fildes == -1)
errExit("open");
printf("opened %s on descriptor %d\n", argv[j +
1],
ioList[j].aiocbp->aio_fildes);
ioList[j].aiocbp->aio_buf
= malloc(BUF_SIZE);
if (ioList[j].aiocbp->aio_buf == NULL)
errExit("malloc");
ioList[j].aiocbp->aio_nbytes
= BUF_SIZE;
ioList[j].aiocbp->aio_reqprio = 0;
ioList[j].aiocbp->aio_offset = 0;
ioList[j].aiocbp->aio_sigevent.sigev_notify =
SIGEV_SIGNAL;
ioList[j].aiocbp->aio_sigevent.sigev_signo = IO_SIGNAL;
ioList[j].aiocbp->aio_sigevent.sigev_value.sival_ptr =
&ioList[j];
s =
aio_read(ioList[j].aiocbp);
if (s == -1)
errExit("aio_read");
}
openReqs = numReqs;
/* Loop, monitoring status of I/O requests */
while (openReqs
> 0) {
sleep(3); /* Delay between each monitoring step */
if (gotSIGQUIT) {
/* On receipt of
SIGQUIT, attempt to cancel each of the
outstanding I/O requests, and display status returned
from the cancellation requests */
printf("got SIGQUIT; canceling I/O requests: \n");
for (int j = 0;
j < numReqs; j++) {
if (ioList[j].status == EINPROGRESS) {
printf(" Request %d on descriptor %d:", j,
ioList[j].aiocbp->aio_fildes);
s = aio_cancel(ioList[j].aiocbp->aio_fildes,
ioList[j].aiocbp);
if (s == AIO_CANCELED)
printf("I/O canceled\n");
else if (s == AIO_NOTCANCELED)
printf("I/O not canceled\n");
else if (s == AIO_ALLDONE)
printf("I/O all done\n");
else
perror("aio_cancel");
}
}
gotSIGQUIT = 0;
}
/* Check the
status of each I/O request that is still
in progress */
printf("aio_error():\n");
for (int j = 0; j < numReqs; j++) {
if (ioList[j].status == EINPROGRESS) {
printf(" for request %d (descriptor %d): ",
j, ioList[j].aiocbp->aio_fildes);
ioList[j].status = aio_error(ioList[j].aiocbp);
switch
(ioList[j].status) {
case 0:
printf("I/O succeeded\n");
break;
case EINPROGRESS:
printf("In progress\n");
break;
case ECANCELED:
printf("Canceled\n");
break;
default:
perror("aio_error");
break;
}
if
(ioList[j].status != EINPROGRESS)
openReqs--;
}
}
}
printf("All I/O requests completed\n");
/* Check status return of all I/O requests */
printf("aio_return():\n");
for (int j = 0; j < numReqs; j++) {
ssize_t s;
s =
aio_return(ioList[j].aiocbp);
printf(" for request %d (descriptor %d): %zd\n",
j, ioList[j].aiocbp->aio_fildes, s);
}
exit(EXIT_SUCCESS);
}
関 連 項 目
io_cancel (2), io_destroy (2), io_getevents (2), io_setup (2), io_submit (2), aio_cancel (3), aio_error (3), aio_init (3), aio_read (3), aio_return (3), aio_write (3), lio_listio (3)
"Asynchronous I/O Support in Linux 2.5", Bhattacharya, Pratt, Pulavarty, and Morgan, Proceedings of the Linux Symposium, 2003, https://www.kernel.org/doc/ols/2003/ols2003-pages-351-366.pdf
こ の 文 書 に つ い て
こ の man ペ ー ジ は Linux man-pages プ ロ ジ ェ ク ト の リ リ ー ス 5.10 の 一 部 で あ る 。 プ ロ ジ ェ ク ト の 説 明 と バ グ 報 告 に 関 す る 情 報 は https://www.kernel.org/doc/man-pages/ に 書 か れ て い る 。