lsfd: add columns for SIZE

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
This commit is contained in:
Masatake YAMATO 2021-05-03 15:59:26 +09:00 committed by Karel Zak
parent 61fe735065
commit bec8c27141
3 changed files with 7 additions and 0 deletions

View 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;
};

View 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,
};

View file

@ -60,6 +60,7 @@ enum {
COL_NAME,
COL_PID,
COL_RDEV,
COL_SIZE,
COL_TYPE,
COL_UID,
COL_USER,