Merge branch 'master' into 'master'

- Fixing sysinfo - devices with length exceeding 15 chars are not displayed in vmstat -d

Resolves Bugzilla https://bugzilla.redhat.com/show_bug.cgi?id=586078. See for more info.<br/>
Enhances procps-ng to get aligned with kernel features (support for devices of name 32 chars long).

See merge request !16
This commit is contained in:
Craig Small 2016-07-02 04:52:43 +00:00
commit 1794875ab6
2 changed files with 7 additions and 7 deletions

View File

@ -951,7 +951,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]; char devname[35];
*disks = NULL; *disks = NULL;
*partitions = NULL; *partitions = NULL;
@ -964,10 +964,10 @@ unsigned int getdiskstat(struct disk_stat **disks, struct partition_stat **parti
fclose(fd); fclose(fd);
break; break;
} }
fields = sscanf(buff, " %*d %*d %15s %*u %*u %*u %*u %*u %*u %*u %*u %*u %*u %u", devname, &dummy); fields = sscanf(buff, " %*d %*d %34s %*u %*u %*u %*u %*u %*u %*u %*u %*u %*u %u", devname, &dummy);
if (fields == 2 && is_disk(devname)){ if (fields == 2 && is_disk(devname)){
(*disks) = xrealloc(*disks, (cDisk+1)*sizeof(struct disk_stat)); (*disks) = xrealloc(*disks, (cDisk+1)*sizeof(struct disk_stat));
sscanf(buff, " %*d %*d %15s %u %u %llu %u %u %u %llu %u %u %u %u", sscanf(buff, " %*d %*d %31s %u %u %llu %u %u %u %llu %u %u %u %u",
//&disk_major, //&disk_major,
//&disk_minor, //&disk_minor,
(*disks)[cDisk].disk_name, (*disks)[cDisk].disk_name,
@ -989,8 +989,8 @@ unsigned int getdiskstat(struct disk_stat **disks, struct partition_stat **parti
(*partitions) = xrealloc(*partitions, (cPartition+1)*sizeof(struct partition_stat)); (*partitions) = xrealloc(*partitions, (cPartition+1)*sizeof(struct partition_stat));
fflush(stdout); fflush(stdout);
sscanf(buff, (fields == 2) sscanf(buff, (fields == 2)
? " %*d %*d %15s %u %*u %llu %*u %u %*u %llu %*u %*u %*u %*u" ? " %*d %*d %34s %u %*u %llu %*u %u %*u %llu %*u %*u %*u %*u"
: " %*d %*d %15s %u %llu %u %llu", : " %*d %*d %34s %u %llu %u %llu",
//&part_major, //&part_major,
//&part_minor, //&part_minor,
(*partitions)[cPartition].partition_name, (*partitions)[cPartition].partition_name,

View File

@ -101,7 +101,7 @@ extern void vminfo(void);
typedef struct disk_stat{ typedef struct disk_stat{
unsigned long long reads_sectors; unsigned long long reads_sectors;
unsigned long long written_sectors; unsigned long long written_sectors;
char disk_name [16]; char disk_name [32];
unsigned inprogress_IO; unsigned inprogress_IO;
unsigned merged_reads; unsigned merged_reads;
unsigned merged_writes; unsigned merged_writes;
@ -115,7 +115,7 @@ typedef struct disk_stat{
}disk_stat; }disk_stat;
typedef struct partition_stat{ typedef struct partition_stat{
char partition_name [16]; char partition_name [35];
unsigned long long reads_sectors; unsigned long long reads_sectors;
unsigned parent_disk; // index into a struct disk_stat array unsigned parent_disk; // index into a struct disk_stat array
unsigned reads; unsigned reads;