Some UAPI headers use INT_MAX and INT_MIN. Currently they include <limits.h> for their definitions, which introduces a problematic dependency on libc. Add custom, namespaced definitions of INT_MAX and INT_MIN using the same values as the regular kernel code. These definitions are not added to uapi/linux/limits.h, as that header will conflict with libc definitions on some platforms.
Showing the changes to include/uapi (1 of 1 file). Show all
Unified · Split
| @@ -0,0 +1,8 @@ | |||
| 1 | /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ | ||
| 2 | #ifndef _UAPI_LINUX_TYPELIMITS_H | ||
| 3 | #define _UAPI_LINUX_TYPELIMITS_H | ||
| 4 | |||
| 5 | #define __KERNEL_INT_MAX ((int)(~0U >> 1)) | ||
| 6 | #define __KERNEL_INT_MIN (-__KERNEL_INT_MAX - 1) | ||
| 7 | |||
| 8 | #endif /* _UAPI_LINUX_TYPELIMITS_H */ | ||