On Sat, Feb 19, 2011 at 01:13:22PM +0200, Nezmer wrote:
On Sat, Feb 19, 2011 at 04:26:56AM -0500, Tavian Barnes wrote:
snip
- There's no portable way to get the number of available cores. Where does platform-specific code go in libalpm? The way to do it on Linux is with sched_getaffinity(); sysconf(_SC_NPROCESSORS_ONLN) is almost as good and works on BSD too I believe.
No, I don't think it works on BSDs.
Actually, The sysconf() method works at least in FreeBSD and the man page says the sysconf interface is defined by POSIX.1
You can look at how x264 guys implemented this. Check out x264_cpu_num_processors() in common/cpu.c in their source tree.
I'm not sure hard-coding supported platforms through ifdefs would be accepted in pacman/libalpm.
Also, I guess a major question would be: would this be likely to be merged? It's not a major issue, but it's also not a very large change. Every time there's a KDE update or something similarly large I find myself wishing that all 2/4/24 of my cores were being used for the the integrity checks.
-- Tavian Barnes