Thoughts on std.system.OS

Marco Leise Marco.Leise at gmx.de
Sat Aug 13 07:00:08 PDT 2011


Am 13.08.2011, 13:12 Uhr, schrieb Vladimir Panteleev  
<vladimir at thecybershadow.net>:

> Really? I've *never* seen the `uname -a` shell command (which I assume  
> is just a thin syscall wrapper) print out the distro name.

# uname -r
2.6.39-gentoo-r3

It seems to work, and return the Kernel package version more or less. So  
here it is the Gentoo package in the 3rd revision.

Files to look for distributions / versions:
1) /etc/*-release
2) /etc/slackware-version
3) /proc/version

The release file seems to have become a pseudo standard. /proc/version  
gives the kernel version which I find more interesting than the  
distribution version. Both have their use of course. Some versions of  
distributions may come with a configuration that is incompatible to your  
program, so a way to figure that out would help. Also there are subtle  
differences for example in how the default Java installation is found, how  
the filesystem is laid out etc.


More information about the Digitalmars-d mailing list