From: Johan Hedberg <johan.hedberg@gmail.com>
To: Mikel Astiz <mikel.astiz.oss@gmail.com>
Cc: linux-bluetooth@vger.kernel.org, Mikel Astiz <mikel.astiz@bmw-carit.de>
Subject: Re: [RFC v0] Bluetooth: Fix lost socket error code
Date: Fri, 29 Jun 2012 16:24:35 +0300 [thread overview]
Message-ID: <20120629132435.GB27007@x220> (raw)
In-Reply-To: <1340115637-2595-1-git-send-email-mikel.astiz.oss@gmail.com>
Hi Mikel,
On Tue, Jun 19, 2012, Mikel Astiz wrote:
> From: Mikel Astiz <mikel.astiz@bmw-carit.de>
>
> Using sock_error() here to check the status of the socket is wrong
> because it resets sk->sk_err to zero. For RFCOMM sockets, this means the
> disconnect reason is not exposed to userland in the socket options.
>
> Signed-off-by: Mikel Astiz <mikel.astiz@bmw-carit.de>
> ---
> This a second attempt to expose ACL disconnect reason to userland, as proposed first in "[RFC v0] Bluetooth: mgmt: Add device disconnect reason".
>
> The motivation behind was explained in the userspace patchset "[RFC BlueZ v0 0/5] ACL disconnect reason".
>
> This second approach focuses on RFCOMM sockets given that L2CAP is already exposing such information.
>
> net/bluetooth/af_bluetooth.c | 2 +-
> 1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/net/bluetooth/af_bluetooth.c b/net/bluetooth/af_bluetooth.c
> index f7db579..4799338 100644
> --- a/net/bluetooth/af_bluetooth.c
> +++ b/net/bluetooth/af_bluetooth.c
> @@ -313,7 +313,7 @@ int bt_sock_stream_recvmsg(struct kiocb *iocb, struct socket *sock,
> if (copied >= target)
> break;
>
> - err = sock_error(sk);
> + err = sk->sk_err;
> if (err)
> break;
> if (sk->sk_shutdown & RCV_SHUTDOWN)
Looking at the implementation of sock_error (include/net/sock.h) This
should be:
err = -sk->sk_err;
However, is this really needed if the error is returned for the write()
or read() that triggers it (through errno). And in the case of
POLLHUP/POLLERR there wont be any write/read that could clear the error
so you should be able to read it with getsockopt just fine. Am I missing
something?
Johan
next prev parent reply other threads:[~2012-06-29 13:24 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-06-19 14:20 [RFC v0] Bluetooth: Fix lost socket error code Mikel Astiz
2012-06-29 13:24 ` Johan Hedberg [this message]
2012-07-03 7:44 ` Mikel Astiz
2012-07-03 8:18 ` Johan Hedberg
2012-07-03 13:42 ` Mike
2012-07-03 15:46 ` Mikel Astiz
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20120629132435.GB27007@x220 \
--to=johan.hedberg@gmail.com \
--cc=linux-bluetooth@vger.kernel.org \
--cc=mikel.astiz.oss@gmail.com \
--cc=mikel.astiz@bmw-carit.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox