Re: [patch] printk from userspace

Benjamin LaHaise (bcrl@redhat.com)
Wed, 14 Aug 2002 00:48:06 -0400


On Tue, Aug 13, 2002 at 09:44:14PM -0700, Linus Torvalds wrote:
> Actually, anybody who uses stdio on syslog messages should be roasted.
> Over the nice romantic glow of red-hot coal, slowly cooking the stupid git
> alive.

If you're logging huge messages, sure, that's just plain Stupid. But for
messages that are smaller than the size of the stdio buffer an fprintf()
followed by fflush() gets a single atomic write for most values of libc.

> It's not a bug, it's a feature. A syslog message needs to be atomic, which
> means that it MUST NOT use the buffering of stdio.

And that's why we have write(2) on file descriptors. Having write(2)
in the form of syslog(2) makes no sense. It adds to the mass of abi
that needs to be maintained. Making the mechanism of writing using the
existing infrastructure doesn't increase the size of the ABI.

-ben

-- 
"You will be reincarnated as a toad; and you will be much happier."
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/