diff options
author | Lennart Poettering <lennart@poettering.net> | 2014-03-04 19:20:21 +0100 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2014-03-04 20:02:50 +0100 |
commit | 1c231f56482546725c4dbd3303f70300bd3c63e9 (patch) | |
tree | dc0f3ff586db692d961264a23b2b23040c1ce53e /src/shared/util.c | |
parent | b5d742138f71e87312541a89aac5657015f50f48 (diff) |
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.
Diffstat (limited to 'src/shared/util.c')
-rw-r--r-- | src/shared/util.c | 12 |
1 files changed, 12 insertions, 0 deletions
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(); +} |