7

Is there a libc in kernel space? I mean you have to build kernel against some libc right? So Is there a libc (probably statically-linked) sitting within kernel space?

If yes, how is this related to userland glibc? Must they be the same version?

1

2 Answers 2

14

There is actually no libc in kernel space. Libc is user-space library, and you can't use it from kernel-space.

But almost all functions from libc that make sense in kernel space are ported. You can find headers in include/linux/ usually.

As far as I know these two implementations don't share codebase.

3

Some of the functions that are available in libc are implemented inside the kernel code, for example there's a printf function that works as the normal (at least as far as the kernel code it self requires).

This means that while it looks like the code uses libc (by the functions that seem to be available) there actually no need to link it with a library (AFAIK).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.