Conflict between <sys/sysproto.h> & <stdio.h> ... ?

Terry Lambert tlambert2 at
Thu Nov 20 04:02:17 PST 2003

lucy loo wrote:
> I am writing a kernel loadable module to reimplement some system calls.
> I have included <sys/sysproto.h>, <sys/systm.h>, etc. -- very standard
> header files for kld implmentation.

So far...

> I also want to do file i/o in this module, therefore I need to include
> <stdio.h>. But it obviously conflicts with those <sys/...>, and make
> won't pass.  Anyone knows how to fix this?

You cannot use libc functions in the kernel.  The kernel does not
link against libc.  It is not an application, it is a kernel.

There are some libc functions which are provided in the kernel;
there are other libc functions for which there are similar kernel
functions of the same name (e.g. "printf"), and there are some
"libc" functions -- quoted because they aren't really there, but
you can use them -- that are inlined by the compiler.

Programming in the kernel environment is not the same as programming
in the normal applications environment (the "POSIX" environment).

-- Terry

More information about the freebsd-hackers mailing list