From owner-freebsd-standards@FreeBSD.ORG Thu Mar 18 14:33:31 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 E65C816A4CE for ; Thu, 18 Mar 2004 14:33:30 -0800 (PST) Received: from STVAVAPPL1.BHMSTV (unknown [207.203.42.3]) by mx1.FreeBSD.org (Postfix) with SMTP id 7ED0943D3F for ; Thu, 18 Mar 2004 14:33:30 -0800 (PST) (envelope-from archie@dellroad.org) Received: from unknown(10.104.180.64) by STVAVAPPL1.BHMSTV via csmap id 0a4304da_792b_11d8_897d_00304811e8c8_25077; Thu, 18 Mar 2004 16:24:37 -0600 (CST) Received: from arch20m.dellroad.org (localhost [127.0.0.1]) i2IMXPCm002725 for ; Thu, 18 Mar 2004 16:33:25 -0600 (CST) (envelope-from archie@arch20m.dellroad.org) Received: (from archie@localhost) by arch20m.dellroad.org (8.12.9p2/8.12.9/Submit) id i2IMXPuJ002724 for freebsd-standards@freebsd.org; Thu, 18 Mar 2004 16:33:25 -0600 (CST) (envelope-from archie) From: Archie Cobbs Message-Id: <200403182233.i2IMXPuJ002724@arch20m.dellroad.org> To: freebsd-standards@freebsd.org Date: Thu, 18 Mar 2004 16:33:25 -0600 (CST) X-Mailer: ELM [version 2.4ME+ PL99b (25)] MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII Subject: _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: Thu, 18 Mar 2004 22:33:31 -0000 Hi, Apologies if this is an old question, searching the archives didn't yeild any answers. All I'm trying to do is write some portable code :-) Here "portable" simply means that it compiles on both FreeBSD and Linux. In order to get the various functions I need I have to set a bunch of flags. On Linux, these flags do the trick (taken from configure.in): AC_DEFINE(_XOPEN_SOURCE, 600, XOpen functions) AC_DEFINE(_GNU_SOURCE, 1, GNU functions) AC_DEFINE(_BSD_SOURCE, 1, BSD functions) AC_DEFINE(_ISOC99_SOURCE, 1, ISO C99 functions) AC_DEFINE(_POSIX_VERSION, 200112, POSIX version) AC_DEFINE(_POSIX_C_SOURCE, 200112, POSIX functions) 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. Q1: Why does Linux require _BSD_SOURCE but FreeBSD requires __BSD_VISIBLE? Q2: Is there some standard for these flags documented somewhere? Q3: What is the right and portable set of flags to use? Any enlightenment is greatly appreciated. Thanks, -Archie P.S. Please CC: me as I'm not on this list. __________________________________________________________________________ Archie Cobbs * CTO, Awarix * http://www.awarix.com