From 964ec5397c6f1b08ae5422fdf1da884e64039a35 Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Mon, 27 Nov 2023 22:28:31 +0100 Subject: Linux limits errno values to [1, 4096) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Linux returns errno values negated, as such errno as returned are limited to be inside address range of the bytes within the higest addressable memory page, provided that the page size is 4096 or greater. Signed-off-by: Mattias Andrée --- linux/os.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'linux') diff --git a/linux/os.h b/linux/os.h index 05253c2..8e2eb5c 100644 --- a/linux/os.h +++ b/linux/os.h @@ -23,7 +23,7 @@ #endif #define RETURN_IS_ERROR(RET)\ - ((RET) > -(unsigned long long int)PAGE_SIZE) /* Don't know the actual limit, but this seems safe */ + ((RET) > -(unsigned long long int)4096) /* I guess Linux promises to never use a smaller page size */ #if defined(__x86_64__) && !defined(__IPL32__) # include "x86-64.h" -- cgit v1.2.3-70-g09d2