Re: more on identifying the system a program is running on...

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxx>
Boston Linux and Unix
PGP key id: 537C5846
PGP Key fingerprint: 3D1B 8377 A3C0 A5F2 ECBB  CA3B 4607 4319 537C 5846


Attachment: signature.asc
Description: OpenPGP digital signature

-- 
users mailing list
users@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe or change subscription options:
https://admin.fedoraproject.org/mailman/listinfo/users
Guidelines: http://fedoraproject.org/wiki/Mailing_list_guidelines

[Index of Archives]     [Current Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]     [Fedora Docs]

  Powered by Linux