9 |
|
#include <sys/types.h> |
10 |
|
#include <sys/sysctl.h> |
11 |
|
#include <time.h> |
12 |
+ |
#include <sys/time.h> |
13 |
|
#endif |
14 |
|
|
15 |
|
char *get_os_info(){ |
28 |
|
#ifdef FREEBSD |
29 |
|
struct timeval boottime; |
30 |
|
time_t curtime; |
31 |
+ |
size_t size; |
32 |
|
#endif |
33 |
|
if((uname(&os)) < 0){ |
34 |
|
errf("Failed to get os stats (%m)"); |
92 |
|
#endif |
93 |
|
|
94 |
|
|
95 |
< |
xml_os_info=strf("<os><name>%s</name><release>%s</release><version>%s</version><sysname>%s</sysname><platform>%s</platform><uptime>%ld</uptime>", os.sysname, os.release, os.version, os.nodename, os.machine, uptime); |
95 |
> |
xml_os_info=strf("<os><name>%s</name><release>%s</release><version>%s</version><sysname>%s</sysname><platform>%s</platform><uptime>%ld</uptime></os>", os.sysname, os.release, os.version, os.nodename, os.machine, uptime); |
96 |
|
|
95 |
– |
printf("%s\n",xml_os_info); |
97 |
|
return xml_os_info; |
97 |
– |
} |
98 |
– |
|
99 |
– |
int main(){ |
100 |
– |
get_os_info(); |
101 |
– |
exit(0); |
98 |
|
} |