From 36443fd542a96d2ed71fc294f70fed08c115af55 Mon Sep 17 00:00:00 2001 From: Elliott Hughes <enh@google.com> Date: Tue, 28 Jul 2015 19:52:31 -0700 Subject: [PATCH] Remove PAGE_SIZE from <limits.h>. It turns out that everyone's still getting PAGE_SIZE from <sys/user.h> via <sys/ucontext.h> via <signal.h> anyway. glibc has PAGE_SIZE in <sys/user.h> rather than <limits.h> so this part is good. The bad part is that we have such wide transitive inclusion of <sys/user.h>! Bug: http://b/22735893 Change-Id: I363adffe4a27b4ca1eedf695ea621f5dd2d5ca10 --- libc/bionic/sysinfo.cpp | 4 ++-- libc/include/limits.h | 5 ----- 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/libc/bionic/sysinfo.cpp b/libc/bionic/sysinfo.cpp index 82cb76a84..a48bfea29 100644 --- a/libc/bionic/sysinfo.cpp +++ b/libc/bionic/sysinfo.cpp @@ -29,9 +29,9 @@ #include <sys/sysinfo.h> #include <dirent.h> -#include <limits.h> #include <stdio.h> #include <string.h> +#include <unistd.h> #include "private/ScopedReaddir.h" @@ -94,7 +94,7 @@ static int __get_meminfo_page_count(const char* pattern) { while (fgets(buf, sizeof(buf), fp) != NULL) { long total; if (sscanf(buf, pattern, &total) == 1) { - page_count = static_cast<int>(total / (PAGE_SIZE / 1024)); + page_count = static_cast<int>(total / (sysconf(_SC_PAGE_SIZE) / 1024)); break; } } diff --git a/libc/include/limits.h b/libc/include/limits.h index 9d7a0daa3..67c7719ca 100644 --- a/libc/include/limits.h +++ b/libc/include/limits.h @@ -81,11 +81,6 @@ #define MB_LEN_MAX 4 -/* New code should use sysconf(_SC_PAGE_SIZE) instead. */ -#ifndef PAGE_SIZE -#define PAGE_SIZE 4096 -#endif - #define SEM_VALUE_MAX 0x3fffffff /* POSIX says these belong in <unistd.h> but BSD has some in <limits.h>. */