From owner-freebsd-stable@freebsd.org Wed Jul 5 15:10:33 2017 Return-Path: Delivered-To: freebsd-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4CC60DAD355 for ; Wed, 5 Jul 2017 15:10:33 +0000 (UTC) (envelope-from vangyzen@FreeBSD.org) Received: from smtp.vangyzen.net (hotblack.vangyzen.net [IPv6:2607:fc50:1000:7400:216:3eff:fe72:314f]) by mx1.freebsd.org (Postfix) with ESMTP id 3605983EB0 for ; Wed, 5 Jul 2017 15:10:33 +0000 (UTC) (envelope-from vangyzen@FreeBSD.org) Received: from ford.home.vangyzen.net (unknown [76.164.15.242]) by smtp.vangyzen.net (Postfix) with ESMTPSA id 8CB505646D; Wed, 5 Jul 2017 10:10:32 -0500 (CDT) Subject: Re: Compile-time check for clock_nanosleep() To: Chris Ross Cc: freebsd-stable@freebsd.org References: <20170703184610.GH65214@home.opsec.eu> From: Eric van Gyzen Message-ID: <1686a27e-b92e-75ba-868a-e4351bfc8af0@FreeBSD.org> Date: Wed, 5 Jul 2017 10:10:27 -0500 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:52.0) Gecko/20100101 Thunderbird/52.2.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit X-BeenThere: freebsd-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Production branch of FreeBSD source code List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 Jul 2017 15:10:33 -0000 On 07/03/2017 15:28, Chris Ross wrote: > >> On Jul 3, 2017, at 14:46, Kurt Jaeger wrote: >> >> Use __FreeBSD_version from sys/param.h: >> >> https://www.freebsd.org/doc/en_US.ISO8859-1/books/porters-handbook/versions.html > > Thanks. That looks great. Also, for my specific case of the addition of clock_nanosleep(), it looks from time.h like I could use "__POSIX_VISIBLE >= 200112”. Maybe that isn’t safe, since later looking at time.h on 11.0 and on 11.1, the latter has a definition for clock_nanosleep() in that block, but the former does not. __POSIX_VISIBLE has a different purpose and can't be used for this. It's part of a way for the application to request a strict namespace of certain versions of POSIX, ANSI C, etc. > Yeah, digging around it appears that stable/11/sys/sys/param.h at r316498 had __FreeBSD_version at 1100512, and it was raised to 1100513 in revision 318197. And, clock_nanosleep was MFC’d into 11-stable in-between the two, at revision 317618. So, not a precise match there, but >= 1100513 should be safe. Yes, this is exactly what you want. Actually, what you /really/ want is for the committer to remember to bump __FreeBSD_version when he added the call, but I forgot. :( Cheers, Eric