Re: format_cpumask()

From: Luck, Tony
Date: Mon Nov 17 2003 - 13:50:39 EST


> + for (k = sizeof(cpumask_t)/sizeof(long) - 1; k >= 0; ++k) {
> + int m;
> + cpumask_t tmp;
> +
> + cpus_shift_right(tmp, cpus, BITS_PER_LONG*k);
> + if (BITS_PER_LONG == 32)
> + m = sprintf(buf, "%08lx", cpus_coerce(tmp));
> + else /* BITS_PER_LONG == 64 */
> + m = sprintf(buf, "%16lx", cpus_coerce(tmp));
> + len += m;
> + buf += m;
> + }

That makes it had to write portable shell scripts (etc.) that can
parse these values on both 32-bit and 64-bit systems? A bitmask with
just cpu0 set looks like:

0000000100000000

on a 32-bit machine. And like:

0000000000000001

on a 64-bit machine. Heaven help the architectures (ia64, sparc, ppc)
that support both 32-bit and 64-bit applications!

-Tony Luck

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/