From owner-freebsd-amd64@FreeBSD.ORG Mon Sep 6 14:21:35 2010 Return-Path: Delivered-To: freebsd-amd64@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0D3261065695 for ; Mon, 6 Sep 2010 14:21:35 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from fallbackmx08.syd.optusnet.com.au (fallbackmx08.syd.optusnet.com.au [211.29.132.10]) by mx1.freebsd.org (Postfix) with ESMTP id 628498FC1B for ; Mon, 6 Sep 2010 14:21:34 +0000 (UTC) Received: from mail09.syd.optusnet.com.au (mail09.syd.optusnet.com.au [211.29.132.190]) by fallbackmx08.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id o86Bu6UB010599 for ; Mon, 6 Sep 2010 21:56:06 +1000 Received: from c122-107-116-249.carlnfd1.nsw.optusnet.com.au (c122-107-116-249.carlnfd1.nsw.optusnet.com.au [122.107.116.249]) by mail09.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id o86Bu14H019969 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Mon, 6 Sep 2010 21:56:02 +1000 Date: Mon, 6 Sep 2010 21:56:00 +1000 (EST) From: Bruce Evans X-X-Sender: bde@delplex.bde.org To: John Baldwin In-Reply-To: <201009010817.35653.jhb@freebsd.org> Message-ID: <20100906214101.S887@delplex.bde.org> References: <201009011050.o81Ao3DB072806@freefall.freebsd.org> <201009010817.35653.jhb@freebsd.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: Andriy Gapon , freebsd-amd64@FreeBSD.org, bde@FreeBSD.org Subject: Re: amd64/150170: SIG_ATOMIC_MIN/SIG_ATOMIC_MAX 32-bit when sig_atomic_t is 64-bit X-BeenThere: freebsd-amd64@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Porting FreeBSD to the AMD64 platform List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 06 Sep 2010 14:21:35 -0000 On Wed, 1 Sep 2010, John Baldwin wrote: > On Wednesday, September 01, 2010 6:50:03 am Andriy Gapon wrote: >> The following reply was made to PR amd64/150170; it has been noted by GNATS. >> >> From: Andriy Gapon >> To: Gerald Pfeifer >> Cc: Gerald Pfeifer , FreeBSD-gnats-submit@FreeBSD.org >> Subject: Re: amd64/150170: SIG_ATOMIC_MIN/SIG_ATOMIC_MAX 32-bit when > sig_atomic_t >> is 64-bit >> Date: Wed, 01 Sep 2010 13:26:36 +0300 >> >> on 01/09/2010 01:32 Gerald Pfeifer said the following: > ... >> >> Description: >> > On a 9.0-CURRENT machine, amd64, we have: >> > >> > /usr/include/machine/signal.h:typedef long sig_atomic_t; >> > >> > This is 32-bit. At the same time we have: >> > >> > /usr/include/machine/_stdint.h:#define SIG_ATOMIC_MIN INT32_MIN >> > /usr/include/machine/_stdint.h:#define SIG_ATOMIC_MAX INT32_MAX >> > >> > Which is 64-bit. >> >> 32-bit vs 64-bit seems to be reversed here... > > Yes, but we should still fix this one way or another. I was surprised > recently when I found that sig_atomic_t was long on amd64. Perhaps Bruce > (cc'd) knows which way it should be fixed? Not really. It is weird that sig_atomic_t is long on all 64-bit arches, but long on only 1 32-bit (also 64-bit?) arch (arm). I would have used the smallest type that works (usually signed char), but a case can be made for using the largest type that works. C99 only requires the range of the type to be at least that of an 8-bit signed char if the type is signed or at least that of an 8-bit unsigned char if the type is unsigned. Portable programs would have problems using more than the intersection of these ranges, even (or especially) if they have ifdefs using SIG_ATOMIC_MAX/MIN. Now there might be ABI problems for changing the type, or perhaps even with changing SIG_ATOMIC_MAX/MIN since these are specified as the limits of a sig_atomic_t and ifdef tangles using them might trust this. Bruce