aboutsummaryrefslogtreecommitdiffstats
path: root/lib/sys-limits.h
diff options
context:
space:
mode:
authorPaul Eggert2025-08-02 10:47:03 -0700
committerPaul Eggert2025-08-02 11:19:24 -0700
commit687d3cb03bddd7eebf6384001fc54ca2c7e80037 (patch)
tree664dbb5dbf966c72df4cd8dcc0567b501183f773 /lib/sys-limits.h
parent84f1080f67c0960cca2d456c68e2d7866c19462c (diff)
downloademacs-687d3cb03bddd7eebf6384001fc54ca2c7e80037.tar.gz
emacs-687d3cb03bddd7eebf6384001fc54ca2c7e80037.zip
Update from Gnulib by running admin/merge-gnulib
* lib/sys-limits.h: New file.
Diffstat (limited to 'lib/sys-limits.h')
-rw-r--r--lib/sys-limits.h42
1 files changed, 42 insertions, 0 deletions
diff --git a/lib/sys-limits.h b/lib/sys-limits.h
new file mode 100644
index 00000000000..a556dfeb6d5
--- /dev/null
+++ b/lib/sys-limits.h
@@ -0,0 +1,42 @@
1/* System call limits
2
3 Copyright 2018-2025 Free Software Foundation, Inc.
4
5 This file is free software: you can redistribute it and/or modify
6 it under the terms of the GNU Lesser General Public License as
7 published by the Free Software Foundation; either version 2.1 of the
8 License, or (at your option) any later version.
9
10 This file is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public License
16 along with this program. If not, see <https://www.gnu.org/licenses/>. */
17
18#ifndef _GL_SYS_LIMITS_H
19#define _GL_SYS_LIMITS_H
20
21#include <limits.h>
22
23/* Maximum number of bytes to read or write in a single system call.
24 This can be useful for system calls like sendfile on GNU/Linux,
25 which do not handle more than MAX_RW_COUNT bytes correctly.
26 The Linux kernel MAX_RW_COUNT is at least INT_MAX >> 20 << 20,
27 where the 20 comes from the Hexagon port with 1 MiB pages; use that
28 as an approximation, as the exact value may not be available to us.
29
30 Using this also works around a serious Linux bug before 2.6.16; see
31 <https://bugzilla.redhat.com/show_bug.cgi?id=612839>.
32
33 Using this also works around a Tru64 5.1 bug, where attempting
34 to read INT_MAX bytes fails with errno == EINVAL. See
35 <https://lists.gnu.org/r/bug-gnu-utils/2002-04/msg00010.html>.
36
37 Using this is likely to work around similar bugs in other operating
38 systems. */
39
40enum { SYS_BUFSIZE_MAX = INT_MAX >> 20 << 20 };
41
42#endif