PRINTF, STDOUT

Daniel Eischen deischen at freebsd.org
Thu Nov 30 20:31:25 UTC 2006


On Thu, 30 Nov 2006, Christopher Olsen wrote:

> Hello,
>
> I've been tracing the printf function from the FreeBSD 6.x libc... I'm trying
> to figure out what mechanism transfers the data from the processes FILE to
> the system so it's written out to the screen...
>
>> From my findings I get to a function __sfvwrite(FILE,buf) {}
>
> however this just copies into the FILE's buffer and there are no systems
> between this point and returning back from the printf call

   __sfvwrite() -> __fflush() -> __sflush -> _swrite() ->
     (via fp->_write) __swrite() -> _write()

Note that _write() is a weak reference to __sys_write() which
is the actual system call.

-- 
Dan


More information about the freebsd-hackers mailing list