chiark / gitweb /
analyze: improve output
[elogind.git] / src / util.c
index c9c88927b0634c20eb5e4beee8d519cd3f03aaf1..5e101e44178fcee9a73d1e080562bf257ef454a0 100644 (file)
 #include "exit-status.h"
 #include "hashmap.h"
 
+size_t page_size(void) {
+        static __thread size_t pgsz = 0;
+        long r;
+
+        if (pgsz)
+                return pgsz;
+
+        assert_se((r = sysconf(_SC_PAGESIZE)) > 0);
+
+        pgsz = (size_t) r;
+
+        return pgsz;
+}
+
 bool streq_ptr(const char *a, const char *b) {
 
         /* Like streq(), but tries to make sense of NULL pointers */
@@ -3991,7 +4005,7 @@ int detect_container(const char **id) {
                                 fclose(f);
 
                                 if (id)
-                                        *id = "ns";
+                                        *id = "pidns";
 
                                 return 1;
                         }
@@ -4174,6 +4188,10 @@ bool nulstr_contains(const char*nulstr, const char *needle) {
         return false;
 }
 
+bool plymouth_running(void) {
+        return access("/run/initramfs/plymouth", F_OK) >= 0;
+}
+
 static const char *const ioprio_class_table[] = {
         [IOPRIO_CLASS_NONE] = "none",
         [IOPRIO_CLASS_RT] = "realtime",