<i>TIP 377 : Portably determine number of processors</i> status still Open with 4 other changes
by
.
D 2010-09-24T22:58:51
J icomment On\smodern\sBSDs,\syou\scan\sget\sthe\snumber\sof\sCPUs\sused\sby\sthe\skernel\swith\n\n\s\s\s\sint\snumCPU;\n\s\s\s\sint\smib[2];\n\s\s\s\ssize_t\slen;\s\n\n\s\s\s\s/*\sset\sthe\smib\sfor\shw.ncpu\s*/\n\s\s\s\smib[0]\s=\sCTL_HW;\n\s\s\s\smib[1]\s=\sHW_NCPU;\n\n\s\s\s\s/*\sget\sthe\snumber\sof\sCPUs\sfrom\sthe\ssystem\s*/\n\s\s\s\ssysctl(mib,\s2,\s&numCPU,\s&len,\sNULL,\s0);\n\n\nthe\s#includes\sneeded\sare\n\n\s#include\s<sys/types.h>\n\s#include\s<sys/sysctl.h>\n\nfor\s{Free|Dragonfly}BSD\sand\n\n#include\s<sys/param.h>\n#include\s<sys/sysctl.h>\n\nFor\s{Open|Net}BSD\n\n
J login egavilan
J mimetype text/plain
J username egavilan
K 3065485fffffffffffffffffffffffffffffffff
U egavilan
Z b9c8318e2554521ae84eadf50f834605