util: Remove unused functions

Delete the unused functions qemu_signalfd_available(),
qemu_send_full() and qemu_recv_full().

Signed-off-by: Thomas Huth <thuth@linux.vnet.ibm.com>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
This commit is contained in:
Thomas Huth 2015-03-14 07:19:33 +01:00 committed by Michael Tokarev
parent ec29ea1b2b
commit 3bf2af7b40
4 changed files with 0 additions and 90 deletions

View File

@ -217,10 +217,6 @@ void *qemu_oom_check(void *ptr);
ssize_t qemu_write_full(int fd, const void *buf, size_t count) ssize_t qemu_write_full(int fd, const void *buf, size_t count)
QEMU_WARN_UNUSED_RESULT; QEMU_WARN_UNUSED_RESULT;
ssize_t qemu_send_full(int fd, const void *buf, size_t count, int flags)
QEMU_WARN_UNUSED_RESULT;
ssize_t qemu_recv_full(int fd, void *buf, size_t count, int flags)
QEMU_WARN_UNUSED_RESULT;
#ifndef _WIN32 #ifndef _WIN32
int qemu_pipe(int pipefd[2]); int qemu_pipe(int pipefd[2]);

View File

@ -39,6 +39,5 @@ struct qemu_signalfd_siginfo {
}; };
int qemu_signalfd(const sigset_t *mask); int qemu_signalfd(const sigset_t *mask);
bool qemu_signalfd_available(void);
#endif #endif

View File

@ -108,22 +108,3 @@ int qemu_signalfd(const sigset_t *mask)
return qemu_signalfd_compat(mask); return qemu_signalfd_compat(mask);
} }
bool qemu_signalfd_available(void)
{
#ifdef CONFIG_SIGNALFD
sigset_t mask;
int fd;
bool ok;
sigemptyset(&mask);
errno = 0;
fd = syscall(SYS_signalfd, -1, &mask, _NSIG / 8);
ok = (errno != ENOSYS);
if (fd >= 0) {
close(fd);
}
return ok;
#else
return false;
#endif
}

View File

@ -310,72 +310,6 @@ int qemu_accept(int s, struct sockaddr *addr, socklen_t *addrlen)
return ret; return ret;
} }
/*
* A variant of send(2) which handles partial write.
*
* Return the number of bytes transferred, which is only
* smaller than `count' if there is an error.
*
* This function won't work with non-blocking fd's.
* Any of the possibilities with non-bloking fd's is bad:
* - return a short write (then name is wrong)
* - busy wait adding (errno == EAGAIN) to the loop
*/
ssize_t qemu_send_full(int fd, const void *buf, size_t count, int flags)
{
ssize_t ret = 0;
ssize_t total = 0;
while (count) {
ret = send(fd, buf, count, flags);
if (ret < 0) {
if (errno == EINTR) {
continue;
}
break;
}
count -= ret;
buf += ret;
total += ret;
}
return total;
}
/*
* A variant of recv(2) which handles partial write.
*
* Return the number of bytes transferred, which is only
* smaller than `count' if there is an error.
*
* This function won't work with non-blocking fd's.
* Any of the possibilities with non-bloking fd's is bad:
* - return a short write (then name is wrong)
* - busy wait adding (errno == EAGAIN) to the loop
*/
ssize_t qemu_recv_full(int fd, void *buf, size_t count, int flags)
{
ssize_t ret = 0;
ssize_t total = 0;
while (count) {
ret = qemu_recv(fd, buf, count, flags);
if (ret <= 0) {
if (ret < 0 && errno == EINTR) {
continue;
}
break;
}
count -= ret;
buf += ret;
total += ret;
}
return total;
}
void qemu_set_version(const char *version) void qemu_set_version(const char *version)
{ {
qemu_version = version; qemu_version = version;