chiark / gitweb /
service: increase default timeout for sysv scripts to 3min
[elogind.git] / src / util.c
index 98dbe28b54643cdb6de11f52e0c316d2f3529053..12c19b353b0f0e9b5883baacfca7ee681742db40 100644 (file)
@@ -3308,6 +3308,26 @@ int wait_for_terminate_and_warn(const char *name, pid_t pid) {
 
 }
 
+void freeze(void) {
+        for (;;)
+                pause();
+}
+
+bool null_or_empty(struct stat *st) {
+        assert(st);
+
+        if (S_ISREG(st->st_mode) && st->st_size <= 0)
+                return true;
+
+        /* /dev/null has major/minor of 1:3 */
+        if (S_ISCHR(st->st_mode) &&
+            major(st->st_rdev) == 1 &&
+            minor(st->st_rdev) == 3)
+                return true;
+
+        return false;
+}
+
 static const char *const ioprio_class_table[] = {
         [IOPRIO_CLASS_NONE] = "none",
         [IOPRIO_CLASS_RT] = "realtime",