Big cleanup: Remove trailing whitespace from files (except those imported

from external sources).
This commit is contained in:
mmdolze
2010-10-30 18:04:21 +00:00
parent 49cd060374
commit fd9b2ce713
113 changed files with 856 additions and 856 deletions
+12 -12
View File
@@ -155,7 +155,7 @@ int machine_get_battstat(int *acstat, int *battflag, int *percent)
*percent = (int)((double)curCapacity/(double)maxCapacity * 100);
/* There is a way to check this through the IOKit,
but I am not sure what gets returned for kIOPSLowWarnLevelKey and kIOPSDeadWarnLevelKey,
but I am not sure what gets returned for kIOPSLowWarnLevelKey and kIOPSDeadWarnLevelKey,
and this is easier.
*/
if (*battflag == LCDP_BATT_UNKNOWN) {
@@ -314,20 +314,20 @@ int machine_get_meminfo(meminfo_type *result)
int machine_get_procs(LinkedList *procs)
{
struct kinfo_proc *kprocs;
procinfo_type *p;
int nproc, i;
int mib[] = { CTL_KERN, KERN_PROC, KERN_PROC_ALL, 0 };
size_t size = 0;
/* Call sysctl with a NULL buffer as a dry run. */
/* Call sysctl with a NULL buffer as a dry run. */
if ( sysctl(mib, 4, NULL, &size, NULL, 0 ) < 0)
{
perror("Failure calling sysctl");
return FALSE;
}
/* Allocate a buffer based on previous results of sysctl. */
/* Allocate a buffer based on previous results of sysctl. */
kprocs = (struct kinfo_proc *)alloca(size);
if (kprocs == NULL)
{
@@ -341,7 +341,7 @@ int machine_get_procs(LinkedList *procs)
return FALSE;
}
nproc = size / sizeof(struct kinfo_proc);
nproc = size / sizeof(struct kinfo_proc);
for (i = 0; i < nproc; i++, kprocs++)
{
@@ -380,7 +380,7 @@ int machine_get_procs(LinkedList *procs)
} else {
/* This error pops up very often because of Mac OS X security fixes.
It might pop up all of the time on an intel Mac.
Basically, we cannot get many tasks unless we are root.
Basically, we cannot get many tasks unless we are root.
perror("task_for_pid");
printf("process: %s, owner:%d\n", kprocs->kp_proc.p_comm, kprocs->kp_eproc.e_pcred.p_ruid); */
p->totl = 0;
@@ -420,7 +420,7 @@ int machine_get_smpload(load_type *result, int *numcpus)
}
return(TRUE);
}
}
int machine_get_uptime(double *up, double *idle)
{
@@ -449,7 +449,7 @@ int machine_get_uptime(double *up, double *idle)
}
static int swapmode(int *rettotal, int *retfree)
{
{
#ifdef VM_SWAPUSAGE
size_t size;
struct xsw_usage xsu;
@@ -471,7 +471,7 @@ static int swapmode(int *rettotal, int *retfree)
*rettotal = (xsu.xsu_total/1024);
*retfree = ((xsu.xsu_total-xsu.xsu_used)/1024);
return(TRUE);
return(TRUE);
#endif
*rettotal = 0;
@@ -487,16 +487,16 @@ int machine_get_iface_stats (IfaceInfo *interface)
int name[6] = {CTL_NET, PF_LINK, NETLINK_GENERIC, IFMIB_SYSTEM, IFMIB_IFCOUNT};
size_t len;
struct ifmibdata ifmd; /* ifmibdata contains the network statistics */
len = sizeof(rows);
/* get number of interfaces */
if (sysctl(name, 5, &rows, &len, 0, 0) == 0) {
interface->status = down; /* set status down by default */
name[3] = IFMIB_IFDATA;
name[4] = 0;
name[5] = IFDATA_GENERAL;
len = sizeof(ifmd);
/* walk through all interfaces in the ifmib table from last to first */
for ( ; rows > 0; rows--) {
+7 -7
View File
@@ -332,7 +332,7 @@ int machine_get_procs(LinkedList *procs)
kvm_close(kvmd);
return(FALSE);
}
#if (__FreeBSD_version > 500000)
#if (__FreeBSD_version > 500000)
strncpy(p->name, kprocs->ki_comm, 15);
#else
strncpy(p->name, kprocs->kp_proc.p_comm, 15);
@@ -341,10 +341,10 @@ int machine_get_procs(LinkedList *procs)
#if (__FreeBSD_version > 500000)
p->totl = kprocs->ki_size / 1024;
p->number = kprocs->ki_pid;
#else
#else
p->totl = kprocs->kp_eproc.e_vm.vm_map.size / 1024;
p->number = kprocs->kp_proc.p_pid;
#endif
#endif
LL_Push(procs, (void *)p);
kprocs++;
@@ -387,7 +387,7 @@ int machine_get_smpload(load_type *result, int *numcpus)
if (pcpudata == NULL || pcpudata == (void *) -1)
return(FALSE);
/* extract the data for single CPU */
load.user = (unsigned long) (pcpudata->pc_cp_time[CP_USER]);
load.nice = (unsigned long) (pcpudata->pc_cp_time[CP_NICE]);
@@ -477,10 +477,10 @@ static int swapmode(int *retavail, int *retfree)
}
/*************************************************************************
* Read interface statistics from system and store in the struct
* passed as a pointer. If there are no errors, it returns 1. If errors,
* Read interface statistics from system and store in the struct
* passed as a pointer. If there are no errors, it returns 1. If errors,
* returns 0.
*************************************************************************
*************************************************************************
*/
int machine_get_iface_stats (IfaceInfo *interface)
{
+10 -10
View File
@@ -512,7 +512,7 @@ int machine_get_smpload(load_type *result, int *numcpus)
result[ncpu].nice = curr_load[ncpu].nice - last_load[ncpu].nice;
result[ncpu].system = curr_load[ncpu].system - last_load[ncpu].system;
result[ncpu].idle = curr_load[ncpu].idle - last_load[ncpu].idle;
// struct assignment is legal in C89
last_load[ncpu] = curr_load[ncpu];
@@ -546,10 +546,10 @@ int machine_get_uptime(double *up, double *idle)
/*************************************************************************
* Read interface statistics from system and store in the struct
* passed as a pointer. If there are no errors, it returns 1. If errors,
* Read interface statistics from system and store in the struct
* passed as a pointer. If there are no errors, it returns 1. If errors,
* returns 0.
*************************************************************************
*************************************************************************
*/
int machine_get_iface_stats (IfaceInfo *interface)
{
@@ -564,21 +564,21 @@ int machine_get_iface_stats (IfaceInfo *interface)
/* Skip first 2 header lines of file */
fgets(buffer, sizeof(buffer), file);
fgets(buffer, sizeof(buffer), file);
/* By default, treat interface as down */
interface->status = down;
/* Search iface_name and scan values */
while ((fgets(buffer, sizeof(buffer), file) != NULL)) {
if (strstr(buffer, interface->name)) {
/* interface exists */
interface->status = up; /* is up */
interface->last_online = time(NULL); /* save actual time */
/* search ':' and skip over it */
ch_pointer = strchr(buffer, ':');
ch_pointer++;
/* Now ch_pointer points to values of iface_name */
/* Scan values from here */
sscanf(ch_pointer, "%lf %lf %*s %*s %*s %*s %*s %*s %lf %lf",
@@ -587,8 +587,8 @@ int machine_get_iface_stats (IfaceInfo *interface)
&interface->tr_byte,
&interface->tr_pkt);
/* if is the first time we call this function,
* old values are the same as new so we don't
/* if is the first time we call this function,
* old values are the same as new so we don't
* get big speeds when calculating
*/
if (first_time) {