Patchwork [3/9] qemu_pipe() is used only by POSIX code, so move to os-posix-lib.c

login
register
mail settings
Submitter Jes Sorensen
Date Oct. 15, 2010, 2:05 p.m.
Message ID <1287151553-16894-4-git-send-email-Jes.Sorensen@redhat.com>
Download mbox | patch
Permalink /patch/67959/
State New
Headers show

Comments

Jes Sorensen - Oct. 15, 2010, 2:05 p.m.
From: Jes Sorensen <Jes.Sorensen@redhat.com>

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
---
 os-posix-lib.c |   22 ++++++++++++++++++++++
 osdep.c        |   22 ----------------------
 2 files changed, 22 insertions(+), 22 deletions(-)

Patch

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
 
 /*