1 |
< |
/* |
2 |
< |
* i-scream central monitoring system |
1 |
> |
/* |
2 |
> |
* i-scream libstatgrab |
3 |
|
* http://www.i-scream.org |
4 |
< |
* Copyright (C) 2000-2003 i-scream |
4 |
> |
* Copyright (C) 2000-2004 i-scream |
5 |
|
* |
6 |
< |
* This program is free software; you can redistribute it and/or |
7 |
< |
* modify it under the terms of the GNU General Public License |
8 |
< |
* as published by the Free Software Foundation; either version 2 |
9 |
< |
* of the License, or (at your option) any later version. |
6 |
> |
* This library is free software; you can redistribute it and/or |
7 |
> |
* modify it under the terms of the GNU Lesser General Public |
8 |
> |
* License as published by the Free Software Foundation; either |
9 |
> |
* version 2.1 of the License, or (at your option) any later version. |
10 |
|
* |
11 |
< |
* This program is distributed in the hope that it will be useful, |
11 |
> |
* This library is distributed in the hope that it will be useful, |
12 |
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
13 |
< |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
14 |
< |
* GNU General Public License for more details. |
13 |
> |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
14 |
> |
* Lesser General Public License for more details. |
15 |
|
* |
16 |
< |
* You should have received a copy of the GNU General Public License |
17 |
< |
* along with this program; if not, write to the Free Software |
18 |
< |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
16 |
> |
* You should have received a copy of the GNU Lesser General Public |
17 |
> |
* License along with this library; if not, write to the Free Software |
18 |
> |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA |
19 |
> |
* 02111-1307 USA |
20 |
> |
* |
21 |
> |
* $Id$ |
22 |
|
*/ |
23 |
|
|
24 |
|
#ifdef HAVE_CONFIG_H |
32 |
|
#include <kstat.h> |
33 |
|
#include <time.h> |
34 |
|
#endif |
35 |
< |
#ifdef LINUX |
35 |
> |
#if defined(LINUX) || defined(CYGWIN) |
36 |
|
#include <stdio.h> |
37 |
|
#endif |
38 |
|
#ifdef ALLBSD |
39 |
< |
#ifdef FREEBSD |
39 |
> |
#if defined(FREEBSD) || defined(DFBSD) |
40 |
|
#include <sys/types.h> |
41 |
|
#include <sys/sysctl.h> |
42 |
|
#else |
47 |
|
#include <sys/time.h> |
48 |
|
#endif |
49 |
|
|
50 |
< |
general_stat_t *get_general_stats(){ |
50 |
> |
sg_host_info *sg_get_host_info(){ |
51 |
|
|
52 |
< |
static general_stat_t general_stat; |
52 |
> |
static sg_host_info general_stat; |
53 |
|
static struct utsname os; |
54 |
|
|
55 |
|
#ifdef SOLARIS |
58 |
|
kstat_t *ksp; |
59 |
|
kstat_named_t *kn; |
60 |
|
#endif |
61 |
< |
#ifdef LINUX |
61 |
> |
#if defined(LINUX) || defined(CYGWIN) |
62 |
|
FILE *f; |
63 |
|
#endif |
64 |
|
#ifdef ALLBSD |
99 |
|
time(&curtime); |
100 |
|
general_stat.uptime = curtime - boottime; |
101 |
|
#endif |
102 |
< |
#ifdef LINUX |
102 |
> |
#if defined(LINUX) || defined(CYGWIN) |
103 |
|
if ((f=fopen("/proc/uptime", "r")) == NULL) { |
104 |
|
return NULL; |
105 |
|
} |