ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/i-scream/projects/cms/source/host/ihost-perl/plugins/freebsd/freebsd.c
(Generate patch)

Comparing projects/cms/source/host/ihost-perl/plugins/freebsd/freebsd.c (file contents):
Revision 1.2 by pajs, Tue Mar 19 16:49:30 2002 UTC vs.
Revision 1.3 by pajs, Thu Mar 21 16:40:11 2002 UTC

# Line 74 | Line 74 | void loadStats(){
74    printf("packet.load.load15 %.2f\n",loadav[2]);
75   }
76  
77 + void userStats(){
78 +  struct utmp users;
79 +  FILE *f;
80 +  int numusers=0;
81 +
82 +  if ((f=fopen(_PATH_UTMP, "r")) == NULL){
83 +    errf("Failed to get user stats(%m)");
84 +    die();
85 +  }
86 +
87 +  printf("packet.users.list");
88 +
89 +  while((fread(&users, sizeof(users),1,f)) != 0){
90 +    if (users.ut_name[0] == '\0') continue;
91 +    printf(" %s",users.ut_name);
92 +    numusers++;
93 +  }
94 +
95 +  printf("\npacket.users.count %d\n",numusers);
96 +
97 +  
98 +
99 + }
100 +
101   int main(){
102    diskStats();
103    osStats();
104    loadStats();
105 +  userStats();
106    exit(0);
82  
107   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines