Fixing param.h to have #define HZ sysconf(_SC_CLK_TCK) sounds like a plausible solution, many incorrect uses will be fixed automagically by the next rebuild. But some more obscure usages of HZ may not compile (which is good, then they can be fixed properly) or worse may compile, but not do the right thing.
This makes compiles fail on one of the non-glibc libraries, either uClibc or dietlibc, which does not provide sysconf. The order in which procps tries things is: 1. walk off the end of environ to get the ELF notes 2. /proc/uptime to /proc/stat ratio 3. HZ 4. lame guess based on endianness and word size I do not want sysconf. It is is an unreliable piece of shit that gives me poor guesses instead of returning appropriate error codes. It does this swell job while being damn slow. I can do no worse with my own random guess. (on my TODO list: count CPUs myself, because glibc often thinks there are zero -- and this is not an error code)
The ultimate safe solution might be: #define HZ Fix your program to use sysconf(_SC_CLK_TCK)! \ (and BTW, you should not include kernel headers) Which is highly likely to cause a compile failure (but should at least provide a clue to the user on what they should do).
This breaks perfectly fine code, except that it will be yet one more thing for people to patch out when making headers for userspace. - : send the line "unsubscribe linux-ia64" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html
![]() |