Process count works on NetBSD

This commit is contained in:
Pierre Pronchery 2005-09-25 03:39:14 +00:00
parent e4a6e9dcd3
commit d4dfdc53d4

View File

@ -31,7 +31,7 @@ static int sysinfo(struct sysinfo * info)
struct timeval now; struct timeval now;
struct timeval tv; struct timeval tv;
struct loadavg la; struct loadavg la;
int mib[2]; int mib[3];
int len; int len;
int ret = 0; int ret = 0;
@ -68,13 +68,15 @@ static int sysinfo(struct sysinfo * info)
/* procs */ /* procs */
mib[0] = CTL_KERN; mib[0] = CTL_KERN;
mib[1] = KERN_PROC; mib[1] = KERN_PROC;
if(sysctl(mib, 2, NULL, &len, NULL, 0) == -1) mib[2] = KERN_PROC_ALL;
len = 0;
if(sysctl(mib, 3, NULL, &len, NULL, 0) == -1)
{ {
info->procs = 0; info->procs = 0;
ret++; ret++;
} }
else else
info->procs = len; info->procs = len / sizeof(struct kinfo_proc);
return ret; return ret;
} }
#endif #endif