From: John Fastabend Subject: Re: [PATCH] bpf: tcp_bpf_recvmsg should return EAGAIN when nonblocking and no data Date: Mon, 29 Oct 2018 13:30:49 -0700 Message-ID: <789e7f30-f567-37d3-6cd2-6d9baaa662e8@gmail.com> References: <1540841488-22023-1-git-send-email-john.fastabend@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Cc: netdev@vger.kernel.org To: daniel@iogearbox.net, ast@kernel.org Return-path: Received: from mail-it1-f193.google.com ([209.85.166.193]:36201 "EHLO mail-it1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729553AbeJ3FV0 (ORCPT ); Tue, 30 Oct 2018 01:21:26 -0400 Received: by mail-it1-f193.google.com with SMTP id t4-v6so2811512itf.1 for ; Mon, 29 Oct 2018 13:31:09 -0700 (PDT) In-Reply-To: <1540841488-22023-1-git-send-email-john.fastabend@gmail.com> Content-Language: en-US Sender: netdev-owner@vger.kernel.org List-ID: On 10/29/2018 12:31 PM, John Fastabend wrote: > We return 0 in the case of a nonblocking socket that has no data > available. However, this is incorrect and may confuse applications. > After this patch we do the correct thing and return the error > EAGAIN. > > Quoting return codes from recvmsg manpage, > > EAGAIN or EWOULDBLOCK > The socket is marked nonblocking and the receive operation would > block, or a receive timeout had been set and the timeout expired > before data was received. > > Signed-off-by: John Fastabend > --- Add fixes tag. Fixes: 604326b41a6f ("bpf, sockmap: convert to generic sk_msg interface")