if (scols_line_refer_data(ln, column_index, str))
err(EXIT_FAILURE, _("failed to add output data"));
return true;
+ case COL_UID:
+ xasprintf(&str, "%d", (int)file->stat.st_uid);
+ if (!str)
+ err(EXIT_FAILURE, _("failed to add output data"));
+ if (scols_line_refer_data(ln, column_index, str))
+ err(EXIT_FAILURE, _("failed to add output data"));
+ return true;
};
return false;
/* columns descriptions */
static struct colinfo infos[] = {
- [COL_PID] = { "PID", 7, SCOLS_FL_RIGHT, N_("PID of the process opening the file") },
- [COL_FD] = { "FD", 5, SCOLS_FL_RIGHT, N_("file descriptor for the file") },
- [COL_NAME] = { "NAME", 30, 0, N_("name of the file") },
- [COL_COMMAND] = { "COMMAND", 10, 0, N_("command of the process opening the file") },
- [COL_TYPE] = { "TYPE", 7, 0, N_("file type") },
+ [COL_PID] = { "PID", 0, SCOLS_FL_RIGHT, N_("PID of the process opening the file") },
+ [COL_FD] = { "FD", 0, SCOLS_FL_RIGHT, N_("file descriptor for the file") },
+ [COL_NAME] = { "NAME", 0, 0, N_("name of the file") },
+ [COL_COMMAND] = { "COMMAND", 0, 0, N_("command of the process opening the file") },
+ [COL_TYPE] = { "TYPE", 0, SCOLS_FL_RIGHT, N_("file type") },
+ [COL_UID] = { "UID", 0, SCOLS_FL_RIGHT, N_("user ID number") },
+ /* DEVICE */
+ /* SIZE/OFF */
+ /* NODE */
};
static int columns[ARRAY_SIZE(infos) * 2] = {-1};
if (!ncolumns) {
columns[ncolumns++] = COL_COMMAND;
columns[ncolumns++] = COL_PID;
+ columns[ncolumns++] = COL_UID; /* This should be COL_USER. */
columns[ncolumns++] = COL_FD;
columns[ncolumns++] = COL_TYPE;
columns[ncolumns++] = COL_NAME;
switch (id) {
case COL_NAME:
case COL_COMMAND:
+ case COL_TYPE:
scols_column_set_json_type(cl, SCOLS_JSON_STRING);
break;
case COL_PID:
case COL_FD:
+ case COL_UID:
/* fallthrough */
default:
scols_column_set_json_type(cl, SCOLS_JSON_NUMBER);