Add kvm_getncpus() to obtain mp_ncpus.
Sponsored by: Nginx, Inc.
This commit is contained in:
parent
2c566b9c4e
commit
9292aad4c9
@ -77,6 +77,7 @@ char *kvm_geterr(kvm_t *);
|
||||
char *kvm_getfiles(kvm_t *, int, int, int *);
|
||||
int kvm_getloadavg(kvm_t *, double [], int);
|
||||
int kvm_getmaxcpu(kvm_t *);
|
||||
int kvm_getncpus(kvm_t *);
|
||||
void *kvm_getpcpu(kvm_t *, int);
|
||||
uint64_t kvm_counter_u64_fetch(kvm_t *, u_long);
|
||||
struct kinfo_proc *
|
||||
|
@ -28,7 +28,7 @@
|
||||
.\"
|
||||
.\" $FreeBSD$
|
||||
.\"
|
||||
.Dd April 11, 2013
|
||||
.Dd February 12, 2014
|
||||
.Dt KVM_GETPCPU 3
|
||||
.Os
|
||||
.Sh NAME
|
||||
@ -47,6 +47,8 @@
|
||||
.Fn kvm_dpcpu_setcpu "kvm_t *kd" "u_int cpu"
|
||||
.Ft int
|
||||
.Fn kvm_getmaxcpu "kvm_t *kd"
|
||||
.Ft int
|
||||
.Fn kvm_getncpus "kvm_t *kd"
|
||||
.Ft void *
|
||||
.Fn kvm_getpcpu "kvm_t *kd" "int cpu"
|
||||
.Ft ssize_t
|
||||
@ -73,6 +75,10 @@ The
|
||||
function returns the maximum number of CPUs supported by the kernel.
|
||||
.Pp
|
||||
The
|
||||
.Fn kvm_getncpus
|
||||
function returns the current number of CPUs in the kernel.
|
||||
.Pp
|
||||
The
|
||||
.Fn kvm_getpcpu
|
||||
function returns a buffer holding the per-CPU data for a single CPU.
|
||||
This buffer is described by the
|
||||
|
@ -173,6 +173,16 @@ kvm_getmaxcpu(kvm_t *kd)
|
||||
return (maxcpu);
|
||||
}
|
||||
|
||||
int
|
||||
kvm_getncpus(kvm_t *kd)
|
||||
{
|
||||
|
||||
if (mp_ncpus == 0)
|
||||
if (_kvm_pcpu_init(kd) < 0)
|
||||
return (-1);
|
||||
return (mp_ncpus);
|
||||
}
|
||||
|
||||
static int
|
||||
_kvm_dpcpu_setcpu(kvm_t *kd, u_int cpu, int report_error)
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user