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

ProcFS: Expose UDP sockets in /proc/net/udp

This commit is contained in:
Sergey Bugaev 2019-08-09 13:27:40 +03:00 committed by Andreas Kling
parent d06f4291a8
commit be485946b8
3 changed files with 29 additions and 0 deletions

View file

@ -5,6 +5,13 @@
#include <Kernel/Net/UDPSocket.h>
#include <Kernel/Process.h>
void UDPSocket::for_each(Function<void(UDPSocket&)> callback)
{
LOCKER(sockets_by_port().lock());
for (auto it : sockets_by_port().resource())
callback(*it.value);
}
Lockable<HashMap<u16, UDPSocket*>>& UDPSocket::sockets_by_port()
{
static Lockable<HashMap<u16, UDPSocket*>>* s_map;