Debian Codegraph @

upstream/debian-unstable/man2/F_GETPIPE_SZ.2const

raw
1 .\" Copyright, the authors of the Linux man-pages project
2 .\"
3 .\" SPDX-License-Identifier: Linux-man-pages-copyleft
4 .\"
5 .TH F_GETPIPE_SZ 2const 2025-09-21 "Linux man-pages 6.18"
6 .SH NAME
7 F_GETPIPE_SZ,
8 F_SETPIPE_SZ
9 \-
10 get/set the capacity of a pipe
11 .SH LIBRARY
12 Standard C library
13 .RI ( libc ,\~ \-lc )
14 .SH SYNOPSIS
15 .nf
16 .B #define _GNU_SOURCE
17 .B #include <fcntl.h>
18 .P
19 .BI "int fcntl(int " fd ", F_SETPIPE_SZ, int " arg );
20 .BI "int fcntl(int " fd ", F_GETPIPE_SZ);"
21 .fi
22 .SH DESCRIPTION
23 .TP
24 .B F_SETPIPE_SZ
25 Change the capacity of the pipe referred to by
26 .I fd
27 to be at least
28 .I arg
29 bytes.
30 An unprivileged process can adjust the pipe capacity to any value
31 between the system page size and the limit defined in
32 .I /proc/sys/fs/pipe\-max\-size
33 (see
34 .BR proc_sys_fs (5)).
35 Attempts to set the pipe capacity below the page size are silently
36 rounded up to the page size.
37 Attempts by an unprivileged process to set the pipe capacity above the limit in
38 .I /proc/sys/fs/pipe\-max\-size
39 yield the error
40 .BR EPERM ;
41 a privileged process
42 .RB ( CAP_SYS_RESOURCE )
43 can override the limit.
44 .IP
45 When allocating the buffer for the pipe,
46 the kernel may use a capacity larger than
47 .IR arg ,
48 if that is convenient for the implementation.
49 (In the current implementation,
50 the allocation is the next higher power-of-two page-size multiple
51 of the requested size.)
52 The actual capacity (in bytes) that is set is returned as the function result.
53 .IP
54 Attempting to set the pipe capacity smaller than the amount
55 of buffer space currently used to store data produces the error
56 .BR EBUSY .
57 .IP
58 Note that because of the way the pages of the pipe buffer
59 are employed when data is written to the pipe,
60 the number of bytes that can be written may be less than the nominal size,
61 depending on the size of the writes.
62 .TP
63 .B F_GETPIPE_SZ
64 Return (as the function result) the capacity of the pipe referred to by
65 .IR fd .
66 .SH RETURN VALUE
67 The pipe capacity.
68 .P
69 On error, \-1 is returned, and
70 .I errno
71 is set to indicate the error.
72 .SH ERRORS
73 See
74 .BR fcntl (2).
75 .TP
76 .B EBUSY
77 .I op
78 is
79 .B F_SETPIPE_SZ
80 and the new pipe capacity specified in
81 .I arg
82 is smaller than the amount of buffer space currently
83 used to store data in the pipe.
84 .TP
85 .B EPERM
86 .I op
87 is
88 .B F_SETPIPE_SZ
89 and the soft or hard user pipe limit has been reached;
90 see
91 .BR pipe (7).
92 .SH STANDARDS
93 Linux.
94 .SH HISTORY
95 Linux 2.6.35.
96 .SH SEE ALSO
97 .BR fcntl (2)