From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38867) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VJ0AZ-0007F2-6v for qemu-devel@nongnu.org; Mon, 09 Sep 2013 08:02:20 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VJ0AT-0001Vq-Lx for qemu-devel@nongnu.org; Mon, 09 Sep 2013 08:02:15 -0400 Received: from mail-ea0-x231.google.com ([2a00:1450:4013:c01::231]:35050) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VJ0AT-0001Vd-FO for qemu-devel@nongnu.org; Mon, 09 Sep 2013 08:02:09 -0400 Received: by mail-ea0-f177.google.com with SMTP id f15so3102096eak.36 for ; Mon, 09 Sep 2013 05:02:08 -0700 (PDT) Date: Mon, 9 Sep 2013 14:02:06 +0200 From: Stefan Hajnoczi Message-ID: <20130909120206.GC20215@stefanha-thinkpad.redhat.com> References: <1378314535-27587-1-git-send-email-ottlik@fzi.de> <1378314535-27587-2-git-send-email-ottlik@fzi.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1378314535-27587-2-git-send-email-ottlik@fzi.de> Subject: Re: [Qemu-devel] [PATCH v2 1/5] util: add socket_set_fast_reuse function which will replace setting SO_REUSEADDR List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Sebastian Ottlik Cc: Jan Kiszka , Anthony Liguori , qemu-devel@nongnu.org, Stefan Hajnoczi On Wed, Sep 04, 2013 at 07:08:51PM +0200, Sebastian Ottlik wrote: > diff --git a/util/oslib-posix.c b/util/oslib-posix.c > index 3dc8b1b..f071793 100644 > --- a/util/oslib-posix.c > +++ b/util/oslib-posix.c > @@ -159,6 +159,20 @@ void qemu_set_nonblock(int fd) > fcntl(fd, F_SETFL, f | O_NONBLOCK); > } > > +int socket_set_fast_reuse(int fd) > +{ > + int val=1, ret; > + > + ret = setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, > + (const char *)&val, sizeof(val)); > + > + if (ret < 0) { > + perror("setsockopt(SOL_SOCKET, SO_REUSEADDR)"); > + } > + > + return ret; > +} Please run scripts/checkpatch.pl before submitting patches to check coding style (whitespace, indentation, etc).