On 07/01/2010 09:49 AM, fred smith wrote:
I asked recently about using /etc/redhat-release and got some useful
answers.
My thanks to all who replied.
Now a slight variant:
Can anyone suggest some resource that a PROGRAM (compiled C program) can
examine while running to find out what platform it is runninng on ?
Things that come to mind include:
1. output of uname to see if the kernel version contains "elX" where X
is a digit, such as el4, el5, etc., identifying RHEL-4, RHEL-5, etc.
2. do the same thing by exmining the filename of the kernel (if I knew
how to find the file for the currently running kernel, that is.
(1) There is a uname(2) system call that any C or C++ program can call
that has all the information that the uname(1) command provides. Do a
'man 2 uname' for details.
(2) I'm not exactly sure how to get at the physical kernel file without
first doing a uname, then matching that information with
/boot/vmlinux-xxxx. /proc/versions can tell you more information, but
not exactly the file name.
--
Jerry Feldman <gaf(a)blu.org>
Boston Linux and Unix
PGP key id: 537C5846
PGP Key fingerprint: 3D1B 8377 A3C0 A5F2 ECBB CA3B 4607 4319 537C 5846