This is the mail archive of the
ecos-discuss@sources.redhat.com
mailing list for the eCos project.
Re: Implementation of sprintf ....
- From: Andrew Lunn <andrew dot lunn at ascom dot ch>
- To: Thomas BINDER <Thomas dot Binder at frequentis dot com>
- Cc: ecos-discuss at sources dot redhat dot com, rjessich at frequentis dot com
- Date: Mon, 3 Feb 2003 11:29:08 +0100
- Subject: Re: [ECOS] Implementation of sprintf ....
- References: <3E3E421F.F5955C0C@frequentis.com>
On Mon, Feb 03, 2003 at 11:19:11AM +0100, Thomas BINDER wrote:
>
> Hi folks!
>
> Ich have a short question concerning the implementation of the
> (libc) sprintf function.
> A quick look into the sources reveals that an instance of
> Cyg_StdioStream is used, which in turn uses a mutex to lock critical
> sections (e.g. in write).
> Since there is another implementation of sprintf (diag_sprintf)
> which does not need a mutex, I wonder what the actual differences
> between the two implementations are (apart from the mutex). Why are
> streams used in sprintf ???
For consistence, sprintf maps down to vfnprintf, which implements the
whole printf family. diag_sprintf is used for the debug output. Its
not as feature rich as vfnprintf. diag_sprintf is part of the infra
package so will always be available, where as sprintf is part of libc
and so is optional.
The libc function is slow, because of all the stream and mutex
stuff. It would be nice to optimize this, but it does not look easy.
Andrew
--
Before posting, please read the FAQ: http://sources.redhat.com/fom/ecos
and search the list archive: http://sources.redhat.com/ml/ecos-discuss