Skip to contentSkip to conversation

New: [recv(2) man page] MSG_PEEK doesn't always return the same data

Bug 220578 [email protected] 1 participant 1 message Sep 15, 2025 Man-pages: manual pages for Linux -- Sections 2, 3, 4, 5, and 7

lore
Share & tools
lore
#0 lore raw

https://bugzilla.kernel.org/show_bug.cgi?id=220578

Bug ID: 220578
Summary: [recv(2) man page] MSG_PEEK doesn't always return the
same data
Product: Documentation
Version: unspecified
Hardware: AMD
OS: Linux
Status: NEW
Severity: normal
Priority: P3
Component: man-pages
Assignee: [email protected]
Reporter: [email protected]
Regression: No

Created attachment 308681
--> https://bugzilla.kernel.org/attachment.cgi?id=308681&action=edit
c source code of test program (uses unix socketpair)

recv(2) man page text:

MSG_PEEK
This flag causes the receive operation to return data from the beginning of the receive queue without removing that data from the queue. Thus, a subsequent receive call will return the same data.

but for unix sockets and local tcp sockets the "Thus, a subsequent receive call will return the same data." part is not always true

if data was written using sendfile, writing to file that was used as in_fd argument in sendfile changes what data recv returns

tested on 2 operating systems:
kde neon unstable, uname -r -v -m -p -i -o: 6.14.0-29-generic #29~24.04.1-Ubuntu SMP PREEMPT_DYNAMIC Thu Aug 14 16:52:50 UTC 2 x86_64 x86_64 x86_64 GNU/Linux
opensuse tumbleweed, uname -r -v -m -p -i -o: 6.16.5-1-default #1 SMP PREEMPT_DYNAMIC Thu Sep 4 15:51:43 UTC 2025 (642f24d) x86_64 x86_64 x86_64 GNU/Linux

Signature · 4 lines
You may reply to this email to add a comment.

You are receiving this mail because:
You are watching the assignee of the bug.