gnu c libc and linux:how do they hook up?

David Korn
Thu Oct 11 10:17:00 GMT 2001

>-----Original Message-----
>From: Jibin Han []
>Sent: 19 November 2001 02:18
>Subject: gnu c libc and linux:how do they hook up?
>in gnu c stdio.h, there defines a stdout which is a file pointer. then in
>Linux how does this file pointer hook with Linux file system? could you
>pint me the doc of source-code-level explaination about it? How does it
>implement? then how about this hooking up issue in Solaris or vxWorks?

  It is always the job of the CRT startup code, which is part of the libc,
to set up any run-time environment needed.  I've not really explored the
glibc code, but there may be some .info files about it, or you might need
to configure the source code and then look through the various crt?.s files
to get an idea how they work.  Solaris will work pretty much the same way
as Linux, and in outline, the startup code will take file descriptors
0, 1 and 2 (which are opened by the shell before it exec's the application)
and links them to stdio file stream buffers, then place pointers to these
in the named variables.

  In VxWorks there is no startup code for the application, but the dynamic
linking takes care of it:  the OS itself initialises the streams, and the
stdin, stdout and stderr variables are task-specific variables that are
created automatically (presumably in the task init code) - see sections
3.3.2 and 3.4.2 of the VxWorks programmers guide (numbering relates to
T2/vxw 5.4, but is probably the same in earlier versions).

Burn your ID card!
Help support the campaign, copy this into your .sig!

This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error please notify
the system manager.

This footnote also confirms that this email message has been swept by
MIMEsweeper for the presence of computer viruses.

Want more information?  See the CrossGCC FAQ,
Want to unsubscribe? Send a note to

More information about the crossgcc mailing list