From owner-freebsd-hackers@FreeBSD.ORG Mon Feb 6 11:28:34 2006 Return-Path: X-Original-To: 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 E64EF16A420 for ; Mon, 6 Feb 2006 11:28:34 +0000 (GMT) (envelope-from joseph.koshy@gmail.com) Received: from xproxy.gmail.com (xproxy.gmail.com [66.249.82.205]) by mx1.FreeBSD.org (Postfix) with ESMTP id 77D0843D48 for ; Mon, 6 Feb 2006 11:28:34 +0000 (GMT) (envelope-from joseph.koshy@gmail.com) Received: by xproxy.gmail.com with SMTP id s9so742470wxc for ; Mon, 06 Feb 2006 03:28:33 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=Nt/RLtgwjS6o2AQt/zekFO5lPwU11iYpRrTSGJSHtTcf42GPJBHlDlWiyji/R7nH9CpCZP+i7bRlCdyhbni0fySWaJU5KbGrZhIlwbj9n7lDJ4K+QxGjAqS1VAlOGfJOpkOD1nxiOKvKdUZtPDwtlO2VS/xAO8DsTa9VytZi2g8= Received: by 10.70.74.19 with SMTP id w19mr6066222wxa; Mon, 06 Feb 2006 03:28:33 -0800 (PST) Received: by 10.70.105.2 with HTTP; Mon, 6 Feb 2006 03:28:33 -0800 (PST) Message-ID: <84dead720602060328o39c8f964h3fcf355930262816@mail.gmail.com> Date: Mon, 6 Feb 2006 16:58:33 +0530 From: Joseph Koshy To: Tanmay In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline References: Cc: freebsd-hackers@freebsd.org Subject: Re: What is '_KERNEL' in the source ? X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 06 Feb 2006 11:28:35 -0000 > In various kernel source files,i came across '#ifdef _KERNEL'. > What is '_KERNEL' used for ? In some files _KERNEL is #defined to nothing= ?? > Can anybody please explain this ? It is used to control the visibility of types and prototypes in system head= ers. Kernel builds define _KERNEL, but userland compiles usually do not. Thus a #include has a different meaning in userland than in the kernel= . See: src/sys/conf/{kern.pre,kmod}.mk A few userland utilities (e.g., fstat) define _KERNEL before including headers from because they need more knowledge of kernel data structures than is the norm for userland. -- FreeBSD Volunteer, http://people.freebsd.org/~jkoshy