Re: [patch] printk from userspace

Benjamin LaHaise
2002-08-14T04:44:15Z

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."