一、介绍
uname()系统调用返回一系列关于主机系统的标识信息,存储到传入的 struct utsname *buf 中
#include <sys/utsname.h>
int uname(struct utsname *buf);
参数:
buf: 传入的struct utsname 的结构体指针
返回值:
成功返回0,错误-1并设置errno
#define _UTSNAME_LENGTH 65
# define _UTSNAME_SYSNAME_LENGTH _UTSNAME_LENGTH
# define _UTSNAME_NODENAME_LENGTH _UTSNAME_LENGTH
# define _UTSNAME_RELEASE_LENGTH _UTSNAME_LENGTH
# define _UTSNAME_VERSION_LENGTH _UTSNAME_LENGTH
# define _UTSNAME_MACHINE_LENGTH _UTSNAME_LENGTH
/* Structure describing the system and machine. */
struct utsname
{
/* Name of the implementation of the op