From owner-freebsd-hackers@FreeBSD.ORG Sun Jul 3 15:37:31 2011 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7F8BD106564A; Sun, 3 Jul 2011 15:37:31 +0000 (UTC) (envelope-from rmh.aybabtu@gmail.com) Received: from mail-pv0-f182.google.com (mail-pv0-f182.google.com [74.125.83.182]) by mx1.freebsd.org (Postfix) with ESMTP id 514168FC12; Sun, 3 Jul 2011 15:37:31 +0000 (UTC) Received: by pvg11 with SMTP id 11so5427777pvg.13 for ; Sun, 03 Jul 2011 08:37:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type; bh=ZcsFJq18iYOi6uIXjrjqYf8cMaG8wMc9Wy+W4+p/HQs=; b=ZBgxp5BbwOWbaWtfob4j/6mCz2FUBYDw2ungbiaTR4CchgTMkkjvd3z7i9LZsYU1kL QDsjmMU7F9WG0MwrxvEAQimmmPiBgOyCPt8v4F1Fs+wStK6nQ8NxJJlcKexYN5/2s9F4 7Gy4xs6lE4R/nHH1c1vUT57DddBY1JiXdwc94= MIME-Version: 1.0 Received: by 10.68.29.74 with SMTP id i10mr6015934pbh.69.1309707450881; Sun, 03 Jul 2011 08:37:30 -0700 (PDT) Sender: rmh.aybabtu@gmail.com Received: by 10.68.47.138 with HTTP; Sun, 3 Jul 2011 08:37:30 -0700 (PDT) In-Reply-To: <20110703103531.4a553271@kan.dnsalias.net> References: <20110702193724.5c55a6c9@kan.dnsalias.net> <20110703020827.GA5763@sandvine.com> <20110703103531.4a553271@kan.dnsalias.net> Date: Sun, 3 Jul 2011 17:37:30 +0200 X-Google-Sender-Auth: iAV8GU95s87JxzIf2o6Txw5mBoc Message-ID: From: Robert Millan To: Alexander Kabaev Content-Type: text/plain; charset=UTF-8 Cc: Garrett Cooper , freebsd-hackers@freebsd.org, Ed Maste Subject: Re: [PATCH] __FreeBSD_kernel__ 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: Sun, 03 Jul 2011 15:37:31 -0000 2011/7/3 Alexander Kabaev : > __linux__ is exactly what __FreeBSD__ is and dies not identify kernel > but rather Linux as whole OS, whatever that might be these days. > > There does not appear to be an universal macro that identifies > environment as using Linux kernel regardless of the rest of components > used (say, to identify Android and Ubuntu or something embedded with > ucLibc as running Linux kernel with different userland > implementations). I think I'll cowardly try to stick to a practical POV and avoid the discussion about names that tends to get people excited about :-) So from a purely practical perspective: - If __linux__ is defined, this implies you're using a specific kernel. - If you're using that specific kernel, this implies __linux__ is defined. which explains why using __linux__ to identify the kernel is useful and reliable. Can __linux__ be used to identify more things? Most notably, can __linux__ be used to identify userland API? - If __linux__ is defined, this does not imply you're using GNU libc. - If you're using GNU libc, this does not imply __linux__ is defined. which explains why using __linux__ to identify libc is a bad idea. However, it can be useful to identify a set of different C libraries (Glibc, Bionic, uclibc, etc) if they share the property you're interested in. -- Robert Millan