Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 5 May 2016 11:42:22 +0300
From:      Konstantin Belousov <kostikbel@gmail.com>
To:        John Baldwin <jhb@freebsd.org>
Cc:        Bruce Evans <brde@optusnet.com.au>, Pedro Giffuni <pfg@freebsd.org>, "Ngie Cooper (yaneurabeya)" <yaneurabeya@gmail.com>, src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   Re: svn commit: r298933 - in head: share/man/man9 sys/amd64/include sys/dev/acpica sys/dev/drm2 sys/dev/drm2/i915 sys/kern sys/sys sys/x86/acpica sys/x86/x86
Message-ID:  <20160505084222.GD2422@kib.kiev.ua>
In-Reply-To: <2067797.hs1zGgLCXN@ralph.baldwin.cx>
References:  <201605021800.u42I0cjK084243@repo.freebsd.org> <20160504031930.A3395@besplex.bde.org> <1928389.rOu33C1eaq@ralph.baldwin.cx> <2067797.hs1zGgLCXN@ralph.baldwin.cx>

next in thread | previous in thread | raw e-mail | index | archive | help
On Wed, May 04, 2016 at 09:17:50PM -0700, John Baldwin wrote:
> On Tuesday, May 03, 2016 11:19:44 AM John Baldwin wrote:
> > On Wednesday, May 04, 2016 03:58:40 AM Bruce Evans wrote:
> > > On Tue, 3 May 2016, John Baldwin wrote:
> > > > I would be happy to fix _bitset.h and _cpuset.h to not need sys/param.h.
> > > > However, they also use NBBY which is defined in sys/param.h.  _sigset.h
> > > > gets around this because it uses an array of uint32_t and hardcodes a
> > > > shift count of 5 in _SIG_WORD() and a mask of 31 in _SIG_BIT().  If you
> > > > think it is fine to hardcode '8' instead of 'NBBY' I'll do that.  Hmm,
> > > > sys/select.h hardcodes '8' for _NFDBITS, so I guess that is fine.
> > > 
> > > NBBY can be cleaned up too.  I rather like it, but it is bogus in C90
> > > since it is spelled CHAR_BIT there, and it is now more bogus in POSIX
> > > since POSIX started specifying 8-bit bytes in 2001.  Thus 8 is the
> > > correct spelling of it in the implementation where you don't want to
> > > expose a macro that makes it clearer what this magic 8 is.
> > 
> > Ok.
> > 
> > > BTW, I don't like select's and bitset's use of longs.  Using unsigned
> > > for select is a historical mistake.  Bitset apparently copied select
> > > except it unimproved to signed long.  Bitstring uses unsigned char with
> > > no optimizations.  Sigset uses uint32_t with no obvious optimizations,
> > > but compilers do a good job with with it due to its fixed size.  I doubt
> > > that the manual optimization of using a wider size is important.
> > 
> > I agree, but cpuset_t is already part of the ABI in existing releases. :(
> > Changing it to uint32_t would break the ABI for big-endian platforms.
> 
> How about this:
> 
> diff --git a/sys/arm/arm/genassym.c b/sys/arm/arm/genassym.c
> index f9cb23e..9c67018 100644
> --- a/sys/arm/arm/genassym.c
> +++ b/sys/arm/arm/genassym.c
> @@ -28,6 +28,7 @@
>  #include <sys/cdefs.h>
>  __FBSDID("$FreeBSD$");
>  #include <sys/param.h>
> +#include <sys/cpuset.h>
>  #include <sys/systm.h>
>  #include <sys/assym.h>
>  #include <sys/proc.h>
> diff --git a/sys/sys/_bitset.h b/sys/sys/_bitset.h
> index 26a8848..89dd7b6 100644
> --- a/sys/sys/_bitset.h
> +++ b/sys/sys/_bitset.h
> @@ -36,26 +36,15 @@
>   * Macros addressing word and bit within it, tuned to make compiler
>   * optimize cases when SETSIZE fits into single machine word.
>   */
> -#define	_BITSET_BITS		(sizeof(long) * NBBY)
> +#define	_BITSET_BITS		(sizeof(long) * 8)
>  
> -#define	__bitset_words(_s)	(howmany(_s, _BITSET_BITS))
> +#define	_howmany(x, y)	(((x) + ((y) - 1)) / (y))
The _howmany symbol is still in the user namespace.  Implementation-reserved
names are __.* and _[A-Z].* .




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20160505084222.GD2422>