1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 19:28:12 +00:00

Net: Store an acceptor PID alongside the origin PID in a socket

* The origin PID is the PID of the process that created this socket,
  either explicitly by calling socket(), or implicitly by accepting
  a TCP connection. Note that accepting a local socket connection
  does not create a new socket, it reuses the one connect() was
  called on, so for accepted local sockets the origin PID points
  to the connecting process.

* The acceptor PID is the PID of the process that accept()ed this
  socket. For accepted TCP sockets, this is the same as origin PID.
This commit is contained in:
Sergey Bugaev 2019-08-10 19:03:34 +03:00 committed by Andreas Kling
parent 66e5d0bdf3
commit 1d03391488
2 changed files with 3 additions and 0 deletions

View file

@ -80,6 +80,7 @@ public:
KResult getsockopt(int level, int option, void*, socklen_t*);
pid_t origin_pid() const { return m_origin_pid; }
pid_t acceptor_pid() const { return m_acceptor_pid; }
timeval receive_deadline() const { return m_receive_deadline; }
timeval send_deadline() const { return m_send_deadline; }
@ -111,6 +112,7 @@ private:
Lock m_lock { "Socket" };
pid_t m_origin_pid { 0 };
pid_t m_acceptor_pid { 0 };
int m_domain { 0 };
int m_type { 0 };
int m_protocol { 0 };