OSDN Git Service

(split) LDP: Update original to v3.37.
[linuxjm/LDP_man-pages.git] / original / man2 / bdflush.2
1 .\" Hey Emacs! This file is -*- nroff -*- source.
2 .\"
3 .\" Copyright (c) 1995 Michael Chastain (mec@shell.portal.com), 15 April 1995.
4 .\"
5 .\" This is free documentation; you can redistribute it and/or
6 .\" modify it under the terms of the GNU General Public License as
7 .\" published by the Free Software Foundation; either version 2 of
8 .\" the License, or (at your option) any later version.
9 .\"
10 .\" The GNU General Public License's references to "object code"
11 .\" and "executables" are to be interpreted as the output of any
12 .\" document formatting or typesetting system, including
13 .\" intermediate and printed output.
14 .\"
15 .\" This manual is distributed in the hope that it will be useful,
16 .\" but WITHOUT ANY WARRANTY; without even the implied warranty of
17 .\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18 .\" GNU General Public License for more details.
19 .\"
20 .\" You should have received a copy of the GNU General Public
21 .\" License along with this manual; if not, write to the Free
22 .\" Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111,
23 .\" USA.
24 .\"
25 .\" Modified 1997-01-31 by Eric S. Raymond <esr@thyrsus.com>
26 .\" Modified 2004-06-17 by Michael Kerrisk <mtk.manpages@gmail.com>
27 .\"
28 .TH BDFLUSH 2 2012-03-05 "Linux" "Linux Programmer's Manual"
29 .SH NAME
30 bdflush \- start, flush, or tune buffer-dirty-flush daemon
31 .SH SYNOPSIS
32 .nf
33 .B #include <sys/kdaemon.h>
34
35 .BI "int bdflush(int "  func ", long *" address );
36 .BI "int bdflush(int "  func ", long " data );
37 .fi
38 .SH DESCRIPTION
39 .IR Note :
40 Since Linux 2.6,
41 .\" As noted in a changes in the 2.5.12 source
42 this system call is deprecated and does nothing.
43 It is likely to disappear altogether in a future kernel release.
44 Nowadays, the task performed by
45 .BR bdflush ()
46 is handled by the kernel
47 .I pdflush
48 thread.
49
50 .BR bdflush ()
51 starts, flushes, or tunes the buffer-dirty-flush daemon.
52 Only a privileged process (one with the
53 .B CAP_SYS_ADMIN
54 capability) may call
55 .BR bdflush ().
56 .PP
57 If
58 .I func
59 is negative or 0, and no daemon has been started, then
60 .BR bdflush ()
61 enters the daemon code and never returns.
62 .PP
63 If
64 .I func
65 is 1,
66 some dirty buffers are written to disk.
67 .PP
68 If
69 .I func
70 is 2 or more and is even (low bit is 0), then
71 .I address
72 is the address of a long word,
73 and the tuning parameter numbered
74 .RI "(" "func" "\-2)/2"
75 is returned to the caller in that address.
76 .PP
77 If
78 .I func
79 is 3 or more and is odd (low bit is 1), then
80 .I data
81 is a long word,
82 and the kernel sets tuning parameter numbered
83 .RI "(" "func" "\-3)/2"
84 to that value.
85 .PP
86 The set of parameters, their values, and their valid ranges
87 are defined in the kernel source file
88 .IR fs/buffer.c .
89 .SH "RETURN VALUE"
90 If
91 .I func
92 is negative or 0 and the daemon successfully starts,
93 .BR bdflush ()
94 never returns.
95 Otherwise, the return value is 0 on success and \-1 on failure, with
96 .I errno
97 set to indicate the error.
98 .SH ERRORS
99 .TP
100 .B EBUSY
101 An attempt was made to enter the daemon code after
102 another process has already entered.
103 .TP
104 .B EFAULT
105 .I address
106 points outside your accessible address space.
107 .TP
108 .B EINVAL
109 An attempt was made to read or write an invalid parameter number,
110 or to write an invalid value to a parameter.
111 .TP
112 .B EPERM
113 Caller does not have the
114 .B CAP_SYS_ADMIN
115 capability.
116 .SH "CONFORMING TO"
117 .BR bdflush ()
118 is Linux-specific and should not be used in programs
119 intended to be portable.
120 .SH "SEE ALSO"
121 .BR fsync (2),
122 .BR sync (2),
123 .BR sync (8),
124 .BR update (8)