[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20101011065027.GB31124@bnru01.bnr.st.com>
Date: Mon, 11 Oct 2010 12:20:28 +0530
From: Kumar SANGHVI <kumar.sanghvi@...ricsson.com>
To: Rémi Denis-Courmont <remi@...lab.net>
Cc: "netdev@...r.kernel.org" <netdev@...r.kernel.org>,
Rémi Denis-Courmont
<remi.denis-courmont@...ia.com>
Subject: Re: [PATCH 3/4] Phonet: cleanup pipe enable socket option
Hi,
On Fri, Oct 08, 2010 at 16:02:02 +0200, Rémi Denis-Courmont wrote:
> From: Rémi Denis-Courmont <remi.denis-courmont@...ia.com>
>
> The current code works like this:
>
> int garbage, status;
> socklen_t len = sizeof(status);
>
> /* enable pipe */
> setsockopt(fd, SOL_PNPIPE, PNPIPE_ENABLE, &garbage, sizeof(garbage));
> /* disable pipe */
> setsockopt(fd, SOL_PNPIPE, PNPIPE_DISABLE, &garbage, sizeof(garbage));
> /* get status */
> getsockopt(fd, SOL_PNPIPE, PNPIPE_INQ, &status, &len);
>
> ...which does not follow the usual socket option pattern. This patch
> merges all three "options" into a single gettable&settable option,
> before Linux 2.6.37 gets out:
>
> int status;
> socklen_t len = sizeof(status);
>
> /* enable pipe */
> status = 1;
> setsockopt(fd, SOL_PNPIPE, PNPIPE_ENABLE, &status, sizeof(status));
> /* disable pipe */
> status = 0;
> setsockopt(fd, SOL_PNPIPE, PNPIPE_ENABLE, &status, sizeof(status));
> /* get status */
> getsockopt(fd, SOL_PNPIPE, PNPIPE_ENABLE, &status, &len);
>
> This also fixes the error code from EFAULT to ENOTCONN.
>
> Signed-off-by: Rémi Denis-Courmont <remi.denis-courmont@...ia.com>
> Cc: Kumar Sanghvi <kumar.sanghvi@...ricsson.com>
Thank you!
BR,
Kumar.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists