OSDN Git Service

(split) LDP: Update original to LDP v3.40.
[linuxjm/LDP_man-pages.git] / original / man3 / aio_init.3
1 '\" t
2 .\" Copyright (c) 2010 by Michael Kerrisk <mtk.manpages@gmail.com>
3 .\"
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 .\"
24 .TH AIO_INIT 3  2012-04-26 "Linux" "Linux Programmer's Manual"
25 .SH NAME
26 aio_init \- asynchronous I/O initialization
27 .SH SYNOPSIS
28 .nf
29 .BR "#define _GNU_SOURCE" "         /* See feature_test_macros(7) */"
30 .B "#include <aio.h>"
31
32 .BI "void aio_init(const struct aioinit *" init );
33 .fi
34 .sp
35 Link with \fI\-lrt\fP.
36 .SH DESCRIPTION
37 The GNU-specific
38 .BR aio_init ()
39 function allows the caller to provide tuning hints to the
40 glibc POSIX AIO implementation.
41 Use of this function is optional, but to be effective,
42 it must be called before employing any other functions in the POSIX AIO API.
43
44 The tuning information is provided in the buffer pointed to by the argument
45 .IR init .
46 This buffer is a structure of the following form:
47 .PP
48 .in +4n
49 .nf
50 struct aioinit {
51     int aio_threads;    /* Maximum number of threads */
52     int aio_num;        /* Number of expected simultaneous
53                            requests */
54     int aio_locks;      /* Not used */
55     int aio_usedba;     /* Not used */
56     int aio_debug;      /* Not used */
57     int aio_numusers;   /* Not used */
58     int aio_idle_time;  /* Number of seconds before idle thread
59                            terminates (since glibc 2.2) */
60     int aio_reserved;
61 };
62 .fi
63 .in
64 .PP
65 The following fields are used in the
66 .I aioinit
67 structure:
68 .TP 15
69 .I aio_threads
70 This field specifies the maximum number of worker threads that
71 may be used by the implementation.
72 If the number of outstanding I/O operations exceeds this limit,
73 then excess operations will be queued until a worker thread becomes free.
74 If this field is specified with a value less than 1, the value 1 is used.
75 The default value is 20.
76 .TP
77 .I aio_num
78 This field should specify the maximum number of simultaneous I/O requests
79 that the caller expects to enqueue.
80 If a value less than 32 is specified for this field,
81 it is rounded up to 32.
82 .\" FIXME But, if aio_num > 32, the behavior looks strange. See
83 .\" http://sourceware.org/bugzilla/show_bug.cgi?id=12083
84 The default value is 64.
85 .TP
86 .I aio_idle_time
87 This field specifies the amount of time in seconds that a
88 worker thread should wait for further requests before terminating,
89 after having completed a previous request.
90 The default value is 1.
91 .SH VERSIONS
92 The
93 .BR aio_init ()
94 function is available since glibc 2.1.
95 .SH CONFORMING TO
96 This function is a GNU extension.
97 .SH SEE ALSO
98 .BR aio (7)