All of lore.kernel.org
 help / color / mirror / Atom feed
From: Benjamin LaHaise <bcrl@redhat.com>
To: Linus Torvalds <torvalds@transmeta.com>
Cc: Alexander Viro <viro@math.psu.edu>,
	Andrew Morton <akpm@zip.com.au>, "H. Peter Anvin" <hpa@zytor.com>,
	lkml <linux-kernel@vger.kernel.org>
Subject: Re: [patch] printk from userspace
Date: Wed, 14 Aug 2002 00:35:05 -0400	[thread overview]
Message-ID: <20020814003505.A16322@redhat.com> (raw)
In-Reply-To: <Pine.LNX.4.44.0208132123500.1208-100000@home.transmeta.com>; from torvalds@transmeta.com on Tue, Aug 13, 2002 at 09:26:45PM -0700

On Tue, Aug 13, 2002 at 09:26:45PM -0700, Linus Torvalds wrote:
> That said, I like the notion. I've always hated the fact that all the 
> boot-time messages get lost, simply because syslogd hadn't started, and 
> as a result things like fsck ran without any sign afterwards. The kernel 
> log approach saves it all in one place.
> 
> But /dev/console just sounds potentially _too_ noisy.

/dev/kmsg was another suggestion for the name.  But please revert the 
yet-another-syscall variant -- having a duplicate way for logging that 
doesn't work with stdio just seems sick to me (sys_syslog should die).
Something like the following untested code is much better.

		-ben
-- 
"You will be reincarnated as a toad; and you will be much happier."


diff -urN v2.5.31/drivers/char/mem.c foo/drivers/char/mem.c
--- v2.5.31/drivers/char/mem.c	Fri Aug  2 11:41:29 2002
+++ foo/drivers/char/mem.c	Wed Aug 14 00:34:33 2002
@@ -579,6 +579,24 @@
 	write:		write_full,
 };
 
+static ssize_t kmsg_write(struct file * file, const char * buf,
+			  size_t count, loff_t *ppos)
+{
+	char tmp[1025];
+
+	if (count > 1024)
+		count = 1024;
+	if (copy_from_user(tmp, buf, count))
+		return -EFAULT;
+	tmp[count] = 0;
+	printk("%s", tmp);
+	return count;
+}
+
+static struct file_operations kmsg_fops = {
+	write:		kmsg_write,
+};
+
 static int memory_open(struct inode * inode, struct file * filp)
 {
 	switch (minor(inode->i_rdev)) {
@@ -608,6 +626,9 @@
 		case 9:
 			filp->f_op = &urandom_fops;
 			break;
+		case 11:
+			filp->f_op = &kmsg_fops;
+			break;
 		default:
 			return -ENXIO;
 	}
@@ -634,7 +655,8 @@
 	{5, "zero",    S_IRUGO | S_IWUGO,           &zero_fops},
 	{7, "full",    S_IRUGO | S_IWUGO,           &full_fops},
 	{8, "random",  S_IRUGO | S_IWUSR,           &random_fops},
-	{9, "urandom", S_IRUGO | S_IWUSR,           &urandom_fops}
+	{9, "urandom", S_IRUGO | S_IWUSR,           &urandom_fops},
+	{11,"kmsg",    S_IRUGO | S_IWUSR,           &kmsg_fops},
     };
     int i;
 

  reply	other threads:[~2002-08-14  4:31 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-08-14  3:18 [patch] printk from userspace Andrew Morton
2002-08-14  3:58 ` Benjamin LaHaise
2002-08-14  4:00   ` H. Peter Anvin
2002-08-14  4:05     ` Benjamin LaHaise
2002-08-14  4:10   ` Alexander Viro
2002-08-14  4:11   ` Andrew Morton
2002-08-14  4:07     ` Benjamin LaHaise
2002-08-14  4:20       ` Alexander Viro
2002-08-14  4:26         ` Linus Torvalds
2002-08-14  4:35           ` Benjamin LaHaise [this message]
2002-08-14  4:42             ` H. Peter Anvin
2002-08-14  4:44             ` Linus Torvalds
2002-08-14  4:44               ` H. Peter Anvin
2002-08-14  4:48               ` Benjamin LaHaise
2002-08-14  4:58             ` Andrew Morton
2002-08-14  5:32               ` H. Peter Anvin
2002-08-19 11:28                 ` Daniel Phillips
2002-08-14  7:59           ` Miquel van Smoorenburg
2002-08-14 16:12             ` serial console (was Re: [patch] printk from userspace) Arkadiusz Miskiewicz
2002-08-15 12:43               ` Miquel van Smoorenburg
2002-08-14  4:33         ` [patch] printk from userspace H. Peter Anvin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20020814003505.A16322@redhat.com \
    --to=bcrl@redhat.com \
    --cc=akpm@zip.com.au \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=torvalds@transmeta.com \
    --cc=viro@math.psu.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.