]> rtime.felk.cvut.cz Git - zynq/linux.git/commitdiff
add /sys/kernel/realtime entry
authorClark Williams <williams@redhat.com>
Sun, 31 Jul 2011 02:55:53 +0000 (21:55 -0500)
committerMichal Sojka <sojka@merica.cz>
Sun, 13 Sep 2015 07:47:36 +0000 (09:47 +0200)
Add a /sys/kernel entry to indicate that the kernel is a
realtime kernel.

Clark says that he needs this for udev rules, udev needs to evaluate
if its a PREEMPT_RT kernel a few thousand times and parsing uname
output is too slow or so.

Are there better solutions? Should it exist and return 0 on !-rt?

Signed-off-by: Clark Williams <williams@redhat.com>
Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
kernel/ksysfs.c

index 6683ccef9fffb2de28b6a4d6d01393b080811d6a..d6fc8eeaab8f30fa942f66714c951fdbd6eae08b 100644 (file)
@@ -136,6 +136,15 @@ KERNEL_ATTR_RO(vmcoreinfo);
 
 #endif /* CONFIG_KEXEC */
 
+#if defined(CONFIG_PREEMPT_RT_FULL)
+static ssize_t  realtime_show(struct kobject *kobj,
+                             struct kobj_attribute *attr, char *buf)
+{
+       return sprintf(buf, "%d\n", 1);
+}
+KERNEL_ATTR_RO(realtime);
+#endif
+
 /* whether file capabilities are enabled */
 static ssize_t fscaps_show(struct kobject *kobj,
                                  struct kobj_attribute *attr, char *buf)
@@ -203,6 +212,9 @@ static struct attribute * kernel_attrs[] = {
        &vmcoreinfo_attr.attr,
 #endif
        &rcu_expedited_attr.attr,
+#ifdef CONFIG_PREEMPT_RT_FULL
+       &realtime_attr.attr,
+#endif
        NULL
 };