Thread (11 messages) flat view 11 messages, 5 authors, 2019-02-12

Re: [PATCHv5 iproute2 net-next 2/2] lib/libnetlink: re malloc buff if size is not enough

From: David Ahern <hidden>
Date: 2017-10-26 15:42:45

On 10/26/17 9:33 AM, Phil Sutter wrote:
On Thu, Oct 26, 2017 at 09:28:00AM -0600, David Ahern wrote:
quoted
On 10/26/17 4:24 AM, Stephen Hemminger wrote:
quoted
quoted
The kernel needs a flag that says "give me the message of the buffer is
large enough; if not just PEEK and tell me the length." That would avoid
the double call in most cases.
Actually this has little impact because old code was doing implicit zero
of whole buffer, new code does not.
The patch calls recvmsg twice; libnl does the same thing. It would be
better performance wise to have a flag that allows retrieval of the
message if the supplied buffer is large enough and PEEK semantics if
not. It was really a comment on how we could do better with proper
kernel support.
Doesn't MSG_TRUNC without MSG_PEEK do just that?
MSG_TRUNC returns the actual message length if it is greater than the
buffer. The message was dequeued and what could be copied into the
supplied buffer is copied, but that means the returned message is truncated.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help