1
/******************************************************************
2
* sysinfo_bsd.c - FreeBSD patch for linux_logo *
3
* August 31, 2000 by Shawn Rapp *
4
* - Made cute little devil pic from daemon screen saver for the *
5
* linux_logo to use. Bye Bye fat little penguin =) *
8
* - Somewhat gets the build date (needs parsing) *
10
* - Physical Memory total (not averaged to convention though) *
14
* - Patch telnetd to display /etc/issue when specified in *
16
******************************************************************/
22
#include <sys/utsname.h>
23
#include <sys/sysctl.h>
30
#define SIZE(x) sizeof(x)/sizeof(x[0])
33
int get_os_info(os_info_t *os_info) {
34
return uname_get_os_info(os_info);
38
/* Based on /usr/src/usr.bin/w/w.c */
39
int get_uptime (void) {
41
struct timeval boottime;
49
* Print how long system has been up.
50
* (Found by looking getting "boottime" from the kernel)
53
mib[1] = KERN_BOOTTIME;
54
size = sizeof(boottime);
55
if (sysctl(mib, 2, &boottime, &size, NULL, 0) != -1 &&
56
boottime.tv_sec != 0) {
58
uptime = now - boottime.tv_sec;
64
/* Based on /usr/src/usr.bin/w/w.c */
65
void get_load_average(float *load_1,float *load_5,float *load_15) {
70
getloadavg(avenrun, sizeof(avenrun) / sizeof(avenrun[0]));
82
char *get_host_name(char hostname[65],char domain[65]) {
83
return uname_get_host_name(hostname,domain);
87
long int get_mem_size(void) {
89
int ctl_ram[] = { CTL_HW, HW_PHYSMEM };
95
val_len = sizeof(val_int);
96
if (sysctl(ctl_ram, SIZE(ctl_ram), &val_int, &val_len,0,0))
99
mem_size=(val_int/1000000);