repo.or.cz
/
official-gcc.git
/
blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
log
|
graphiclog1
|
graphiclog2
|
commit
|
commitdiff
|
tree
|
refs
|
edit
|
fork
blame
|
history
|
raw
|
HEAD
2014-07-11 Edward Smith-Rowland <3dw4rd@verizon.net>
[official-gcc.git]
/
libgo
/
runtime
/
getncpu-bsd.c
blob
00a81d1ddae50662292fdf5928407393fbaf2cd4
1
// Copyright 2012 The Go Authors. All rights reserved.
2
// Use of this source code is governed by a BSD-style
3
// license that can be found in the LICENSE file.
4
5
#include <sys/types.h>
6
#include <sys/sysctl.h>
7
8
#include
"runtime.h"
9
#include
"defs.h"
10
11
int32
12
getproccount
(
void
)
13
{
14
int
mib
[
2
],
out
;
15
size_t
len
;
16
17
mib
[
0
] =
CTL_HW
;
18
mib
[
1
] =
HW_NCPU
;
19
len
=
sizeof
(
out
);
20
if
(
sysctl
(
mib
,
2
, &
out
, &
len
,
NULL
,
0
) >=
0
)
21
return
(
int32
)
out
;
22
else
23
return
0
;
24
}