summaryrefslogtreecommitdiffstats
path: root/meta/recipes-core/systemd/systemd/0009-util-bypass-unimplemented-_SC_PHYS_PAGES-system-conf.patch
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-core/systemd/systemd/0009-util-bypass-unimplemented-_SC_PHYS_PAGES-system-conf.patch')
-rw-r--r--meta/recipes-core/systemd/systemd/0009-util-bypass-unimplemented-_SC_PHYS_PAGES-system-conf.patch49
1 files changed, 0 insertions, 49 deletions
diff --git a/meta/recipes-core/systemd/systemd/0009-util-bypass-unimplemented-_SC_PHYS_PAGES-system-conf.patch b/meta/recipes-core/systemd/systemd/0009-util-bypass-unimplemented-_SC_PHYS_PAGES-system-conf.patch
deleted file mode 100644
index f150bb087a..0000000000
--- a/meta/recipes-core/systemd/systemd/0009-util-bypass-unimplemented-_SC_PHYS_PAGES-system-conf.patch
+++ /dev/null
@@ -1,49 +0,0 @@
1From 085c8b6f253726ad547e7be84ff3f2b99701488b Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Wed, 9 Nov 2016 19:38:07 -0800
4Subject: [PATCH 09/19] util: bypass unimplemented _SC_PHYS_PAGES system
5 configuration API on uclibc
6
7Upstream-Status: Inappropriate [uclibc-specific]
8
9Signed-off-by: Khem Raj <raj.khem@gmail.com>
10---
11 src/basic/util.c | 15 +++++++++++++++
12 1 file changed, 15 insertions(+)
13
14diff --git a/src/basic/util.c b/src/basic/util.c
15index c1b5ca1..4c62d43 100644
16--- a/src/basic/util.c
17+++ b/src/basic/util.c
18@@ -742,6 +742,20 @@ uint64_t physical_memory(void) {
19 * In order to support containers nicely that have a configured memory limit we'll take the minimum of the
20 * physically reported amount of memory and the limit configured for the root cgroup, if there is any. */
21
22+#ifdef __UCLIBC__
23+ char line[128];
24+ FILE *f = fopen("/proc/meminfo", "r");
25+ if (f == NULL)
26+ return 0;
27+ while (!feof(f) && fgets(line, sizeof(line)-1, f)) {
28+ if (sscanf(line, "MemTotal: %li kB", &mem) == 1) {
29+ mem *= 1024;
30+ break;
31+ }
32+ }
33+ fclose(f);
34+ return (uint64_t) mem;
35+#else
36 sc = sysconf(_SC_PHYS_PAGES);
37 assert(sc > 0);
38
39@@ -762,6 +776,7 @@ uint64_t physical_memory(void) {
40 lim *= ps;
41
42 return MIN(mem, lim);
43+#endif
44 }
45
46 uint64_t physical_memory_scale(uint64_t v, uint64_t max) {
47--
482.10.2
49