diff --git a/NEWS b/NEWS index d7169cce..56407487 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,11 @@ +procps-3.3.0 --> procps-ng-3.3.1 +-------------------------------- + + * Fixed pgrep -u not finding processes + * Fixed pgrep crashing + * vmstat -p finds partitions. Was Debian patch vmstat_part_format + fixes closed bugs RH#485243 and Debian#588677 + procps-3.2.8 --> procps-ng-3.3.0 ------------------------------------------------------ Debian, Fedora and openSUSE fork of procps. diff --git a/configure.ac b/configure.ac index 88aaafda..83cb56f0 100644 --- a/configure.ac +++ b/configure.ac @@ -4,7 +4,7 @@ AC_PREREQ([2.64]) AC_CONFIG_MACRO_DIR([m4]) AC_INIT([procps-ng], - [3.3.0], + [3.3.1], [procps@freelists.org],,[http://gitorious.org/procps]) AM_INIT_AUTOMAKE AC_CONFIG_SRCDIR([top.c]) diff --git a/proc/sysinfo.c b/proc/sysinfo.c index 3fe70da0..8e3ea19d 100644 --- a/proc/sysinfo.c +++ b/proc/sysinfo.c @@ -835,6 +835,18 @@ unsigned int getpartitions_num(struct disk_stat *disks, int ndisks){ } +///////////////////////////////////////////////////////////////////////////// +static int is_disk(char *dev) +{ + char syspath[32]; + char *slash; + + while ((slash = strchr(dev, '/'))) + *slash = '!'; + snprintf(syspath, sizeof(syspath), "/sys/block/%s", dev); + return !(access(syspath, F_OK)); +} + ///////////////////////////////////////////////////////////////////////////// unsigned int getdiskstat(struct disk_stat **disks, struct partition_stat **partitions){ @@ -843,6 +855,7 @@ unsigned int getdiskstat(struct disk_stat **disks, struct partition_stat **parti int cPartition = 0; int fields; unsigned dummy; + char devname[32]; *disks = NULL; *partitions = NULL; @@ -855,9 +868,9 @@ unsigned int getdiskstat(struct disk_stat **disks, struct partition_stat **parti fclose(fd); break; } - fields = sscanf(buff, " %*d %*d %*s %*u %*u %*u %*u %*u %*u %*u %*u %*u %*u %u", &dummy); - (*disks) = realloc(*disks, (cDisk+1)*sizeof(struct disk_stat)); - if (fields == 1){ + fields = sscanf(buff, " %*d %*d %15s %*u %*u %*u %*u %*u %*u %*u %*u %*u %*u %u", devname, &dummy); + if (fields == 2 && is_disk(devname)){ + (*disks) = realloc(*disks, (cDisk+1)*sizeof(struct disk_stat)); sscanf(buff, " %*d %*d %15s %u %u %llu %u %u %u %llu %u %u %u %u", //&disk_major, //&disk_minor, @@ -879,7 +892,9 @@ unsigned int getdiskstat(struct disk_stat **disks, struct partition_stat **parti }else{ (*partitions) = realloc(*partitions, (cPartition+1)*sizeof(struct partition_stat)); fflush(stdout); - sscanf(buff, " %*d %*d %15s %u %llu %u %u", + sscanf(buff, (fields == 2) + ? " %*d %*d %15s %u %*u %llu %*u %u %*u %llu %*u %*u %*u %*u" + : " %*d %*d %15s %u %llu %u %llu", //&part_major, //&part_minor, (*partitions)[cPartition].partition_name, diff --git a/proc/sysinfo.h b/proc/sysinfo.h index 194cb2a6..8dbb9795 100644 --- a/proc/sysinfo.h +++ b/proc/sysinfo.h @@ -114,7 +114,7 @@ typedef struct partition_stat{ unsigned parent_disk; // index into a struct disk_stat array unsigned reads; unsigned writes; - unsigned requested_writes; + unsigned long long requested_writes; }partition_stat; extern unsigned int getpartitions_num(struct disk_stat *disks, int ndisks); diff --git a/vmstat.c b/vmstat.c index 756ec4f9..e7a28d75 100644 --- a/vmstat.c +++ b/vmstat.c @@ -286,7 +286,7 @@ static int diskpartition_format(const char* partition_name){ 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"; + const char format[] = "%20u %10llu %10u %10llu\n"; fDiskstat=fopen("/proc/diskstats","rb"); if(!fDiskstat){