the need for safe dynamic string libraries

Luigi Rizzo rizzo at iet.unipi.it
Mon Dec 7 13:22:59 UTC 2009


On Mon, Dec 07, 2009 at 02:11:44PM +0100, Dag-Erling Sm??rgrav wrote:
> Luigi Rizzo <rizzo at iet.unipi.it> writes:
> > "Dag-Erling Sm??rgrav" <des at des.no> writes:
> > > When libsbuf was ported to userland, sbuf_printf() was pessimized
> > > due to the limitations of libc's printf().
> > but, isn't this an implementation detail ? What prevents the same
> > API to have two different implementation, one for kernel, one for userland ?
> 
> Maybe I wasn't entirely clear: functionality was removed from libsbuf
> because it could not be implemented in userland, because our printf(3)
> is badly implemented.  To restore that functionality, we would have to
> either fork libsbuf or fix printf(3).

i think i understood correctly.
But my point is-- does the functionality that was removed rely
on a different API, or we can keep the same API and have two
different implementation of the hopefully few things that change
between kernel and userland

	int
	sbuf_printf(struct sbuf *s, const char *fmt, ...)
	{
		// common code
	#ifdef _KERNEL
		... the wonderful bits
	#else
		// crippled due to printf limitations
	#endif
		// more common code

This does not seem too problematic...


More information about the svn-src-head mailing list