Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 5 Jul 2012 15:38:32 +0000 (UTC)
From:      Konstantin Belousov <kib@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org
Subject:   svn commit: r238136 - stable/9/lib/libc/gen
Message-ID:  <201207051538.q65FcWGA081633@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: kib
Date: Thu Jul  5 15:38:32 2012
New Revision: 238136
URL: http://svn.freebsd.org/changeset/base/238136

Log:
  MFC r237660:
  Optimize the handling of SC_NPROCESSORS_CONF, by using auxv AT_NCPU
  value if present.
  
  Approved by:	re (kensmith)

Modified:
  stable/9/lib/libc/gen/sysconf.c
Directory Properties:
  stable/9/lib/libc/   (props changed)

Modified: stable/9/lib/libc/gen/sysconf.c
==============================================================================
--- stable/9/lib/libc/gen/sysconf.c	Thu Jul  5 15:37:17 2012	(r238135)
+++ stable/9/lib/libc/gen/sysconf.c	Thu Jul  5 15:38:32 2012	(r238136)
@@ -42,6 +42,7 @@ __FBSDID("$FreeBSD$");
 #include <sys/resource.h>
 #include <sys/socket.h>
 
+#include <elf.h>
 #include <errno.h>
 #include <limits.h>
 #include <paths.h>
@@ -51,6 +52,7 @@ __FBSDID("$FreeBSD$");
 
 #include "../stdlib/atexit.h"
 #include "tzfile.h"		/* from ../../../contrib/tzcode/stdtime */
+#include "libc_private.h"
 
 #define	_PATH_ZONEINFO	TZDIR	/* from tzfile.h */
 
@@ -585,6 +587,8 @@ yesno:
 
 	case _SC_NPROCESSORS_CONF:
 	case _SC_NPROCESSORS_ONLN:
+		if (_elf_aux_info(AT_NCPUS, &value, sizeof(value)) == 0)
+			return ((long)value);
 		mib[0] = CTL_HW;
 		mib[1] = HW_NCPU;
 		break;



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