summaryrefslogtreecommitdiff
path: root/Kernel
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2021-08-28 22:21:22 +0200
committerAndreas Kling <kling@serenityos.org>2021-08-29 01:09:19 +0200
commit4ce99e4ab7abb1249740ce771f21ab1680cd30c9 (patch)
tree6ab7aa3e5841b7fb4fc3e3be98ad18df52da65af /Kernel
parentae197deb6b076fb7b49bb035cfb3e4f8304004cb (diff)
downloadserenity-4ce99e4ab7abb1249740ce771f21ab1680cd30c9.zip
Kernel: Use ProcessID a bit more in Socket
Store the origin and acceptor PID's as ProcessID.
Diffstat (limited to 'Kernel')
-rw-r--r--Kernel/GlobalProcessExposed.cpp8
-rw-r--r--Kernel/Net/Socket.h4
2 files changed, 6 insertions, 6 deletions
diff --git a/Kernel/GlobalProcessExposed.cpp b/Kernel/GlobalProcessExposed.cpp
index 6b2cfa1a73..8b9ebc267d 100644
--- a/Kernel/GlobalProcessExposed.cpp
+++ b/Kernel/GlobalProcessExposed.cpp
@@ -110,7 +110,7 @@ private:
obj.add("packets_out", socket.packets_out());
obj.add("bytes_out", socket.bytes_out());
if (Process::current().is_superuser() || Process::current().uid() == socket.origin_uid()) {
- obj.add("origin_pid", socket.origin_pid());
+ obj.add("origin_pid", socket.origin_pid().value());
obj.add("origin_uid", socket.origin_uid().value());
obj.add("origin_gid", socket.origin_gid().value());
}
@@ -132,10 +132,10 @@ private:
LocalSocket::for_each([&array](auto& socket) {
auto obj = array.add_object();
obj.add("path", String(socket.socket_path()));
- obj.add("origin_pid", socket.origin_pid());
+ obj.add("origin_pid", socket.origin_pid().value());
obj.add("origin_uid", socket.origin_uid().value());
obj.add("origin_gid", socket.origin_gid().value());
- obj.add("acceptor_pid", socket.acceptor_pid());
+ obj.add("acceptor_pid", socket.acceptor_pid().value());
obj.add("acceptor_uid", socket.acceptor_uid().value());
obj.add("acceptor_gid", socket.acceptor_gid().value());
});
@@ -160,7 +160,7 @@ private:
obj.add("peer_address", socket.peer_address().to_string());
obj.add("peer_port", socket.peer_port());
if (Process::current().is_superuser() || Process::current().uid() == socket.origin_uid()) {
- obj.add("origin_pid", socket.origin_pid());
+ obj.add("origin_pid", socket.origin_pid().value());
obj.add("origin_uid", socket.origin_uid().value());
obj.add("origin_gid", socket.origin_gid().value());
}
diff --git a/Kernel/Net/Socket.h b/Kernel/Net/Socket.h
index 232b3406c0..e6f1472213 100644
--- a/Kernel/Net/Socket.h
+++ b/Kernel/Net/Socket.h
@@ -91,10 +91,10 @@ public:
virtual KResult setsockopt(int level, int option, Userspace<const void*>, socklen_t);
virtual KResult getsockopt(FileDescription&, int level, int option, Userspace<void*>, Userspace<socklen_t*>);
- pid_t origin_pid() const { return m_origin.pid; }
+ ProcessID origin_pid() const { return m_origin.pid; }
UserID origin_uid() const { return m_origin.uid; }
GroupID origin_gid() const { return m_origin.gid; }
- pid_t acceptor_pid() const { return m_acceptor.pid; }
+ ProcessID acceptor_pid() const { return m_acceptor.pid; }
UserID acceptor_uid() const { return m_acceptor.uid; }
GroupID acceptor_gid() const { return m_acceptor.gid; }
const RefPtr<NetworkAdapter> bound_interface() const { return m_bound_interface; }