Skip to content

Commit

Permalink
net/SocketDescriptor: add GetPeerPidfd()
Browse files Browse the repository at this point in the history
  • Loading branch information
MaxKellermann committed Jan 1, 2025
1 parent 0e89a7f commit c5dc368
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/net/SocketDescriptor.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ class StaticSocketAddress;
class IPv4Address;
class IPv6Address;
class UniqueSocketDescriptor;
class UniqueFileDescriptor;

/**
* An OO wrapper for a Berkeley or WinSock socket descriptor.
Expand Down Expand Up @@ -229,6 +230,16 @@ public:
struct ucred GetPeerCredentials() const noexcept;
#endif

#ifdef __linux__
/**
* Get a pidfd for the peer process. Returns an undefined
* instance on error (with errno set).
*
* Requires Linux 6.5.
*/
UniqueFileDescriptor GetPeerPidfd() const noexcept;
#endif // __linux__

bool SetOption(int level, int name,
const void *value, std::size_t size) const noexcept;

Expand Down

0 comments on commit c5dc368

Please sign in to comment.