summaryrefslogtreecommitdiffstats
path: root/qemu/util/compatfd.c
diff options
context:
space:
mode:
authorRajithaY <rajithax.yerrumsetty@intel.com>2017-04-25 03:31:15 -0700
committerRajitha Yerrumchetty <rajithax.yerrumsetty@intel.com>2017-05-22 06:48:08 +0000
commitbb756eebdac6fd24e8919e2c43f7d2c8c4091f59 (patch)
treeca11e03542edf2d8f631efeca5e1626d211107e3 /qemu/util/compatfd.c
parenta14b48d18a9ed03ec191cf16b162206998a895ce (diff)
Adding qemu as a submodule of KVMFORNFV
This Patch includes the changes to add qemu as a submodule to kvmfornfv repo and make use of the updated latest qemu for the execution of all testcase Change-Id: I1280af507a857675c7f81d30c95255635667bdd7 Signed-off-by:RajithaY<rajithax.yerrumsetty@intel.com>
Diffstat (limited to 'qemu/util/compatfd.c')
-rw-r--r--qemu/util/compatfd.c111
1 files changed, 0 insertions, 111 deletions
diff --git a/qemu/util/compatfd.c b/qemu/util/compatfd.c
deleted file mode 100644
index 9a43042ae..000000000
--- a/qemu/util/compatfd.c
+++ /dev/null
@@ -1,111 +0,0 @@
-/*
- * signalfd/eventfd compatibility
- *
- * Copyright IBM, Corp. 2008
- *
- * Authors:
- * Anthony Liguori <aliguori@us.ibm.com>
- *
- * This work is licensed under the terms of the GNU GPL, version 2. See
- * the COPYING file in the top-level directory.
- *
- * Contributions after 2012-01-13 are licensed under the terms of the
- * GNU GPL, version 2 or (at your option) any later version.
- */
-
-#include "qemu/osdep.h"
-#include "qemu-common.h"
-#include "qemu/compatfd.h"
-#include "qemu/thread.h"
-
-#include <sys/syscall.h>
-
-struct sigfd_compat_info
-{
- sigset_t mask;
- int fd;
-};
-
-static void *sigwait_compat(void *opaque)
-{
- struct sigfd_compat_info *info = opaque;
-
- while (1) {
- int sig;
- int err;
-
- err = sigwait(&info->mask, &sig);
- if (err != 0) {
- if (errno == EINTR) {
- continue;
- } else {
- return NULL;
- }
- } else {
- struct qemu_signalfd_siginfo buffer;
- size_t offset = 0;
-
- memset(&buffer, 0, sizeof(buffer));
- buffer.ssi_signo = sig;
-
- while (offset < sizeof(buffer)) {
- ssize_t len;
-
- len = write(info->fd, (char *)&buffer + offset,
- sizeof(buffer) - offset);
- if (len == -1 && errno == EINTR)
- continue;
-
- if (len <= 0) {
- return NULL;
- }
-
- offset += len;
- }
- }
- }
-}
-
-static int qemu_signalfd_compat(const sigset_t *mask)
-{
- struct sigfd_compat_info *info;
- QemuThread thread;
- int fds[2];
-
- info = malloc(sizeof(*info));
- if (info == NULL) {
- errno = ENOMEM;
- return -1;
- }
-
- if (pipe(fds) == -1) {
- free(info);
- return -1;
- }
-
- qemu_set_cloexec(fds[0]);
- qemu_set_cloexec(fds[1]);
-
- memcpy(&info->mask, mask, sizeof(*mask));
- info->fd = fds[1];
-
- qemu_thread_create(&thread, "signalfd_compat", sigwait_compat, info,
- QEMU_THREAD_DETACHED);
-
- return fds[0];
-}
-
-int qemu_signalfd(const sigset_t *mask)
-{
-#if defined(CONFIG_SIGNALFD)
- int ret;
-
- ret = syscall(SYS_signalfd, -1, mask, _NSIG / 8);
- if (ret != -1) {
- qemu_set_cloexec(ret);
- return ret;
- }
-#endif
-
- return qemu_signalfd_compat(mask);
-}