runtime: runtime.Caller should succeed even without debug info.
[gcc.git] / libgo / runtime / getncpu-bsd.c
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 }