From owner-freebsd-hackers@FreeBSD.ORG Thu Feb 4 15:24:01 2010 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7981A10656A7 for ; Thu, 4 Feb 2010 15:24:01 +0000 (UTC) (envelope-from stefan.midjich@gmail.com) Received: from mail-ew0-f211.google.com (mail-ew0-f211.google.com [209.85.219.211]) by mx1.freebsd.org (Postfix) with ESMTP id 07E578FC14 for ; Thu, 4 Feb 2010 15:24:00 +0000 (UTC) Received: by ewy3 with SMTP id 3so468218ewy.13 for ; Thu, 04 Feb 2010 07:24:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:content-type; bh=T9OC2teHN/MS9x4fu8v9lqMYwko15xKZ+eIXqX1b+9U=; b=FX/F7Xx834ptKuE99gY79jkrWi66y8bL0TnC5vMD5WLyYIq6ngW54Xng5KuAoOm+c4 NMCHcXm1kCpsXA1NByjzJRde9gZ/Dst3fd3lYuDHuv2DRUmI8+KVRLPsAD1eUO7tyBYl Iav/Q48BtRz1yuzho8jJL0qK7JWHbh1EJVHOg= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; b=m7U0HRF1VWr0jfHUnTdpuNi6jP/XBJflQ5A364rBrcPhvlNRlsFkzMsvcplHvrjN63 bpSoZdZNbA5yFUtEIh+NPE9KXyyqVCDdXCF2c6D2tIMOxTm0j2zMZlqwiLZaxFT6fseT Rnvg1EjqmY5qIHX//BuESa8dSkGghehGWeSoA= MIME-Version: 1.0 Received: by 10.213.1.18 with SMTP id 18mr3786418ebd.17.1265297039880; Thu, 04 Feb 2010 07:23:59 -0800 (PST) In-Reply-To: <201002031657.47714.dmw@coder.cl> References: <201002031024.03835.dmw@coder.cl> <20100203141618.GA32485@zlo.nu> <201002031657.47714.dmw@coder.cl> Date: Thu, 4 Feb 2010 16:23:59 +0100 Message-ID: From: Stefan Midjich To: freebsd-hackers@freebsd.org X-Mailman-Approved-At: Thu, 04 Feb 2010 16:43:40 +0000 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.5 Subject: Re: Does getc(3) use the read(2) syscall? X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 04 Feb 2010 15:24:01 -0000 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 > On Wednesday 03 February 2010, > Marc Olzheim 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 > 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