Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 20 Nov 2003 04:00:14 -0800
From:      Terry Lambert <tlambert2@mindspring.com>
To:        lucy loo <lucyloo168@yahoo.com>
Cc:        freebsd-hackers@freebsd.org
Subject:   Re: Conflict between <sys/sysproto.h> & <stdio.h> ... ?
Message-ID:  <3FBCACCE.B1537278@mindspring.com>
References:  <20031118083937.63444.qmail@web21509.mail.yahoo.com>

next in thread | previous in thread | raw e-mail | index | archive | help
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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3FBCACCE.B1537278>