Format debugging output in /proc/audit to seperate titles and data output to one
line each in /proc/audit and /proc/audit_titles.

Signed-off-by: Richard Guy Briggs <r...@redhat.com>
---
 kernel/audit.c |   20 ++++++++++++++++++--
 1 files changed, 18 insertions(+), 2 deletions(-)

diff --git a/kernel/audit.c b/kernel/audit.c
index a586bf2..d6f4763 100644
--- a/kernel/audit.c
+++ b/kernel/audit.c
@@ -1204,7 +1204,7 @@ static struct pernet_operations audit_net_ops 
__net_initdata = {
 };
 
 /* Display information about audit subsystem */
-static int proc_auditstats_show(struct seq_file *m, void *v)
+static int proc_auditstatstitles_show(struct seq_file *m, void *v)
 {
        //seq_printf(m, "init\t");
        //seq_printf(m, "en\t");
@@ -1231,7 +1231,23 @@ static int proc_auditstats_show(struct seq_file *m, void 
*v)
        seq_printf(m, "recover\t");
        seq_printf(m, "reserve\t");
        seq_printf(m, "\n");
+       return 0;
+}
+
+static int auditstatstitles_open(struct inode *inode, struct file *file)
+{
+       return single_open(file, proc_auditstatstitles_show, NULL);
+}
+
+static const struct file_operations proc_auditstatstitles_operations = {
+       .open = auditstatstitles_open,
+       .read = seq_read,
+       .llseek = seq_lseek,
+       .release = single_release,
+};
 
+static int proc_auditstats_show(struct seq_file *m, void *v)
+{
        //seq_printf(m, "%d\t", audit_initialized);
        //seq_printf(m, "%u\t", audit_enabled);
        //seq_printf(m, "%u\t", audit_ever_enabled);
@@ -1257,7 +1273,6 @@ static int proc_auditstats_show(struct seq_file *m, void 
*v)
        seq_printf(m, "%d\t", atomic_read(&audit_recovers));
        seq_printf(m, "%d\t", atomic_read(&audit_reserves));
        seq_printf(m, "\n");
-
        return 0;
 }
 
@@ -1296,6 +1311,7 @@ static int __init audit_init(void)
        for (i = 0; i < AUDIT_INODE_BUCKETS; i++)
                INIT_LIST_HEAD(&audit_inode_hash[i]);
 
+       proc_create("audit_titles", 0, NULL, &proc_auditstatstitles_operations);
        proc_create("audit", 0, NULL, &proc_auditstats_operations);
 
        return 0;
-- 
1.7.1

--
Linux-audit mailing list
Linux-audit@redhat.com
https://www.redhat.com/mailman/listinfo/linux-audit

Reply via email to