Module Name:    src
Committed By:   maxv
Date:           Sat May 11 11:53:55 UTC 2019

Modified Files:
        src/common/lib/libc/sys: cpuset.c

Log Message:
Fix bug, the computation of cpuset_nentries was incorrect, we must do +1
to be able to address the last 32 bits.

On a machine with 80 CPUs, this caused "cpuctl identify >64" to return
garbage.


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 src/common/lib/libc/sys/cpuset.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/common/lib/libc/sys/cpuset.c
diff -u src/common/lib/libc/sys/cpuset.c:1.20 src/common/lib/libc/sys/cpuset.c:1.21
--- src/common/lib/libc/sys/cpuset.c:1.20	Thu Jul 26 00:13:19 2018
+++ src/common/lib/libc/sys/cpuset.c	Sat May 11 11:53:55 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpuset.c,v 1.20 2018/07/26 00:13:19 kamil Exp $	*/
+/*	$NetBSD: cpuset.c,v 1.21 2019/05/11 11:53:55 maxv Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -32,7 +32,7 @@
 #ifndef _STANDALONE
 #include <sys/cdefs.h>
 #if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: cpuset.c,v 1.20 2018/07/26 00:13:19 kamil Exp $");
+__RCSID("$NetBSD: cpuset.c,v 1.21 2019/05/11 11:53:55 maxv Exp $");
 #endif /* LIBC_SCCS and not lint */
 
 #ifdef _LIBC
@@ -54,7 +54,7 @@ __RCSID("$NetBSD: cpuset.c,v 1.20 2018/0
 
 #define	CPUSET_SHIFT	5
 #define	CPUSET_MASK	31
-#define CPUSET_NENTRIES(nc)	((nc) > 32 ? ((nc) >> CPUSET_SHIFT) : 1)
+#define	CPUSET_NENTRIES(nc)	(((nc) >> CPUSET_SHIFT) + 1)
 #ifndef __lint__
 #define CPUSET_SIZE(n)	(sizeof( \
 	struct {  \

Reply via email to