Re: How to Determine Which Kernel

From: Tigran Aivazian (tigran@veritas.com)
Date: Fri Mar 31 2000 - 15:05:56 EST


Quang Nguyêñ (formerly Ngô) wrote:

> How do you determine from the user level whether you are running under the
> SMP or UP kernel? Is there a function call for it? I know there is
> __SMP__, but I want to check it dynamically.
>
> --

make uname(2) system call and look at the version field, like this:

# truss -v uname -a 2>&1 | grep uname
execve("/bin/uname", ["uname", "-a"], [/* 27 vars */]) = 0
uname({sysname="Linux", nodename="saturn", release="2.3.99-pre4", version="#3
SMP Fri Mar 31 19:44:21 BST 2000", machine="i686"}) = 0

then parse the ASCII string version[] from utsname. Also, read
uname(2) manpage, of course

Regards,
Tigran

-
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/



This archive was generated by hypermail 2b29 : Fri Mar 31 2000 - 21:00:30 EST