| 1 |
/* SPDX-License-Identifier: LGPL-2.1-or-later */ |
| 2 |
#pragma once |
| 3 |
|
| 4 |
#include_next <limits.h> /* IWYU pragma: export */ |
| 5 |
|
| 6 |
#include <assert.h> |
| 7 |
#include <sys/types.h> |
| 8 |
|
| 9 |
/* musl defines SSIZE_MAX as LONG_MAX, so its type is always long. However, on 32-bit architectures, musl |
| 10 |
* defines ssize_t as int. Strictly speaking, this is not a bug in musl. POSIX only requires SSIZE_MAX to |
| 11 |
* evaluate to the maximum value representable by ssize_t; it does not require SSIZE_MAX itself to have type |
| 12 |
* ssize_t. However, our code assumes that SSIZE_MAX has type ssize_t, as is the case with glibc. Cast the |
| 13 |
* value explicitly so that SSIZE_MAX has type ssize_t. */ |
| 14 |
static_assert(SSIZE_MAX == LONG_MAX, ""); |
| 15 |
#undef SSIZE_MAX |
| 16 |
#define SSIZE_MAX ((ssize_t) LONG_MAX) |