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
******************************************************************/
19
#include <stdlib.h> /* getloadavg() */
23
#include <sys/utsname.h>
24
#include <sys/sysctl.h>
28
#include "include/generic.h"
29
#include "include/uname.h"
31
#define SIZE(x) sizeof(x)/sizeof(x[0])
34
int get_os_info(struct os_info_type *os_info) {
35
return uname_get_os_info(os_info);
39
/* Based on /usr/src/usr.bin/w/w.c */
40
int get_uptime (void) {
42
struct timeval boottime;
50
* Print how long system has been up.
51
* (Found by looking getting "boottime" from the kernel)
54
mib[1] = KERN_BOOTTIME;
55
size = sizeof(boottime);
56
if (sysctl(mib, 2, &boottime, &size, NULL, 0) != -1 &&
57
boottime.tv_sec != 0) {
59
uptime = now - boottime.tv_sec;
65
/* Based on /usr/src/usr.bin/w/w.c */
66
void get_load_average(float *load_1,float *load_5,float *load_15) {
70
getloadavg(avenrun, sizeof(avenrun) / sizeof(avenrun[0]));
81
char *get_host_name(char *hostname,char *domain) {
82
return uname_get_host_name(hostname,domain);
86
long int get_mem_size(void) {
88
int ctl_ram[] = { CTL_HW, HW_PHYSMEM };
94
val_len = sizeof(val_int);
95
if (sysctl(ctl_ram, SIZE(ctl_ram), &val_int, &val_len,0,0))
98
mem_size=(val_int/1000000);