This commit is contained in:
albert 2003-08-16 21:15:53 +00:00
parent 6ba229fa4c
commit 360e6533c9
4 changed files with 16 additions and 17 deletions

View File

@ -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]; static char buf[64];
const char *ret = buf; const char *ret = buf;
ssize_t num; ssize_t num;
@ -565,6 +565,8 @@ const char * read_wchan_file(unsigned pid){
// would skip over numbers if they existed -- but no // would skip over numbers if they existed -- but no
// lame ppc64 has a '.' in front of every name
if(*ret=='.') ret++;
switch(*ret){ switch(*ret){
case 's': if(!strncmp(ret, "sys_", 4)) ret += 4; break; case 's': if(!strncmp(ret, "sys_", 4)) ret += 4; break;
case 'd': if(!strncmp(ret, "do_", 3)) ret += 3; break; case 'd': if(!strncmp(ret, "do_", 3)) ret += 3; break;

View File

@ -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_sort = 0; /* redundantly set in & out of fn */
static int already_parsed_format = 0; 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 #ifndef COL_PIDMAX
#warning Ugly wart needs fixing, use common.h to sync w/ output.c #warning Ugly wart needs fixing, use common.h to sync w/ output.c
#define COL_PIDMAX 0x20 #define COL_PIDMAX 0x20

View File

@ -56,8 +56,7 @@ static int program;
/********************************************************************/ /********************************************************************/
static void display_kill_version(){ static void display_kill_version(void){
switch(program) { switch(program) {
case PROG_KILL: case PROG_KILL:
fprintf(stdout, "kill (%s)\n",procps_version); fprintf(stdout, "kill (%s)\n",procps_version);

View File

@ -291,13 +291,18 @@ static void new_format(void) {
//////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////
static int diskpartition_format(const char* partition_name){ static int diskpartition_format(const char* partition_name){
FILE *fDiskstat; FILE *fDiskstat;
struct disk_stat *disks; struct disk_stat *disks;
struct partition_stat *partitions, *current_partition=NULL; struct partition_stat *partitions, *current_partition=NULL;
unsigned long ndisks,i,j,k,npartitions; unsigned long ndisks, j, k, npartitions;
const char format[]="%20u %10llu %10u %10u\n"; 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); fclose(fDiskstat);
ndisks=getdiskstat(&disks,&partitions); ndisks=getdiskstat(&disks,&partitions);
npartitions=getpartitions_num(disks, ndisks); npartitions=getpartitions_num(disks, ndisks);
@ -335,10 +340,7 @@ static int diskpartition_format(const char* partition_name){
free(disks); free(disks);
free(partitions); free(partitions);
} }
}else{ return 0;
fprintf(stderr, "Your kernel doesn't support diskstat (2.5.70 or above required)");
exit(0);
}
} }
//////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////