Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 4 Feb 2010 16:23:59 +0100
From:      Stefan Midjich <stefan.midjich@gmail.com>
To:        freebsd-hackers@freebsd.org
Subject:   Re: Does getc(3) use the read(2) syscall?
Message-ID:  <e0e25d5e1002040723s5ca55dc8gedd3600dc6f7826b@mail.gmail.com>
In-Reply-To: <201002031657.47714.dmw@coder.cl>
References:  <e0e25d5e1002030326p5e0ef0a1q5ebc77a4e1c69b7c@mail.gmail.com> <201002031024.03835.dmw@coder.cl> <20100203141618.GA32485@zlo.nu> <201002031657.47714.dmw@coder.cl>

next in thread | previous in thread | raw e-mail | index | archive | help
Thank you all for your wonderful replies!

I should have known it was a macro, thank you.

Very informative help from you Oliver.

2010/2/3 Daniel Molina Wegener <dmw@coder.cl>

> On Wednesday 03 February 2010,
> Marc Olzheim <zlo@zlo.nu> wrote:
>
> > 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 bu=
t
> 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. :-)
>
>   Sure, vim supports cscope since 2000 and possibly before that,
> indeed vim was my first programming editor in FreeBSD and Linux.
> Then I've learned emcas, and now I use both editors --- the first
> available on the machine that I'm working on --- also emacs requires
> a lot of configurations, but is my primary editor on my FreeBSD
> boxes.
>
> >
> > > > 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 us=
e
> > the read system call. read, readv, pread, preadv are basicly the system
> > calls through which all normal reads take place.
>
>   That's right, but cscope or even etags should help a lot
> finding those simbols, most for large source trees like
> the FreeBSD base system ;)
>
> >
> > Marc
> >
>
> Best regards,
> --
> Daniel Molina Wegener <dmw [at] coder [dot] cl>
> Software Architect, System Programmer & Web Developer
> Phone: +1 (510) 629-4267 | Blog: http://coder.cl/
>



--=20


Med v=E4nliga h=E4lsningar / With kind regards

Stefan Midjich
http://swehack.se/cv
https://www.swehack.se/cv



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?e0e25d5e1002040723s5ca55dc8gedd3600dc6f7826b>