landlock_restrict_self.2: tfix
[man-pages.git] / man2 / bdflush.2
blob7eac1bea134c1369e9f49ccab719f6fd72c9ad9c
1 .\" Copyright (c) 1995 Michael Chastain (mec@shell.portal.com), 15 April 1995.
2 .\"
3 .\" SPDX-License-Identifier: GPL-2.0-or-later
4 .\"
5 .\" Modified 1997-01-31 by Eric S. Raymond <esr@thyrsus.com>
6 .\" Modified 2004-06-17 by Michael Kerrisk <mtk.manpages@gmail.com>
7 .\"
8 .TH BDFLUSH 2 2021-03-22 "Linux" "Linux Programmer's Manual"
9 .SH NAME
10 bdflush \- start, flush, or tune buffer-dirty-flush daemon
11 .SH SYNOPSIS
12 .nf
13 .B #include <sys/kdaemon.h>
14 .PP
15 .BI "int bdflush(int "  func ", long *" address );
16 .BI "int bdflush(int "  func ", long " data );
17 .fi
18 .PP
19 .IR Note :
20 There is no glibc wrapper for this system call; see VERSIONS.
21 .SH DESCRIPTION
22 .IR Note :
23 Since Linux 2.6,
24 .\" As noted in changes in the 2.5.12 source
25 this system call is deprecated and does nothing.
26 It is likely to disappear altogether in a future kernel release.
27 Nowadays, the task performed by
28 .BR bdflush ()
29 is handled by the kernel
30 .I pdflush
31 thread.
32 .PP
33 .BR bdflush ()
34 starts, flushes, or tunes the buffer-dirty-flush daemon.
35 Only a privileged process (one with the
36 .B CAP_SYS_ADMIN
37 capability) may call
38 .BR bdflush ().
39 .PP
41 .I func
42 is negative or 0, and no daemon has been started, then
43 .BR bdflush ()
44 enters the daemon code and never returns.
45 .PP
47 .I func
48 is 1,
49 some dirty buffers are written to disk.
50 .PP
52 .I func
53 is 2 or more and is even (low bit is 0), then
54 .I address
55 is the address of a long word,
56 and the tuning parameter numbered
57 .RI "(" "func" "\-2)/2"
58 is returned to the caller in that address.
59 .PP
61 .I func
62 is 3 or more and is odd (low bit is 1), then
63 .I data
64 is a long word,
65 and the kernel sets tuning parameter numbered
66 .RI "(" "func" "\-3)/2"
67 to that value.
68 .PP
69 The set of parameters, their values, and their valid ranges
70 are defined in the Linux kernel source file
71 .IR fs/buffer.c .
72 .SH RETURN VALUE
74 .I func
75 is negative or 0 and the daemon successfully starts,
76 .BR bdflush ()
77 never returns.
78 Otherwise, the return value is 0 on success and \-1 on failure, with
79 .I errno
80 set to indicate the error.
81 .SH ERRORS
82 .TP
83 .B EBUSY
84 An attempt was made to enter the daemon code after
85 another process has already entered.
86 .TP
87 .B EFAULT
88 .I address
89 points outside your accessible address space.
90 .TP
91 .B EINVAL
92 An attempt was made to read or write an invalid parameter number,
93 or to write an invalid value to a parameter.
94 .TP
95 .B EPERM
96 Caller does not have the
97 .B CAP_SYS_ADMIN
98 capability.
99 .SH VERSIONS
100 Since version 2.23, glibc no longer supports this obsolete system call.
101 .SH STANDARDS
102 .BR bdflush ()
103 is Linux-specific and should not be used in programs
104 intended to be portable.
105 .SH SEE ALSO
106 .BR sync (1),
107 .BR fsync (2),
108 .BR sync (2)