/***************************************/
-const char * read_wchan_file(unsigned pid){
+static const char * read_wchan_file(unsigned pid){
static char buf[64];
const char *ret = buf;
ssize_t num;
// would skip over numbers if they existed -- but no
+ // lame ppc64 has a '.' in front of every name
+ if(*ret=='.') ret++;
switch(*ret){
case 's': if(!strncmp(ret, "sys_", 4)) ret += 4; break;
case 'd': if(!strncmp(ret, "do_", 3)) ret += 3; break;
static int already_parsed_sort = 0; /* redundantly set in & out of fn */
static int already_parsed_format = 0;
-
-#define parse_sort_opt <-- arrgh! do not use this -->
-#define gnusort_parse <-- arrgh! do not use this -->
-
#ifndef COL_PIDMAX
#warning Ugly wart needs fixing, use common.h to sync w/ output.c
#define COL_PIDMAX 0x20
/********************************************************************/
-static void display_kill_version(){
-
+static void display_kill_version(void){
switch(program) {
case PROG_KILL:
fprintf(stdout, "kill (%s)\n",procps_version);
////////////////////////////////////////////////////////////////////////////
static int diskpartition_format(const char* partition_name){
- FILE *fDiskstat;
- struct disk_stat *disks;
- struct partition_stat *partitions, *current_partition=NULL;
- unsigned long ndisks,i,j,k,npartitions;
- const char format[]="%20u %10llu %10u %10u\n";
+ FILE *fDiskstat;
+ struct disk_stat *disks;
+ struct partition_stat *partitions, *current_partition=NULL;
+ unsigned long ndisks, j, k, npartitions;
+ const char format[] = "%20u %10llu %10u %10u\n";
+
+ fDiskstat=fopen("/proc/diskstats","rb");
+ if(!fDiskstat){
+ fprintf(stderr, "Your kernel doesn't support diskstat. (2.5.70 or above required)\n");
+ exit(0);
+ }
- if ((fDiskstat=fopen("/proc/diskstats", "rb"))){
fclose(fDiskstat);
ndisks=getdiskstat(&disks,&partitions);
npartitions=getpartitions_num(disks, ndisks);
free(disks);
free(partitions);
}
- }else{
- fprintf(stderr, "Your kernel doesn't support diskstat (2.5.70 or above required)");
- exit(0);
- }
+ return 0;
}
////////////////////////////////////////////////////////////////////////////