On Tue, 15 May 2001, Jasper V Ferrer wrote:

> pero dahil sa nabuksan ang topic na ito,
> i did my assignment.  heto po ang resulta
> (partial) ng "grep -ri stdio.h /usr/src/linux":
>
> ...
> linux/drivers/char/conmakehash.c:#include <stdio.h>
> ...
> linux/drivers/pci/gen-devlist.c:#include <stdio.h>
> ...

Both conmakehash and gen-devlist are executables that are
built during the compilation of the kernel, but they are
not parts of the kernel itself.  I am sure there are similar
explanations of include directives of the form #include <stdio.h>.

> maybe it is more appropriate to say that the kernel
> does not depend on any specific version of libc,
> but does not depend on libc, hindi ko po maintindihan.
> meron po bang kasamang c library yung kernel pacakage?
> educate me pls.

One of the functions of the kernel is to provide system services
to user space programs.  If you read the file,
/usr/src/linux/arch/i386/kernel/entry.S, you get an idea of what
these services are.  These include the usual system calls like
exit, fork, read, write, open, etc.  A big part of the c library
is just to provide user space hooks to these kernel space services,
althought the c library also has library functions that are not
system calls, but the kernel never uses these.  In fact, the library
style functions that are not system calls, such as vsprintf and
other string utilities are provided by the functions in
/usr/src/linux/arc/i386/lib and /usr/src/linux/lib.  Also, if
you check /usr/src/linux/Makefile, the kernel "vmlinux" is built
by linking all the kernel components, but the -lc option to the ld
command is conspicuously absent, because the c library is not linked
into the kernel.

This is why the kernel is independent of (any version) c library.
This is also why the kernel can boot all alone by itself, and will
not look for a C library on boot up.  It is the applications
that need the C library.  In fact, on those old systems (like
the SCO Unix 3.2), many of the installation utilities like
tar, compress/uncompress, install, mknod, mkdir, chmod, etc
are all statically linked, and so the Unix system used during
installation does not need a (shared) C library.  The earliest
versions (3.x) of RedHat for DEC Alpha was distributed this way,
and so all the utilities were FAT.  Most modern linux systems today
have a shared C library (libc.so.6), and almost all applications
are dynamically linked to it, and so libc.so is required as long
as the system is running.

PManalastas




_
Philippine Linux Users Group. Web site and archives at http://plug.linux.org.ph
To leave: send "unsubscribe" in the body to [EMAIL PROTECTED]

To subscribe to the Linux Newbies' List: send "subscribe" in the body to 
[EMAIL PROTECTED]

Reply via email to