Does getc(3) use the read(2) syscall?
Marc Olzheim
zlo at zlo.nu
Wed Feb 3 14:27:33 UTC 2010
On Wed, Feb 03, 2010 at 10:23:50AM -0300, Daniel Molina Wegener wrote:
> > I'm having trouble looking this function up in the source tree, the trail
> > seems to end at __sys_read which has a bunch of prototypes but i can't find
> > the actual function code.
>
> Well, you can try cscope --- IMO the best option to
> search for symbols in the source tree. Also you have
> well done front-ends like cbrowser, codelite and emacs
> plus cscope mode.
Works wonders in vim as well. :-)
> > So my question is primarily, does getc use the read system call eventually?
>
> No, certainly not. Take a look on stdio.h and libc
> implementation on lib/libc/stdio/getc.c. Mainly on the
> __sgetc(f) macro.
If you follow macros long enough, you'll find that it obviously does use
the read system call. read, readv, pread, preadv are basicly the system
calls through which all normal reads take place.
Marc
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
Url : http://lists.freebsd.org/pipermail/freebsd-hackers/attachments/20100203/62c58b6e/attachment.pgp
More information about the freebsd-hackers
mailing list