mirror of
https://github.com/SerenityOS/serenity.git
synced 2025-01-23 18:02:05 -05:00
Kernel+ProcessManager: Add some more info to /proc/PID/fds
- "seekable": whether the fd is seekable or sequential. - "class": which kernel C++ class implements this File. - "offset": the current implicit POSIX API file offset.
This commit is contained in:
parent
7f25959fa2
commit
f511421aaa
3 changed files with 24 additions and 0 deletions
|
@ -29,6 +29,12 @@ String ProcessFileDescriptorMapModel::column_name(int column) const
|
|||
switch (column) {
|
||||
case Column::FileDescriptor:
|
||||
return "FD";
|
||||
case Column::ClassName:
|
||||
return "Class";
|
||||
case Column::Offset:
|
||||
return "Offset";
|
||||
case Column::Access:
|
||||
return "Access";
|
||||
case Column::Path:
|
||||
return "Path";
|
||||
default:
|
||||
|
@ -41,6 +47,12 @@ GModel::ColumnMetadata ProcessFileDescriptorMapModel::column_metadata(int column
|
|||
switch (column) {
|
||||
case Column::FileDescriptor:
|
||||
return { 32, TextAlignment::CenterRight };
|
||||
case Column::ClassName:
|
||||
return { 80, TextAlignment::CenterLeft };
|
||||
case Column::Offset:
|
||||
return { 40, TextAlignment::CenterRight };
|
||||
case Column::Access:
|
||||
return { 60, TextAlignment::CenterLeft };
|
||||
case Column::Path:
|
||||
return { 300, TextAlignment::CenterLeft };
|
||||
default:
|
||||
|
@ -56,6 +68,12 @@ GVariant ProcessFileDescriptorMapModel::data(const GModelIndex& index, Role role
|
|||
switch (index.column()) {
|
||||
case Column::FileDescriptor:
|
||||
return fd_object.get("fd").to_int();
|
||||
case Column::ClassName:
|
||||
return fd_object.get("class").to_string();
|
||||
case Column::Offset:
|
||||
return fd_object.get("offset").to_int();
|
||||
case Column::Access:
|
||||
return fd_object.get("seekable").to_bool() ? "Seekable" : "Sequential";
|
||||
case Column::Path:
|
||||
return fd_object.get("absolute_path").to_string();
|
||||
default:
|
||||
|
|
|
@ -8,6 +8,9 @@ public:
|
|||
enum Column {
|
||||
FileDescriptor,
|
||||
Path,
|
||||
Offset,
|
||||
Access,
|
||||
ClassName,
|
||||
__Count
|
||||
};
|
||||
|
||||
|
|
|
@ -201,6 +201,9 @@ ByteBuffer procfs$pid_fds(InodeIdentifier identifier)
|
|||
JsonObject description_object;
|
||||
description_object.set("fd", i);
|
||||
description_object.set("absolute_path", description->absolute_path());
|
||||
description_object.set("seekable", description->file().is_seekable());
|
||||
description_object.set("class", description->file().class_name());
|
||||
description_object.set("offset", description->offset());
|
||||
array.append(move(description_object));
|
||||
}
|
||||
return array.serialized().to_byte_buffer();
|
||||
|
|
Loading…
Add table
Reference in a new issue