How can I find out with a C program, on which RedHat version the program is being ran ? I do know through compilation variables that I'm on RedHat but so far cannot find out which one.
Currently the closest I got was to invoke an ls or cat through syscall for the release or motd files.
you can get the full version from /etc/issue. I don't know of any more direct way of getting the RedHat version. Most system methods will give you the kernel version.
You have to remember that RedHat is just the distribution. All the system stuff is related to the kernel and the architecture. System calls will be designed with this in mind.
You can also supposedly get the info from /proc/version, but I've never seen that match the actual distro version number, so that might be a red herring.
Basically I need to find out whether the program is running under RedHat 2.1 3.0 or 4.0 . This information is not available in uname. Parsing the information from the release or motd file is something I wanted to avoid.