1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-30 21:58:10 +00:00

Kernel: Plumb packet receive timestamp from NetworkAdapter to Socket::recvfrom

Since the receiving socket isn't yet known at packet receive time,
keep timestamps for all packets.

This is useful for keeping statistics about in-kernel queue latencies
in the future, and it can be used to implement SO_TIMESTAMP.
This commit is contained in:
Nico Weber 2020-09-16 12:25:06 -04:00 committed by Andreas Kling
parent b36a2d6686
commit 416d470d07
10 changed files with 52 additions and 37 deletions

View file

@ -206,7 +206,8 @@ KResultOr<size_t> Socket::read(FileDescription& description, size_t, UserOrKerne
{
if (is_shut_down_for_reading())
return 0;
return recvfrom(description, buffer, size, 0, {}, 0);
timeval tv;
return recvfrom(description, buffer, size, 0, {}, 0, tv);
}
KResultOr<size_t> Socket::write(FileDescription& description, size_t, const UserOrKernelBuffer& data, size_t size)