From 360e6533c920f905576239d6ed6d45a3a9552fce Mon Sep 17 00:00:00 2001 From: albert <> Date: Sat, 16 Aug 2003 21:15:53 +0000 Subject: [PATCH] misc --- proc/ksym.c | 4 +++- ps/sortformat.c | 4 ---- skill.c | 3 +-- vmstat.c | 22 ++++++++++++---------- 4 files changed, 16 insertions(+), 17 deletions(-) diff --git a/proc/ksym.c b/proc/ksym.c index bf1d6358..48ccc1fb 100644 --- a/proc/ksym.c +++ b/proc/ksym.c @@ -547,7 +547,7 @@ int open_psdb(const char *restrict override) { /***************************************/ -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; @@ -565,6 +565,8 @@ const char * read_wchan_file(unsigned pid){ // 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; diff --git a/ps/sortformat.c b/ps/sortformat.c index 736bea52..06181c5f 100644 --- a/ps/sortformat.c +++ b/ps/sortformat.c @@ -31,10 +31,6 @@ static int have_gnu_sort = 0; /* if true, "O" must be format */ 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 diff --git a/skill.c b/skill.c index c4bd7bca..56ac4f17 100644 --- a/skill.c +++ b/skill.c @@ -56,8 +56,7 @@ static int program; /********************************************************************/ -static void display_kill_version(){ - +static void display_kill_version(void){ switch(program) { case PROG_KILL: fprintf(stdout, "kill (%s)\n",procps_version); diff --git a/vmstat.c b/vmstat.c index 8aa82df6..2f44724b 100644 --- a/vmstat.c +++ b/vmstat.c @@ -291,13 +291,18 @@ static void new_format(void) { //////////////////////////////////////////////////////////////////////////// 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); @@ -335,10 +340,7 @@ static int diskpartition_format(const char* partition_name){ free(disks); free(partitions); } - }else{ - fprintf(stderr, "Your kernel doesn't support diskstat (2.5.70 or above required)"); - exit(0); - } + return 0; } ////////////////////////////////////////////////////////////////////////////