From patchwork Fri Oct 15 14:05:47 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jes Sorensen X-Patchwork-Id: 67959 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 443BEB70E3 for ; Sat, 16 Oct 2010 01:29:06 +1100 (EST) Received: from localhost ([127.0.0.1]:60989 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1P6lHK-0002Gi-QZ for incoming@patchwork.ozlabs.org; Fri, 15 Oct 2010 10:29:02 -0400 Received: from [140.186.70.92] (port=38973 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1P6l9v-0004Jb-2s for qemu-devel@nongnu.org; Fri, 15 Oct 2010 10:21:28 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1P6kv3-0007jN-4H for qemu-devel@nongnu.org; Fri, 15 Oct 2010 10:06:02 -0400 Received: from mx1.redhat.com ([209.132.183.28]:65512) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1P6kv2-0007j4-Tz for qemu-devel@nongnu.org; Fri, 15 Oct 2010 10:06:01 -0400 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o9FE60Jr031131 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Fri, 15 Oct 2010 10:06:00 -0400 Received: from localhost6.localdomain6 (ovpn-113-85.phx2.redhat.com [10.3.113.85]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id o9FE5tSm014808 for ; Fri, 15 Oct 2010 10:05:59 -0400 From: Jes.Sorensen@redhat.com To: qemu-devel@nongnu.org Date: Fri, 15 Oct 2010 16:05:47 +0200 Message-Id: <1287151553-16894-4-git-send-email-Jes.Sorensen@redhat.com> In-Reply-To: <1287151553-16894-1-git-send-email-Jes.Sorensen@redhat.com> References: <1287151553-16894-1-git-send-email-Jes.Sorensen@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. Subject: [Qemu-devel] [PATCH 3/9] qemu_pipe() is used only by POSIX code, so move to os-posix-lib.c X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Jes Sorensen Signed-off-by: Jes Sorensen --- os-posix-lib.c | 22 ++++++++++++++++++++++ osdep.c | 22 ---------------------- 2 files changed, 22 insertions(+), 22 deletions(-) diff --git a/os-posix-lib.c b/os-posix-lib.c index 79f9bac..773e998 100644 --- a/os-posix-lib.c +++ b/os-posix-lib.c @@ -78,3 +78,25 @@ void qemu_set_cloexec(int fd) f = fcntl(fd, F_GETFD); fcntl(fd, F_SETFD, f | FD_CLOEXEC); } + +/* + * Creates a pipe with FD_CLOEXEC set on both file descriptors + */ +int qemu_pipe(int pipefd[2]) +{ + int ret; + +#ifdef CONFIG_PIPE2 + ret = pipe2(pipefd, O_CLOEXEC); + if (ret != -1 || errno != ENOSYS) { + return ret; + } +#endif + ret = pipe(pipefd); + if (ret == 0) { + qemu_set_cloexec(pipefd[0]); + qemu_set_cloexec(pipefd[1]); + } + + return ret; +} diff --git a/osdep.c b/osdep.c index bc95bdd..0019238 100644 --- a/osdep.c +++ b/osdep.c @@ -250,28 +250,6 @@ int qemu_eventfd(int fds[2]) return qemu_pipe(fds); } - -/* - * Creates a pipe with FD_CLOEXEC set on both file descriptors - */ -int qemu_pipe(int pipefd[2]) -{ - int ret; - -#ifdef CONFIG_PIPE2 - ret = pipe2(pipefd, O_CLOEXEC); - if (ret != -1 || errno != ENOSYS) { - return ret; - } -#endif - ret = pipe(pipefd); - if (ret == 0) { - qemu_set_cloexec(pipefd[0]); - qemu_set_cloexec(pipefd[1]); - } - - return ret; -} #endif /*