|
Packit |
8f70b4 |
/* System call limits
|
|
Packit |
8f70b4 |
|
|
Packit |
8f70b4 |
Copyright 2018 Free Software Foundation, Inc.
|
|
Packit |
8f70b4 |
|
|
Packit |
8f70b4 |
This program is free software; you can redistribute it and/or modify
|
|
Packit |
8f70b4 |
it under the terms of the GNU General Public License as published by
|
|
Packit |
8f70b4 |
the Free Software Foundation; either version 3, or (at your option)
|
|
Packit |
8f70b4 |
any later version.
|
|
Packit |
8f70b4 |
|
|
Packit |
8f70b4 |
This program is distributed in the hope that it will be useful,
|
|
Packit |
8f70b4 |
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
Packit |
8f70b4 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
Packit |
8f70b4 |
GNU General Public License for more details.
|
|
Packit |
8f70b4 |
|
|
Packit |
8f70b4 |
You should have received a copy of the GNU General Public License
|
|
Packit |
8f70b4 |
along with this program; if not, see <https://www.gnu.org/licenses/>. */
|
|
Packit |
8f70b4 |
|
|
Packit |
8f70b4 |
#ifndef _SYS_LIMITS_H
|
|
Packit |
8f70b4 |
#define _SYS_LIMITS_H
|
|
Packit |
8f70b4 |
|
|
Packit |
8f70b4 |
#include <limits.h>
|
|
Packit |
8f70b4 |
|
|
Packit |
8f70b4 |
/* Maximum number of bytes to read or write in a single system call.
|
|
Packit |
8f70b4 |
This can be useful for system calls like sendfile on GNU/Linux,
|
|
Packit |
8f70b4 |
which do not handle more than MAX_RW_COUNT bytes correctly.
|
|
Packit |
8f70b4 |
The Linux kernel MAX_RW_COUNT is at least INT_MAX >> 20 << 20,
|
|
Packit |
8f70b4 |
where the 20 comes from the Hexagon port with 1 MiB pages; use that
|
|
Packit |
8f70b4 |
as an approximation, as the exact value may not be available to us.
|
|
Packit |
8f70b4 |
|
|
Packit |
8f70b4 |
Using this also works around a serious Linux bug before 2.6.16; see
|
|
Packit |
8f70b4 |
<https://bugzilla.redhat.com/show_bug.cgi?id=612839>.
|
|
Packit |
8f70b4 |
|
|
Packit |
8f70b4 |
Using this also works around a Tru64 5.1 bug, where attempting
|
|
Packit |
8f70b4 |
to read INT_MAX bytes fails with errno == EINVAL. See
|
|
Packit |
8f70b4 |
<https://lists.gnu.org/r/bug-gnu-utils/2002-04/msg00010.html>.
|
|
Packit |
8f70b4 |
|
|
Packit |
8f70b4 |
Using this is likely to work around similar bugs in other operating
|
|
Packit |
8f70b4 |
systems. */
|
|
Packit |
8f70b4 |
|
|
Packit |
8f70b4 |
enum { SYS_BUFSIZE_MAX = INT_MAX >> 20 << 20 };
|
|
Packit |
8f70b4 |
|
|
Packit |
8f70b4 |
#endif
|