/* Structure describing the system and machine. */
struct utsname
{
/* Name of the implementation of the operating system. */
char sysname[_UTSNAME_SYSNAME_LENGTH];
/* Name of this node on the network. */
char nodename[_UTSNAME_NODENAME_LENGTH];
/* Current release level of this implementation. */
char release[_UTSNAME_RELEASE_LENGTH];
/* Current version level of this release. */
char version[_UTSNAME_VERSION_LENGTH];
/* Name of the hardware type the system is running on. */
char machine[_UTSNAME_MACHINE_LENGTH];
};
/* Put information about the system in NAME. */
extern int uname (struct utsname *name);
是
这个函数和命令中的uname一样的功能,可以得到系统的标识,ustsname结构中release得到的是内核的版本号,它的基本格式就是2.*.*-*.*.fc* 最后三个字符一般就是我要的版本号了。
在RH9中也是有这个函数的(基本上几个中系统应该都有的)只这它得到的release没有最后三个字符的。