* config/pa/fptr.c (SIGN_EXTEND): Cast -1 to unsigned.
[official-gcc.git] / libgo / runtime / getncpu-bsd.c
blob00a81d1ddae50662292fdf5928407393fbaf2cd4
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.
5 #include <sys/types.h>
6 #include <sys/sysctl.h>
8 #include "runtime.h"
9 #include "defs.h"
11 int32
12 getproccount(void)
14 int mib[2], out;
15 size_t len;
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;