malloc.3: ffix
[man-pages.git] / man3 / aio_init.3
blob0388a053d5b0b893683a89edffccf397c2301447
1 .\" Copyright (c) 2010 by Michael Kerrisk <mtk.manpages@gmail.com>
2 .\"
3 .\" %%%LICENSE_START(VERBATIM)
4 .\" Permission is granted to make and distribute verbatim copies of this
5 .\" manual provided the copyright notice and this permission notice are
6 .\" preserved on all copies.
7 .\"
8 .\" Permission is granted to copy and distribute modified versions of this
9 .\" manual under the conditions for verbatim copying, provided that the
10 .\" entire resulting derived work is distributed under the terms of a
11 .\" permission notice identical to this one.
12 .\"
13 .\" Since the Linux kernel and libraries are constantly changing, this
14 .\" manual page may be incorrect or out-of-date.  The author(s) assume no
15 .\" responsibility for errors or omissions, or for damages resulting from
16 .\" the use of the information contained herein.  The author(s) may not
17 .\" have taken the same level of care in the production of this manual,
18 .\" which is licensed free of charge, as they might when working
19 .\" professionally.
20 .\"
21 .\" Formatted or processed versions of this manual, if unaccompanied by
22 .\" the source, must acknowledge the copyright and authors of this work.
23 .\" %%%LICENSE_END
24 .\"
25 .TH AIO_INIT 3  2020-08-13 "Linux" "Linux Programmer's Manual"
26 .SH NAME
27 aio_init \- asynchronous I/O initialization
28 .SH SYNOPSIS
29 .nf
30 .BR "#define _GNU_SOURCE" "         /* See feature_test_macros(7) */"
31 .B "#include <aio.h>"
32 .PP
33 .BI "void aio_init(const struct aioinit *" init );
34 .fi
35 .PP
36 Link with \fI\-lrt\fP.
37 .SH DESCRIPTION
38 The GNU-specific
39 .BR aio_init ()
40 function allows the caller to provide tuning hints to the
41 glibc POSIX AIO implementation.
42 Use of this function is optional, but to be effective,
43 it must be called before employing any other functions in the POSIX AIO API.
44 .PP
45 The tuning information is provided in the buffer pointed to by the argument
46 .IR init .
47 This buffer is a structure of the following form:
48 .PP
49 .in +4n
50 .EX
51 struct aioinit {
52     int aio_threads;    /* Maximum number of threads */
53     int aio_num;        /* Number of expected simultaneous
54                            requests */
55     int aio_locks;      /* Not used */
56     int aio_usedba;     /* Not used */
57     int aio_debug;      /* Not used */
58     int aio_numusers;   /* Not used */
59     int aio_idle_time;  /* Number of seconds before idle thread
60                            terminates (since glibc 2.2) */
61     int aio_reserved;
63 .EE
64 .in
65 .PP
66 The following fields are used in the
67 .I aioinit
68 structure:
69 .TP
70 .I aio_threads
71 This field specifies the maximum number of worker threads that
72 may be used by the implementation.
73 If the number of outstanding I/O operations exceeds this limit,
74 then excess operations will be queued until a worker thread becomes free.
75 If this field is specified with a value less than 1, the value 1 is used.
76 The default value is 20.
77 .TP
78 .I aio_num
79 This field should specify the maximum number of simultaneous I/O requests
80 that the caller expects to enqueue.
81 If a value less than 32 is specified for this field,
82 it is rounded up to 32.
83 .\" FIXME . But, if aio_num > 32, the behavior looks strange. See
84 .\" http://sourceware.org/bugzilla/show_bug.cgi?id=12083
85 The default value is 64.
86 .TP
87 .I aio_idle_time
88 This field specifies the amount of time in seconds that a
89 worker thread should wait for further requests before terminating,
90 after having completed a previous request.
91 The default value is 1.
92 .SH VERSIONS
93 The
94 .BR aio_init ()
95 function is available since glibc 2.1.
96 .SH CONFORMING TO
97 This function is a GNU extension.
98 .SH SEE ALSO
99 .BR aio (7)