Thread (7 messages) 7 messages, 3 authors, 2023-01-06

Re: [External] Re: [PATCH v2] sock: add tracepoint for send recv length

From: Steven Rostedt <rostedt@goodmis.org>
Date: 2023-01-06 04:07:50
Also in: lkml

On Fri, 6 Jan 2023 11:24:18 +0800
运辉崔 [off-list ref] wrote:
Regardless of whether the MSG_PEEK flag is set or not, it is possible
to return -errno,
but based on your suggestion, I plan to modify it like this:

trace_sock_recvmsg_length(sock->sk, sock->sk->sk_family,
                          sock->sk->sk_protocol,
                          !(flags & MSG_PEEK) ? ret : (ret < 0 ? ret : 0),

what do you think?
Sure.

But note, from your original patch:
+	trace_sock_recvmsg_length(sock->sk, sock->sk->sk_family,
+				  sock->sk->sk_protocol,
+				  (ret > 0 && !(flags & MSG_PEEK)) ?
+				  ret : 0,
+				  (ret > 0 && !(flags & MSG_PEEK)) ? 0 : ret,
+				  flags);
If flags MSG_PEEK is set, you return ret in error regardless, so error
would be ret even if it was positive.

So I'm guessing that this change actually fixed a bug. ;-)

-- Steve
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help