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