1 #include <sys/types.h> 2 #include <sys/utsname.h> 3 #include <stdio.h> 4 main(int argc,char * argv[])5int main(int argc, char *argv[]) 6 { 7 struct utsname u_name; 8 9 if (uname(&u_name) == -1) return -1; 10 printf("system name is: %s, node name is %s\n", u_name.sysname, u_name.nodename); 11 return 0; 12 } 13 14