vmstat -p <part> works and updated version to 3.3.1
configure.ac now set to 3.3.1 vmstat -p has not worked for a long time, this applies Debian patch vmstat_part_format, the details: Author: Daniel Novotny Description: The contents of /proc/diskstats have changed since 2.6.25 Changed PATH_MAX to 32 because its missing on hurd Bug-Redhat: https://bugzilla.redhat.com/show_bug.cgi?id=485243 Bug-Debian: http://bugs.debian.org/588677 Last-Update: 2010-11-17
This commit is contained in:
parent
618c52167b
commit
20463f1a13
8
NEWS
8
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 <part> 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
|
procps-3.2.8 --> procps-ng-3.3.0
|
||||||
------------------------------------------------------
|
------------------------------------------------------
|
||||||
Debian, Fedora and openSUSE fork of procps.
|
Debian, Fedora and openSUSE fork of procps.
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
AC_PREREQ([2.64])
|
AC_PREREQ([2.64])
|
||||||
AC_CONFIG_MACRO_DIR([m4])
|
AC_CONFIG_MACRO_DIR([m4])
|
||||||
AC_INIT([procps-ng],
|
AC_INIT([procps-ng],
|
||||||
[3.3.0],
|
[3.3.1],
|
||||||
[procps@freelists.org],,[http://gitorious.org/procps])
|
[procps@freelists.org],,[http://gitorious.org/procps])
|
||||||
AM_INIT_AUTOMAKE
|
AM_INIT_AUTOMAKE
|
||||||
AC_CONFIG_SRCDIR([top.c])
|
AC_CONFIG_SRCDIR([top.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){
|
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 cPartition = 0;
|
||||||
int fields;
|
int fields;
|
||||||
unsigned dummy;
|
unsigned dummy;
|
||||||
|
char devname[32];
|
||||||
|
|
||||||
*disks = NULL;
|
*disks = NULL;
|
||||||
*partitions = NULL;
|
*partitions = NULL;
|
||||||
@ -855,9 +868,9 @@ unsigned int getdiskstat(struct disk_stat **disks, struct partition_stat **parti
|
|||||||
fclose(fd);
|
fclose(fd);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
fields = sscanf(buff, " %*d %*d %*s %*u %*u %*u %*u %*u %*u %*u %*u %*u %*u %u", &dummy);
|
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));
|
(*disks) = realloc(*disks, (cDisk+1)*sizeof(struct disk_stat));
|
||||||
if (fields == 1){
|
|
||||||
sscanf(buff, " %*d %*d %15s %u %u %llu %u %u %u %llu %u %u %u %u",
|
sscanf(buff, " %*d %*d %15s %u %u %llu %u %u %u %llu %u %u %u %u",
|
||||||
//&disk_major,
|
//&disk_major,
|
||||||
//&disk_minor,
|
//&disk_minor,
|
||||||
@ -879,7 +892,9 @@ unsigned int getdiskstat(struct disk_stat **disks, struct partition_stat **parti
|
|||||||
}else{
|
}else{
|
||||||
(*partitions) = realloc(*partitions, (cPartition+1)*sizeof(struct partition_stat));
|
(*partitions) = realloc(*partitions, (cPartition+1)*sizeof(struct partition_stat));
|
||||||
fflush(stdout);
|
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_major,
|
||||||
//&part_minor,
|
//&part_minor,
|
||||||
(*partitions)[cPartition].partition_name,
|
(*partitions)[cPartition].partition_name,
|
||||||
|
@ -114,7 +114,7 @@ typedef struct partition_stat{
|
|||||||
unsigned parent_disk; // index into a struct disk_stat array
|
unsigned parent_disk; // index into a struct disk_stat array
|
||||||
unsigned reads;
|
unsigned reads;
|
||||||
unsigned writes;
|
unsigned writes;
|
||||||
unsigned requested_writes;
|
unsigned long long requested_writes;
|
||||||
}partition_stat;
|
}partition_stat;
|
||||||
|
|
||||||
extern unsigned int getpartitions_num(struct disk_stat *disks, int ndisks);
|
extern unsigned int getpartitions_num(struct disk_stat *disks, int ndisks);
|
||||||
|
2
vmstat.c
2
vmstat.c
@ -286,7 +286,7 @@ static int diskpartition_format(const char* partition_name){
|
|||||||
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, j, k, npartitions;
|
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");
|
fDiskstat=fopen("/proc/diskstats","rb");
|
||||||
if(!fDiskstat){
|
if(!fDiskstat){
|
||||||
|
Loading…
Reference in New Issue
Block a user