| From ed9ef51dc1ea7ad7147cd67be92e4ae6e07055ec Mon Sep 17 00:00:00 2001 |
| From: Jean-Francois Thibert <jfthibert@google.com> |
| Date: Thu, 5 Nov 2015 15:11:32 -0500 |
| Subject: [PATCH] Add patch: Implement sysconf _SC_PHYS_PAGES with sysinfo |
| |
| |
| diff --git a/package/uclibc/0.9.33.2/uclibc-0072-sysconf-sc-phys-page.patch b/package/uclibc/0.9.33.2/uclibc-0072-sysconf-sc-phys-page.patch |
| new file mode 100644 |
| index 0000000..426c057 |
| --- /dev/null |
| +++ b/package/uclibc/0.9.33.2/uclibc-0072-sysconf-sc-phys-page.patch |
| @@ -0,0 +1,37 @@ |
| +commit 0a92bc274cf482bab5596c86e0c7e5c466a8f850 |
| +Author: Jean-Francois Thibert <jfthibert@google.com> |
| +Date: Thu Nov 5 14:37:45 2015 -0500 |
| + |
| + Implement sysconf _SC_PHYS_PAGES with sysinfo |
| + |
| +diff --git a/libc/unistd/sysconf.c b/libc/unistd/sysconf.c |
| +index 503b395..06074c3 100644 |
| +--- a/libc/unistd/sysconf.c |
| ++++ b/libc/unistd/sysconf.c |
| +@@ -112,6 +112,14 @@ static int nprocessors_conf(void) |
| + return ret != 0 ? ret : 1; |
| + } |
| + |
| ++static int get_phys_pages(void) |
| ++{ |
| ++ struct sysinfo si; |
| ++ if (sysinfo(&si) == 0) { |
| ++ return si.totalram / getpagesize() * si.mem_unit; |
| ++ } |
| ++ return -1; |
| ++} |
| + |
| + #ifndef __UCLIBC_CLK_TCK_CONST |
| + #error __UCLIBC_CLK_TCK_CONST not defined! |
| +@@ -747,11 +755,7 @@ long int sysconf(int name) |
| + RETURN_FUNCTION(nprocessors_onln()); |
| + |
| + case _SC_PHYS_PAGES: |
| +-#if 0 |
| + RETURN_FUNCTION(get_phys_pages()); |
| +-#else |
| +- RETURN_NEG_1; |
| +-#endif |
| + |
| + case _SC_AVPHYS_PAGES: |
| + #if 0 |