| 1 |
< |
/* |
| 1 |
> |
/* |
| 2 |
|
* i-scream central monitoring system |
| 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 |
| 34 |
|
#include <string.h> |
| 35 |
|
#endif |
| 36 |
|
|
| 37 |
+ |
#include "tools.h" |
| 38 |
|
#ifdef SOLARIS |
| 39 |
|
#include <procfs.h> |
| 40 |
|
#include <limits.h> |
| 42 |
|
#define MAX_FILE_LENGTH PATH_MAX |
| 43 |
|
#endif |
| 44 |
|
#ifdef LINUX |
| 45 |
< |
#include "tools.h" |
| 42 |
< |
#include <linux/limits.h> |
| 45 |
> |
#include <limits.h> |
| 46 |
|
#define PROC_LOCATION "/proc" |
| 47 |
|
#define MAX_FILE_LENGTH PATH_MAX |
| 48 |
|
#endif |
| 49 |
< |
#ifdef FREEBSD |
| 49 |
> |
#ifdef ALLBSD |
| 50 |
|
#include <kvm.h> |
| 51 |
|
#include <sys/param.h> |
| 52 |
|
#include <sys/sysctl.h> |
| 53 |
+ |
#endif |
| 54 |
+ |
#ifdef FREEBSD |
| 55 |
|
#include <sys/user.h> |
| 56 |
|
#endif |
| 57 |
|
|
| 71 |
|
#ifdef SOLARIS |
| 72 |
|
psinfo_t process_info; |
| 73 |
|
#endif |
| 74 |
< |
#ifdef FREEBSD |
| 74 |
> |
#ifdef ALLBSD |
| 75 |
|
struct kinfo_proc *kp_stats; |
| 76 |
|
kvm_t *kvmd; |
| 77 |
|
int procs; |
| 138 |
|
} |
| 139 |
|
closedir(proc_dir); |
| 140 |
|
#endif |
| 141 |
< |
#ifdef FREEBSD |
| 141 |
> |
#ifdef ALLBSD |
| 142 |
|
if((kvmd = get_kvm()) == NULL){ |
| 143 |
|
return NULL; |
| 144 |
|
} |
| 163 |
|
if (kp_stats[procs].kp_proc.p_stat == SSTOP) process_stat.stopped++; |
| 164 |
|
#endif |
| 165 |
|
} |
| 166 |
+ |
#endif |
| 167 |
+ |
|
| 168 |
+ |
#ifdef CYGWIN |
| 169 |
+ |
return NULL; |
| 170 |
|
#endif |
| 171 |
|
|
| 172 |
|
process_stat.total=process_stat.sleeping+process_stat.running+process_stat.zombie+process_stat.stopped; |