From owner-freebsd-hackers@FreeBSD.ORG Sat Jul 2 15:41:03 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 EA5AA106564A; Sat, 2 Jul 2011 15:41:03 +0000 (UTC) (envelope-from rmh.aybabtu@gmail.com) Received: from mail-pz0-f54.google.com (mail-pz0-f54.google.com [209.85.210.54]) by mx1.freebsd.org (Postfix) with ESMTP id BE3F88FC19; Sat, 2 Jul 2011 15:41:03 +0000 (UTC) Received: by pzk27 with SMTP id 27so1580939pzk.13 for ; Sat, 02 Jul 2011 08:41:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:sender:date:x-google-sender-auth:message-id:subject :from:to:content-type; bh=1kDCb7FDZbAm841eKFHXu299kXVfVkraU4qtMTmxCHI=; b=W7I2ci7W8I2Mh2IZstHrcZ+xhmQH8NMA1vMW+ZjVPsoqd8XXCFNxBJa12zTEEd9QTf KnkBOuaWsJkqfGffNyYVxt2U5d4SH1G+HyGaWI2j82MSMMa++9pCHnPdTYHnLENpnL0z 6EKlfkM9S4UgA8DW6BGIvUlHcYI7Xf/dfG+K8= MIME-Version: 1.0 Received: by 10.68.35.103 with SMTP id g7mr4976479pbj.471.1309621263284; Sat, 02 Jul 2011 08:41:03 -0700 (PDT) Sender: rmh.aybabtu@gmail.com Received: by 10.68.47.138 with HTTP; Sat, 2 Jul 2011 08:41:03 -0700 (PDT) Date: Sat, 2 Jul 2011 17:41:03 +0200 X-Google-Sender-Auth: 3zuN4MspsYV5Irg8xA3T-PIkx-Y Message-ID: From: Robert Millan To: freebsd-hackers@freebsd.org, Ed Maste Content-Type: multipart/mixed; boundary=bcaec51ddbf73038f704a717f60c Cc: Subject: [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: Sat, 02 Jul 2011 15:41:04 -0000 --bcaec51ddbf73038f704a717f60c Content-Type: text/plain; charset=UTF-8 Since their inception, GNU/kFreeBSD systems had defined "__FreeBSD_kernel__" as builtin macro to indicate this is a system that uses the kernel of FreeBSD. We couldn't define "__FreeBSD__" because this implies a full FreeBSD system, and a lot of software checks for this macro when it is concerned with userland (usually libc). As a result of this, and of the considerable porting effort that followed, many 3rd party programs with kernel-specific extensions have been ported to recognize __FreeBSD_kernel__ as well. E.g.: #if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) // code for FreeBSD kernel #endif My request is that FreeBSD also defines __FreeBSD_kernel__. If this happens, life would be made a bit easier on both sides, as it'd be more natural for porters of either system to support both using a single macro [1]. [1] When porting software to support FreeBSD and systems with kernel of FreeBSD myself (as I did with e.g. GRUB), I generally took care to ensure both macros are checked for, but this isn't always the case. Having a unified macro would make it easier for developers of both systems to cooperate. -- Robert Millan --bcaec51ddbf73038f704a717f60c Content-Type: text/plain; charset=US-ASCII; name="freebsd_kernel.diff" Content-Disposition: attachment; filename="freebsd_kernel.diff" Content-Transfer-Encoding: base64 X-Attachment-Id: f_gpmqj6e20 SW5kZXg6IGNvbnRyaWIvZ2NjL2NvbmZpZy9mcmVlYnNkLXNwZWMuaAo9PT09PT09PT09PT09PT09 PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09Ci0tLSBj b250cmliL2djYy9jb25maWcvZnJlZWJzZC1zcGVjLmgJKHJldmlzaW9uIDIyMzcyMSkKKysrIGNv bnRyaWIvZ2NjL2NvbmZpZy9mcmVlYnNkLXNwZWMuaAkod29ya2luZyBjb3B5KQpAQCAtNTQsNiAr NTQsNyBAQAogICBkbwkJCQkJCQkJCVwKICAgICB7CQkJCQkJCQkJXAogCWJ1aWx0aW5fZGVmaW5l X3dpdGhfaW50X3ZhbHVlICgiX19GcmVlQlNEX18iLCBGQlNEX01BSk9SKTsJXAorCWJ1aWx0aW5f ZGVmaW5lICgiX19GcmVlQlNEX2tlcm5lbF9fIik7CQkJCVwKIAlidWlsdGluX2RlZmluZV9zdGQg KCJ1bml4Iik7CQkJCQlcCiAJYnVpbHRpbl9kZWZpbmVfc3RkICgiX191bml4X18iKTsJCQkJXAog CWJ1aWx0aW5fZGVmaW5lICgiX19LUFJJTlRGX0FUVFJJQlVURV9fIik7CQkJXAo= --bcaec51ddbf73038f704a717f60c--