Browsing C library in Linux

Discussion in 'C Programming' started by Madhusudhanan Chandrasekaran, Jan 14, 2008.

  1. Hi,

    I know that it is impossible to browse through
    the source code of C library in Linux. But I do not remember
    how. In short, I would like to see the implementation
    of standard header files such as <string.h> etc.

    I use Ubuntu. I've even downloaded the linux-headers.
    I can see only asm code in /usr/src/linux/include/asm-i386.
    Any pointers/help appreciated.


    Thanks,
    MC
    --------------------------------------------------
    All in all I'm just another brick in the FIREWALL.
    Madhusudhanan Chandrasekaran, Jan 14, 2008
    #1
    1. Advertising

  2. Madhusudhanan Chandrasekaran <> wrote:
    > Hi,
    >
    > I know that it is impossible to browse through
    > the source code of C library in Linux. But I do not remember
    > how. In short, I would like to see the implementation
    > of standard header files such as <string.h> etc.
    >
    > I use Ubuntu. I've even downloaded the linux-headers.
    > I can see only asm code in /usr/src/linux/include/asm-i386.
    > Any pointers/help appreciated.


    This is off-topic in this group, almost akin to asking where the nearest
    petrol station is to your home.

    In any event, on most Ubnutu and Debian-derived system, you can
    automagically download and unpack the source (into your $CWD) using
    incantions similar to:

    $ apt-get source glibc

    (You may need to `apt-get install dpkg-dev`, first; if you ask in a proper
    group people might be quicker to correct me if I prove wrong.)

    glibc suffers from a large, complex, and in places nearly impenetrable code
    base. You might want to study the string implementation here before diving
    into glibc's optimized assembly and C code:

    http://www.openbsd.org/cgi-bin/cvsweb/src/lib/libc/string/
    William Ahern, Jan 14, 2008
    #2
    1. Advertising

  3. Madhusudhanan Chandrasekaran wrote:
    > Hi,
    >
    > I know that it is impossible to browse through
    > the source code of C library in Linux. But I do not remember
    > how.


    That's easy. Just don't do it.

    But in case you made the reverse mistake of those that use the word
    "flammable" when in fact they mean "inflammable":

    > In short, I would like to see the implementation
    > of standard header files such as <string.h> etc.


    If you want to see the implementation of the header, just look in
    /usr/include. If you want to see how the library itself is implemented, just
    download the glibc sources and inspect those.

    > I use Ubuntu. I've even downloaded the linux-headers.


    Those are just for the linux kernel API and have nothing to do with the
    Standard library.

    > I can see only asm code in [...]


    You'll find that siginificant portions of the C library are implemented in
    assembler. You'll also find the C source quite illegible.

    robert
    Robert Latest, Jan 14, 2008
    #3
  4. Madhusudhanan Chandrasekaran

    jacob navia Guest

    Robert Latest wrote:
    >
    >> In short, I would like to see the implementation
    >> of standard header files such as <string.h> etc.

    >
    > If you want to see the implementation of the header, just look in
    > /usr/include. If you want to see how the library itself is implemented, just
    > download the glibc sources and inspect those.
    >


    Those were the old times Robert. When you would just look in the
    include directory. This days, software bloat makes that impossible
    since the system compiler stores the *real* includes under
    /usr/lib/gcc... and a VERY long path. That path is of course not
    fixed and changes from version to version so that you can
    install 26 different gcc compilers in your machine, each with its own
    headers, whatever.

    I think you can obtain that path with
    gcc -v
    then look where the includes are but I am not so sure.

    This trend started long ago, when "ld" was replaced with
    "collect2" (a script), then continued with the linker
    calling the C compiler to compile code generated while linking,
    then it continued by transforming some libraries from binaries to
    some sort of linker scripts (and retaining the .a suffix)
    and all kind of hacks that are thrown upon the older hacks until
    only a few selected people in the world really understand
    what is going on under the hood.

    And this worrisome trend goes on with everything else under
    linux, software quality goes down the drain...

    VISTA of course is much better :)

    There, the bloat is so big that the linux hacks are ridiculous in
    comparison.

    --
    jacob navia
    jacob at jacob point remcomp point fr
    logiciels/informatique
    http://www.cs.virginia.edu/~lcc-win32
    jacob navia, Jan 14, 2008
    #4
  5. jacob navia <> writes:

    > Robert Latest wrote:
    >>
    >>> In short, I would like to see the implementation
    >>> of standard header files such as <string.h> etc.

    >>
    >> If you want to see the implementation of the header, just look in
    >> /usr/include.

    >
    > Those were the old times Robert. When you would just look in the
    > include directory. This days, software bloat makes that impossible
    > since the system compiler stores the *real* includes under
    > /usr/lib/gcc... and a VERY long path.


    An excellent example of why off-topic posts should be re-directed to a
    more suitable news group. I'll limit my answer to say that, at least
    in general, you are wrong about this. To find out more re-post this
    comment to a group where Linux experts will feel free to comment on it

    --
    Ben.
    Ben Bacarisse, Jan 14, 2008
    #5
  6. Madhusudhanan Chandrasekaran

    James Kuyper Guest

    Robert Latest wrote:
    > Madhusudhanan Chandrasekaran wrote:

    ....
    > But in case you made the reverse mistake of those that use the word
    > "flammable" when in fact they mean "inflammable":


    That's not a mistake - in conflict with all reasonable expectations,
    those two words are in fact synonyms.
    <http://en.wiktionary.org/wiki/inflammable>
    James Kuyper, Jan 14, 2008
    #6
  7. Madhusudhanan Chandrasekaran

    pete Guest

    Madhusudhanan Chandrasekaran wrote:

    > In short, I would like to see the implementation
    > of standard header files such as <string.h> etc.


    Make sure that you do Not immitate
    any reserved identifier conventions.

    __Don't _start _writing __code _with __leading __underscores!

    --
    pete
    pete, Jan 14, 2008
    #7
  8. James Kuyper:

    > Robert Latest wrote:
    >> Madhusudhanan Chandrasekaran wrote:

    > ...
    >> But in case you made the reverse mistake of those that use the word
    >> "flammable" when in fact they mean "inflammable":

    >
    > That's not a mistake - in conflict with all reasonable expectations,
    > those two words are in fact synonyms.
    > <http://en.wiktionary.org/wiki/inflammable>



    I thought he was being sarcastic.

    While we're on the subject of stupidities in English, I was never quite
    comfortable with the term "ingenius" or "invaluable".

    --
    Tomás Ó hÉilidhe
    Tomás Ó hÉilidhe, Jan 14, 2008
    #8
  9. Madhusudhanan Chandrasekaran

    James Kuyper Guest

    Tomás Ó hÉilidhe wrote:
    > James Kuyper:
    >
    >> Robert Latest wrote:
    >>> Madhusudhanan Chandrasekaran wrote:

    >> ...
    >>> But in case you made the reverse mistake of those that use the word
    >>> "flammable" when in fact they mean "inflammable":

    >> That's not a mistake - in conflict with all reasonable expectations,
    >> those two words are in fact synonyms.
    >> <http://en.wiktionary.org/wiki/inflammable>

    >
    >
    > I thought he was being sarcastic.


    The first part of his response sarcastically answered the question as it
    was actually worded. The lines cited above were the introduction to the
    subsequent section of his response, in which he addressed the question
    as the OP presumably intended to write it, with "impossible" corrected
    to "possible".

    Based upon my personal experience (which is extensive, because my wife
    and many of my co-workers are not native speakers of English), I think
    Robert Latest was being excessively subtle. It requires considerable
    fluency in a language to recognize criticisms written that subtly, and I
    suspect that Madhusudhanan lacks that level of fluency - though I may be
    making an unjustified assumption based upon his name.
    James Kuyper, Jan 14, 2008
    #9
  10. Madhusudhanan Chandrasekaran

    CBFalconer Guest

    Robert Latest wrote:
    >

    .... snip ...
    >
    > But in case you made the reverse mistake of those that use the
    > word "flammable" when in fact they mean "inflammable":


    However those two words have the identical meaning. Really.

    --
    [mail]: Chuck F (cbfalconer at maineline dot net)
    [page]: <http://cbfalconer.home.att.net>
    Try the download section.



    --
    Posted via a free Usenet account from http://www.teranews.com
    CBFalconer, Jan 14, 2008
    #10
  11. Madhusudhanan Chandrasekaran

    Richard Bos Guest

    "=?iso-8859-1?q?Tom=E1s_=D3_h=C9ilidhe?=" <> wrote:

    > James Kuyper:
    >
    > > Robert Latest wrote:
    > >> Madhusudhanan Chandrasekaran wrote:

    > > ...
    > >> But in case you made the reverse mistake of those that use the word
    > >> "flammable" when in fact they mean "inflammable":

    > >
    > > That's not a mistake - in conflict with all reasonable expectations,
    > > those two words are in fact synonyms.
    > > <http://en.wiktionary.org/wiki/inflammable>

    >
    > I thought he was being sarcastic.
    >
    > While we're on the subject of stupidities in English, I was never quite
    > comfortable with the term "ingenius"


    Neither am I.

    Richard (not being 100% ingenuous)
    Richard Bos, Jan 15, 2008
    #11
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Ricky Corsi

    VC6 - .net class browsing

    Ricky Corsi, Apr 13, 2005, in forum: ASP .Net
    Replies:
    0
    Views:
    434
    Ricky Corsi
    Apr 13, 2005
  2. Katrina

    directory browsing

    Katrina, Dec 1, 2003, in forum: ASP .Net
    Replies:
    1
    Views:
    384
    Steve C. Orr [MVP, MCSD]
    Dec 1, 2003
  3. Big Tony

    Virtual Directory Browsing question

    Big Tony, Jan 25, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    435
    Scott Allen
    Jan 25, 2004
  4. Alvin Bruney [MVP]

    Re: ASP.NET Client File Browsing

    Alvin Bruney [MVP], May 10, 2004, in forum: ASP .Net
    Replies:
    0
    Views:
    461
    Alvin Bruney [MVP]
    May 10, 2004
  5. Replies:
    6
    Views:
    816
    red floyd
    May 10, 2005
Loading...

Share This Page