summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorhugetoad <hugetoad@97f52cf1-0a1b-0410-bd0e-c28be96e8082>2003-11-17 20:06:01 +0000
committerhugetoad <hugetoad@97f52cf1-0a1b-0410-bd0e-c28be96e8082>2003-11-17 20:06:01 +0000
commitf2bb03d1bb02099a44a1fdf65d6e53a782a18db3 (patch)
tree16b3e2a00f28c3d2da8685fe0f0e5e3713f674c5 /src
parentcc28b870eb37b627884568422a851aab2d0698e6 (diff)
downloadzabbix-f2bb03d1bb02099a44a1fdf65d6e53a782a18db3.tar.gz
zabbix-f2bb03d1bb02099a44a1fdf65d6e53a782a18db3.tar.xz
zabbix-f2bb03d1bb02099a44a1fdf65d6e53a782a18db3.zip
- added support of system[proccount] under Solaris (Alexei)
git-svn-id: svn://svn.zabbix.com/trunk@1032 97f52cf1-0a1b-0410-bd0e-c28be96e8082
Diffstat (limited to 'src')
-rw-r--r--src/zabbix_agent/sysinfo.c50
1 files changed, 50 insertions, 0 deletions
diff --git a/src/zabbix_agent/sysinfo.c b/src/zabbix_agent/sysinfo.c
index 00dd0352..36917625 100644
--- a/src/zabbix_agent/sysinfo.c
+++ b/src/zabbix_agent/sysinfo.c
@@ -1922,6 +1922,55 @@ double SWAPFREE(void)
double PROCCOUNT(void)
{
+#ifdef HAVE_PROC_0_PSINFO
+ DIR *dir;
+ struct dirent *entries;
+ struct stat buf;
+ char filename[MAX_STRING_LEN+1];
+
+ int fd;
+/* In the correct procfs.h, the structure name is psinfo_t */
+ psinfo_t psinfo;
+
+ int proccount=0;
+
+ dir=opendir("/proc");
+ if(NULL == dir)
+ {
+ return FAIL;
+ }
+
+ while((entries=readdir(dir))!=NULL)
+ {
+ strncpy(filename,"/proc/",MAX_STRING_LEN);
+ strncat(filename,entries->d_name,MAX_STRING_LEN);
+ strncat(filename,"/psinfo",MAX_STRING_LEN);
+
+ if(stat(filename,&buf)==0)
+ {
+ fd = open (filename, O_RDONLY);
+ if (fd != -1)
+ {
+ if (read (fd, &psinfo, sizeof(psinfo)) == -1)
+ {
+ closedir(dir);
+ return FAIL;
+ }
+ else
+ {
+ proccount++;
+ }
+ close (fd);
+ }
+ else
+ {
+ continue;
+ }
+ }
+ }
+ closedir(dir);
+ return (double)proccount;
+#else
#ifdef HAVE_SYSINFO_PROCS
struct sysinfo info;
@@ -1936,6 +1985,7 @@ double PROCCOUNT(void)
#else
return FAIL;
#endif
+#endif
}
double SWAPTOTAL(void)