[PATCH RFC net-next 1/3] uapi: add INT_MAX and INT_MIN constants

From: Thomas Weißschuh
Date: Mon Jan 05 2026 - 03:27:33 EST


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.

Signed-off-by: Thomas Weißschuh <thomas.weissschuh@xxxxxxxxxxxxx>
---
include/uapi/linux/limits.h | 3 +++
1 file changed, 3 insertions(+)

diff --git a/include/uapi/linux/limits.h b/include/uapi/linux/limits.h
index 6bcbe3068761..35ffa2667309 100644
--- a/include/uapi/linux/limits.h
+++ b/include/uapi/linux/limits.h
@@ -18,4 +18,7 @@

#define RTSIG_MAX 32

+#define __KERNEL_INT_MAX ((int)(~0U >> 1))
+#define __KERNEL_INT_MIN (-__KERNEL_INT_MAX - 1)
+
#endif

--
2.52.0