summaryrefslogtreecommitdiff
path: root/Kernel
diff options
context:
space:
mode:
authorAndreas Kling <awesomekling@gmail.com>2019-11-09 22:15:35 +0100
committerAndreas Kling <awesomekling@gmail.com>2019-11-09 22:42:19 +0100
commit06a80bcf69feaec8fbb551ecda14f46bf2582dff (patch)
tree2d1f20d4419d1116ff8f0f5b11d72e00c26363b8 /Kernel
parent660db0f79a72bcba5fbee1e5dc98812d1107ae92 (diff)
downloadserenity-06a80bcf69feaec8fbb551ecda14f46bf2582dff.zip
Kernel+SystemMonitor: Publish can_read/write state for open files
The can_read() and can_write() states for file descriptions are now published in /proc, allowing SystemMonitor to display it.
Diffstat (limited to 'Kernel')
-rw-r--r--Kernel/FileSystem/ProcFS.cpp2
-rw-r--r--Kernel/Net/LocalSocket.cpp4
2 files changed, 4 insertions, 2 deletions
diff --git a/Kernel/FileSystem/ProcFS.cpp b/Kernel/FileSystem/ProcFS.cpp
index fc08632be7..c0fa49903c 100644
--- a/Kernel/FileSystem/ProcFS.cpp
+++ b/Kernel/FileSystem/ProcFS.cpp
@@ -226,6 +226,8 @@ Optional<KBuffer> procfs$pid_fds(InodeIdentifier identifier)
description_object.add("offset", description->offset());
description_object.add("cloexec", cloexec);
description_object.add("blocking", description->is_blocking());
+ description_object.add("can_read", description->can_read());
+ description_object.add("can_write", description->can_write());
}
array.finish();
return builder.build();
diff --git a/Kernel/Net/LocalSocket.cpp b/Kernel/Net/LocalSocket.cpp
index 6f16fed2f5..babe57a023 100644
--- a/Kernel/Net/LocalSocket.cpp
+++ b/Kernel/Net/LocalSocket.cpp
@@ -195,7 +195,7 @@ bool LocalSocket::can_read(const FileDescription& description) const
return !has_attached_peer(description) || !m_for_server.is_empty();
if (role == Role::Connected)
return !has_attached_peer(description) || !m_for_client.is_empty();
- ASSERT_NOT_REACHED();
+ return false;
}
bool LocalSocket::has_attached_peer(const FileDescription& description) const
@@ -215,7 +215,7 @@ bool LocalSocket::can_write(const FileDescription& description) const
return !has_attached_peer(description) || m_for_client.bytes_in_write_buffer() < 16384;
if (role == Role::Connected)
return !has_attached_peer(description) || m_for_server.bytes_in_write_buffer() < 16384;
- ASSERT_NOT_REACHED();
+ return false;
}
ssize_t LocalSocket::sendto(FileDescription& description, const void* data, size_t data_size, int, const sockaddr*, socklen_t)