Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8857535
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T14:36:47+00:00 2026-06-14T14:36:47+00:00

I just got started with learning kernel development and had a small doubt. Why

  • 0

I just got started with learning kernel development and had a small doubt. Why can’t we use c functions in kernel development after linking it with the c library? Why is it that the kernel is never linked with a c library but has its own implementation of some standard c functions like printk() instead of printf(). IF the kernel is written in c and compiled with the help of a c compiler then why can’t we use the standard function from the c library?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T14:36:49+00:00Added an answer on June 14, 2026 at 2:36 pm

    Because the GNU C Library which you are familiar with is implemented for user mode, not kernel mode. The kernel cannot access a userspace API (which might invoke a syscall to the Linux kernel).

    From the KernelNewbies FAQ

    Can I use library functions in the kernel ?

    System libraries (such as glibc, libreadline, libproplist, whatever) that are typically available to userspace programmers are unavailable to kernel programmers. When a process is being loaded the loader will automatically load any dependent libraries into the address space of the process. None of this mechanism is available to kernel programmers: forget about ISO C libraries, the only things available is what is already implemented (and exported) in the kernel and what you can implement yourself.

    Note that it is possible to "convert" libraries to work in the kernel; however, they won’t fit well, the process is tedious and error-prone, and there might be significant problems with stack handling (the kernel is limited to a small amount of stack space, while userspace programs don’t have this limitation) causing random memory corruption.

    Many of the commonly requested functions have already been implemented in the kernel, sometimes in "lightweight" versions that aren’t as featureful as their userland counterparts. Be sure to grep the headers for any functions you might be able to use before writing your own version from scratch. Some of the most commonly used ones are in include/linux/string.h.

    Whenever you feel you need a library function, you should consider your design, and ask yourself if you could move some or all the code into user-space instead.

    If you need to use functions from standard library, you have to re-implement that functionality because of a simple reason – there is no standard C library.

    C library is basically implemented on the top of the Linux kernel (or other operating system’s kernel).

    For instance, C library’s mkdir(3) function is basically nothing more than a wrapper for Linux kernel’s system call mkdir(2).

    http://linux.die.net/man/3/mkdir
    http://linux.die.net/man/2/mkdir

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Just started learning Groovy, got the PragProg book Programming Groovy and had a problem
I have just started learning wordpress plugin development and got this error when I
So ive just started learning python on WAMP, ive got the results of a
I just started using Sequel in a really small Sinatra app. Since I've got
I just started learning Haskell. I think I've got the basics down, but I
I just got started with rails, and when I testing in development mode, I
I just started learning python and django and I have a question. I got
I've just started learning Android development and as a little project, I'm building a
I just got a company MacBook and started learning Xcode. When I tried to
I just started learning portlet and got stuck in the first place. I have

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.