added M.Dolze's patch_client_machine_FreeBSD patch (with slight variations)

This commit is contained in:
marschap
2005-04-06 11:04:43 +00:00
parent 2ff13238d9
commit 941fb5598a
2 changed files with 14 additions and 5 deletions
+13 -4
View File
@@ -83,7 +83,7 @@ int machine_close()
int machine_get_battstat(int *acstat, int *battflag, int *percent) int machine_get_battstat(int *acstat, int *battflag, int *percent)
{ {
int apmd; int apmd;
apm_info_t aip; struct apm_info aip;
*acstat = LCDP_AC_ON; *acstat = LCDP_AC_ON;
*battflag = LCDP_BATT_ABSENT; *battflag = LCDP_BATT_ABSENT;
@@ -101,7 +101,7 @@ int machine_get_battstat(int *acstat, int *battflag, int *percent)
return(FALSE); return(FALSE);
} }
switch(aip->ai_acline) switch(aip.ai_acline)
{ {
case 0: case 0:
*acstat = LCDP_AC_OFF; *acstat = LCDP_AC_OFF;
@@ -114,7 +114,7 @@ int machine_get_battstat(int *acstat, int *battflag, int *percent)
break; break;
} }
switch(aip->ai_batt_stat) switch(aip.ai_batt_stat)
{ {
case 0: case 0:
*battflag = LCDP_BATT_HIGH; *battflag = LCDP_BATT_HIGH;
@@ -133,7 +133,7 @@ int machine_get_battstat(int *acstat, int *battflag, int *percent)
break; break;
} }
*percent = aip->ai_batt_life; *percent = aip.ai_batt_life;
if(*percent == 255) if(*percent == 255)
*percent = -1; *percent = -1;
@@ -310,10 +310,19 @@ int machine_get_procs(LinkedList *procs)
kvm_close(kvmd); kvm_close(kvmd);
return(FALSE); return(FALSE);
} }
#if (__FreeBSD_version > 500000)
strncpy(p->name, kprocs->kp_proc.p_comm, 15); strncpy(p->name, kprocs->kp_proc.p_comm, 15);
#else
strncpy(p->name, kprocs->ki_comm, 15);
#endif
p->name[15] = '\0'; p->name[15] = '\0';
#if (__FreeBSD_version > 500000)
p->totl = kprocs->ki_size / 1024;
p->number = kprocs->ki_pid;
#else
p->totl = kprocs->kp_eproc.e_vm.vm_map.size / 1024; p->totl = kprocs->kp_eproc.e_vm.vm_map.size / 1024;
p->number = kprocs->kp_proc.p_pid; p->number = kprocs->kp_proc.p_pid;
#endif
LL_Push(procs, (void *)p); LL_Push(procs, (void *)p);
kprocs++; kprocs++;
+1 -1
View File
@@ -31,7 +31,7 @@
#define MAX_NUMERIC_LEN 40 #define MAX_NUMERIC_LEN 40
char *error_strs[] = {"", "Out of range", "Too long", "Too short", "Invalid Address"}; char *error_strs[] = {"", "Out of range", "Too long", "Too short", "Invalid Address"};
char *menuitemtypenames[] = {"menu", "action", "checkbox", "ring", "slider", "numeric", "alpha","ip"}; char *menuitemtypenames[] = {"menu", "action", "checkbox", "ring", "slider", "numeric", "alpha", "ip"};
char *menueventtypenames[] = {"select", "update", "plus", "minus", "enter", "leave"}; char *menueventtypenames[] = {"select", "update", "plus", "minus", "enter", "leave"};
void menuitem_destroy_action (MenuItem *item); void menuitem_destroy_action (MenuItem *item);