diff options
author | Tom Lane | 2025-07-01 16:40:35 +0000 |
---|---|---|
committer | Tom Lane | 2025-07-01 16:40:35 +0000 |
commit | 0991249d7ab52ed689c1d5f752ae6581506627bc (patch) | |
tree | db4c834e45ecf19182d14253beed0016c8662529 | |
parent | 29c54ea7b49ccd2838ee91365d68ff710c38c772 (diff) |
Make sure IOV_MAX is defined.
We stopped defining IOV_MAX on non-Windows systems in 75357ab94, on
the assumption that every non-Windows system defines it in <limits.h>
as required by X/Open. GNU Hurd, however, doesn't follow that
standard either. Put back the old logic to assume 16 if it's
not defined.
Author: Michael Banck <[email protected]>
Co-authored-by: Christoph Berg <[email protected]>
Reviewed-by: Tom Lane <[email protected]>
Discussion: https://postgr.es/m/[email protected]
Discussion: https://postgr.es/m/[email protected]
Backpatch-through: 16
-rw-r--r-- | src/include/port/pg_iovec.h | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/src/include/port/pg_iovec.h b/src/include/port/pg_iovec.h index e5fe677b371..10fecdd42ac 100644 --- a/src/include/port/pg_iovec.h +++ b/src/include/port/pg_iovec.h @@ -21,9 +21,6 @@ #else -/* POSIX requires at least 16 as a maximum iovcnt. */ -#define IOV_MAX 16 - /* Define our own POSIX-compatible iovec struct. */ struct iovec { @@ -33,6 +30,15 @@ struct iovec #endif +/* + * If <limits.h> didn't define IOV_MAX, define our own. X/Open requires at + * least 16. (GNU Hurd apparently feel that they're not bound by X/Open, + * because they don't define this symbol at all.) + */ +#ifndef IOV_MAX +#define IOV_MAX 16 +#endif + /* Define a reasonable maximum that is safe to use on the stack. */ #define PG_IOV_MAX Min(IOV_MAX, 32) |