From owner-freebsd-hackers@FreeBSD.ORG Thu Nov 20 04:02:17 2003 Return-Path: <owner-freebsd-hackers@FreeBSD.ORG> Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 4DAD016A4CE for <freebsd-hackers@freebsd.org>; Thu, 20 Nov 2003 04:02:17 -0800 (PST) Received: from firecrest.mail.pas.earthlink.net (firecrest.mail.pas.earthlink.net [207.217.121.247]) by mx1.FreeBSD.org (Postfix) with ESMTP id 7CDA743F3F for <freebsd-hackers@freebsd.org>; Thu, 20 Nov 2003 04:02:16 -0800 (PST) (envelope-from tlambert2@mindspring.com) Received: from user-2ivfikl.dialup.mindspring.com ([165.247.202.149] helo=mindspring.com) by firecrest.mail.pas.earthlink.net with asmtp (SSLv3:RC4-MD5:128) (Exim 3.33 #1) id 1AMnVm-0006El-00; Thu, 20 Nov 2003 04:02:15 -0800 Message-ID: <3FBCACCE.B1537278@mindspring.com> Date: Thu, 20 Nov 2003 04:00:14 -0800 From: Terry Lambert <tlambert2@mindspring.com> X-Mailer: Mozilla 4.79 [en] (Win98; U) X-Accept-Language: en MIME-Version: 1.0 To: lucy loo <lucyloo168@yahoo.com> References: <20031118083937.63444.qmail@web21509.mail.yahoo.com> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-ELNK-Trace: b1a02af9316fbb217a47c185c03b154d40683398e744b8a435a33cbb9bcd211e2324aaef52a19a74666fa475841a1c7a350badd9bab72f9c350badd9bab72f9c cc: freebsd-hackers@freebsd.org Subject: Re: Conflict between <sys/sysproto.h> & <stdio.h> ... ? X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Technical Discussions relating to FreeBSD <freebsd-hackers.freebsd.org> List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/freebsd-hackers>, <mailto:freebsd-hackers-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/freebsd-hackers> List-Post: <mailto:freebsd-hackers@freebsd.org> List-Help: <mailto:freebsd-hackers-request@freebsd.org?subject=help> List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/freebsd-hackers>, <mailto:freebsd-hackers-request@freebsd.org?subject=subscribe> X-List-Received-Date: Thu, 20 Nov 2003 12:02:17 -0000 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