summaryrefslogtreecommitdiffstats
path: root/gl/sys-limits.h
diff options
context:
space:
mode:
authorKristian Schuster <116557017+KriSchu@users.noreply.github.com>2023-02-19 22:49:18 (GMT)
committerKristian Schuster <116557017+KriSchu@users.noreply.github.com>2023-02-19 22:49:18 (GMT)
commita0d42777217296c0a7bdb1e1be8d8f6de1b24dd7 (patch)
tree8effe94c57b2f9796ba36090b07551baa8f1e1cb /gl/sys-limits.h
parentca3d59cd6918c9e2739e783b721d4c1122640fd3 (diff)
parentc07206f2ccc2356aa74bc6813a94c2190017d44e (diff)
downloadmonitoring-plugins-a0d42777217296c0a7bdb1e1be8d8f6de1b24dd7.tar.gz
Merge remote-tracking branch 'origin/master' into feature_check_disk_add_ignore_missing_option
Diffstat (limited to 'gl/sys-limits.h')
-rw-r--r--gl/sys-limits.h42
1 files changed, 42 insertions, 0 deletions
diff --git a/gl/sys-limits.h b/gl/sys-limits.h
new file mode 100644
index 0000000..0e9556d
--- /dev/null
+++ b/gl/sys-limits.h
@@ -0,0 +1,42 @@
1/* System call limits
2
3 Copyright 2018-2023 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