Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 19 Apr 2006 18:04:36 +0200
From:      Mathieu Prevot <bsdhack@club-internet.fr>
To:        freebsd-hackers@freebsd.org
Subject:   sysctl(3) and sysctl(8) discrepancies
Message-ID:  <20060419160436.GA6835@scienceclue.ath.cx>

next in thread | raw e-mail | index | archive | help
Hello,

I have FreeBSD 6.1-RC #27: Wed Apr 19 02:08:00 CEST 2006 amd64 and I have 3
different outputs about hw.ncpu:

`sysctl hw.ncpu` gives me:

'hw.ncpu: 2'


and I have:

hw.ncpu = 6
hw.ncpu = 3


with:

#include <stdlib.h>
#include <sys/types.h>
#include <sys/sysctl.h>

main()
{
  int ncpu[1];
	size_t len;

	len=sizeof(int);
	sysctlnametomib("hw.ncpu",ncpu,&len);

	printf("hw.ncpu = %d\n",(*ncpu));
	printf("hw.ncpu = %d\n",HW_NCPU);

	exit(0);
}

Am I doing something wrong ?

Mathieu



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