diff options
author | RincewindsHat <12514511+RincewindsHat@users.noreply.github.com> | 2023-09-18 20:59:46 (GMT) |
---|---|---|
committer | RincewindsHat <12514511+RincewindsHat@users.noreply.github.com> | 2023-09-18 20:59:46 (GMT) |
commit | 0e70e81133c25274fe2dd2309556b41357dd759b (patch) | |
tree | 9a680b36788ee1ad4e7ecc5ccfeb4494db9fdc72 /gl/sys-limits.h | |
parent | ce355c80cf6054bfa5e1dcf81f9e2183ef963ee1 (diff) | |
parent | 2ddc75e69db5a3dd379c896d8420c9af20ec1cee (diff) | |
download | monitoring-plugins-0e70e81133c25274fe2dd2309556b41357dd759b.tar.gz |
Merge branch 'master' into mysql_detect_mysqldumprefs/pull/1718/head
Diffstat (limited to 'gl/sys-limits.h')
-rw-r--r-- | gl/sys-limits.h | 42 |
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 | |||
40 | enum { SYS_BUFSIZE_MAX = INT_MAX >> 20 << 20 }; | ||
41 | |||
42 | #endif | ||