Re: [dev] golang dwm status

From: Paul Onyschuk <blink_AT_bojary.koba.pl>
Date: Thu, 13 Mar 2014 21:25:54 +0100

On Thu, 13 Mar 2014 20:50:38 +0100
Markus Teich <markus.teich_AT_stusta.mhn.de> wrote:

> Thanks for the hint. However I wanted to avoid spawning other
> processes as much as possible. Is there another way to count the cpu
> cores just by reading a file in /proc or maybe /sys?

You can get there by using sysconf(3), from man page:

"The sysconf() function conforms to IEEE Std 1003.1-1988 (``POSIX.1'').
The constants _SC_NPROCESSORS_CONF and _SC_NPROCESSORS_ONLN are not
part of the standard, but are provided by many systems."

Calling "sysconf(_SC_NPROCESSORS_CONF)" should work on many systems.
I'm clueless, when it comes to accessing C from Go, so this can be
wrong solution in your case.


-- 
Paul Onyschuk
Received on Thu Mar 13 2014 - 21:25:54 CET

This archive was generated by hypermail 2.3.0 : Thu Mar 13 2014 - 21:36:06 CET