mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-02-19 10:11:56 -05:00
uapi: add INT_MAX and INT_MIN constants
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. Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de> Link: https://patch.msgid.link/20260113-uapi-limits-v2-1-93c20f4b2c1a@linutronix.de Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
committed by
Jakub Kicinski
parent
171e8ed482
commit
ca9d74eb5f
8
include/uapi/linux/typelimits.h
Normal file
8
include/uapi/linux/typelimits.h
Normal file
@@ -0,0 +1,8 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
|
||||
#ifndef _UAPI_LINUX_TYPELIMITS_H
|
||||
#define _UAPI_LINUX_TYPELIMITS_H
|
||||
|
||||
#define __KERNEL_INT_MAX ((int)(~0U >> 1))
|
||||
#define __KERNEL_INT_MIN (-__KERNEL_INT_MAX - 1)
|
||||
|
||||
#endif /* _UAPI_LINUX_TYPELIMITS_H */
|
||||
Reference in New Issue
Block a user