]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
lsfd: add columns for SIZE
authorMasatake YAMATO <yamato@redhat.com>
Mon, 3 May 2021 06:59:26 +0000 (15:59 +0900)
committerKarel Zak <kzak@redhat.com>
Wed, 6 Oct 2021 09:01:53 +0000 (11:01 +0200)
Signed-off-by: Masatake YAMATO <yamato@redhat.com>
misc-utils/lsfd-file.c
misc-utils/lsfd.c
misc-utils/lsfd.h

index b9c77d88798df800e9f471f38bce5e98e03ec84d..dc19b8754ef77251507da4d0cbb9d51221d474f6 100644 (file)
@@ -136,6 +136,9 @@ static bool file_fill_column(struct proc *proc,
        case COL_UID:
                xasprintf(&str, "%d", (int)file->stat.st_uid);
                break;
+       case COL_SIZE:
+               xasprintf(&str, "%ju", file->stat.st_size);
+               break;
        default:
                return false;
        };
index b245113cd38cd078cd01c82af699985565fd1658..c53082aed4b1429d7a8f5ffe5d3052920be70888 100644 (file)
@@ -94,6 +94,8 @@ static struct colinfo infos[] = {
                N_("PID of the process opening the file") },
        [COL_RDEV]    = { "RDEV",     0, SCOLS_FL_RIGHT, SCOLS_JSON_STRING,
                N_("device ID (if special file)") },
+       [COL_SIZE]    = { "SIZE",     4, SCOLS_FL_RIGHT, SCOLS_JSON_NUMBER,
+               N_("file size"), },
        [COL_TYPE]    = { "TYPE",     0, SCOLS_FL_RIGHT, SCOLS_JSON_STRING,
                N_("file type") },
        [COL_UID]     = { "UID",      0, SCOLS_FL_RIGHT, SCOLS_JSON_NUMBER,
@@ -111,6 +113,7 @@ static int default_columns[] = {
        COL_ASSOC,
        COL_TYPE,
        COL_DEVICE,
+       COL_SIZE,
        COL_INODE,
        COL_NAME,
 };
index 69996614ced994ad52d5371a2264007688192eeb..c156297a10ec62ff777c129f12c80f0ad029574f 100644 (file)
@@ -60,6 +60,7 @@ enum {
        COL_NAME,
        COL_PID,
        COL_RDEV,
+       COL_SIZE,
        COL_TYPE,
        COL_UID,
        COL_USER,