Ohcet Efil
Ohcet Efil

Reputation: 71

Is there a libc in kernel space?

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?

Upvotes: 7

Views: 5206

Answers (2)

skyking
skyking

Reputation: 14359

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).

Upvotes: 3

Artem Abramov
Artem Abramov

Reputation: 4751

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.

Upvotes: 14

Related Questions