From owner-freebsd-standards@FreeBSD.ORG Fri Mar 19 09:51:43 2004 Return-Path: Delivered-To: freebsd-standards@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id CD09516A4CE for ; Fri, 19 Mar 2004 09:51:43 -0800 (PST) Received: from hda.hda.com (host65.hda.com [63.104.68.65]) by mx1.FreeBSD.org (Postfix) with ESMTP id EBAA743D2F for ; Fri, 19 Mar 2004 09:51:41 -0800 (PST) (envelope-from dufault@hda.com) Received: from [198.252.184.80] (skinny.hda.com [198.252.184.80]) by hda.hda.com (8.11.6/8.11.6) with ESMTP id i2JHvNF94981; Fri, 19 Mar 2004 12:57:23 -0500 (EST) (envelope-from dufault@hda.com) In-Reply-To: <200403182331.i2INVSIb005180@arch20m.dellroad.org> References: <200403182331.i2INVSIb005180@arch20m.dellroad.org> Mime-Version: 1.0 (Apple Message framework v612) Content-Type: text/plain; charset=US-ASCII; format=flowed Message-Id: <119431E2-79CE-11D8-990F-000393B2C586@hda.com> Content-Transfer-Encoding: 7bit From: Peter Dufault Date: Fri, 19 Mar 2004 12:51:37 -0500 To: Archie Cobbs X-Mailer: Apple Mail (2.612) cc: freebsd-standards@freebsd.org Subject: Re: _BSD_SOURCE vs. __BSD_VISIBLE X-BeenThere: freebsd-standards@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Standards compliance List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 19 Mar 2004 17:51:43 -0000 On Mar 18, 2004, at 6:31 PM, Archie Cobbs wrote: > Garrett Wollman wrote: >>> On FreeBSD, _BSD_SOURCE is not recognized, but _POSIX_C_SOURCE is and >>> it actually causes the BSD functions to be hidden. So I have to >>> manually >>> add __BSD_VISIBLE to get them on FreeBSD. >> >> Then your code is wrong. If you don't want POSIX namespace, then you >> shouldn't be defining _POSIX_C_SOURCE. > > So you're saying that _POSIX_C_SOURCE is not an additive thing, > it's a restrictive thing. > > This is different semantics from other flags (which serve to include > symbols rather than omit them), which is contributing to my confusion. > E.g. _GNU_SOURCE on Linux. > > Are these flags documented somewhere? The POSIX ones are. Bruce can cryptically correct me, but I think basically: _POSIX_C_SOURCE specifies a set of symbols that must and that can be published, based on what you set _POSIX_C_SOURCE to. It is set to a date representing one of the approved POSIX specs. It must be defined before including . Additional symbols can not be published, unless they are enabled by another feature test macro (e.g., __BSD_VISIBLE) or unless _POSIX_C_SOURCE is set to a value representing a date newer than the specification you're reading, which means if you set it to a value, newer stuff can't show up. Got that part? So (and I'm guilty for some of this), a feature test macro such as __BSD_VISIBLE is not intended for the end user (the two underbars are supposed to imply that) but is to set things up internally based on combinations of other items such as the date setting of _POSIX_C_SOURCE, whether a given item is historically expected to show up in a given environment, or other finer-grained selections. I'll duck now, but maybe FreeBSD should set __BSD_VISIBLE if _BSD_SOURCE is defined. I'm pretty sure the POSIX spec suggests exactly this sort of setting. To be really portable, try setting _POSIX_C_SOURCE to a certain date, based on a published POSIX spec, not setting any other feature test macros on the command line or before including , and getting the application to work. If you can get your application to work, then a non-conforming system is at fault. Good luck - Peter > Peter Dufault HD Associates, Inc.