From 1c231f56482546725c4dbd3303f70300bd3c63e9 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Tue, 4 Mar 2014 19:20:21 +0100 Subject: logind: make $XDG_RUNTIME_DIR a per-user tmpfs This way each user allocates from his own pool, with its own size limit. This puts the size limit by default to 10% of the physical RAM size but makes it configurable in logind.conf. --- src/shared/util.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'src/shared/util.c') diff --git a/src/shared/util.c b/src/shared/util.c index 285a263cdb..10daff3036 100644 --- a/src/shared/util.c +++ b/src/shared/util.c @@ -6291,3 +6291,15 @@ const char* personality_to_string(unsigned long p) { return NULL; } + +uint64_t physical_memory(void) { + long mem; + + /* We return this as uint64_t in case we are running as 32bit + * process on a 64bit kernel with huge amounts of memory */ + + mem = sysconf(_SC_PHYS_PAGES); + assert(mem > 0); + + return (uint64_t) mem * (uint64_t) page_size(); +} -- cgit v1.2.3-54-g00ecf