Messages in this thread | | | Date | Wed, 7 Jul 1999 22:02:22 -0400 (EDT) | From | "Albert D. Cahalan" <> | Subject | Re: Patch for 2.2.10 (Quelle surprise!) |
| |
Jes Sorensen writes: >> "Alex" == Alex Buell <alex.buell@tahallah.demon.co.uk> writes: >>> On Mon, 5 Jul 1999, Stephen C. Tweedie wrote:
>>>> Basically it just returns a structure filled out with >>>> processor information a la 'cat /proc/cpuinfo', except that >>>> this is done via a syscall - no more horrid /proc parsing. >>> >>> That is exactly the sort of thing that sysctl() was designed for.
I think sysconf() is what you are looking for. Pick a range of numbers to reserve for kernel use. For example, 0x0a000000 to 0x0affffff would do.
Usage: smp_num_cpus = sysconf(_SC_NPROCESSORS_CONF);
Try to get this correct too:
RETURN VALUE The value returned is the value of the system resource, 1 if a queried option is available, 0 if it is not, or -1 on error. The variable errno is not set.
You must not ever return 0 for an error condition. Errors are -1.
>> OK, I've heard the same thing from a number of people. Looks >> like I'll be spending some time re-implementing the work I've >> done as a sysctl(). >> >> Thanks for all the input, guys. > > You still haven't explained why a syscall/sysctl is needed for this > when all the information can be obtained by parsing /proc/cpuinfo
Obviously you haven't tried this in a cross-platform manner. (or you wrote the libc 6 sysconf() hack and think your code works)
- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/
| |