diff --git a/ChangeLog b/ChangeLog index 5be64adbf8e72a7f9f418d568b20332f13c73d49..077a9487a3450bbe4aff554cb7763395f0f9a4b8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +Tue May 12 16:38:22 BST 2009 Daniel P. Berrange + + * qemud/qemud.c, qemud/qemud.h, qemud/event.c: Remove use + of qemudSetNonBock/SetCloseExec in favour of virSetNonBlock + and virSetCloseExec. + Tue May 12 16:38:22 BST 2009 Daniel P. Berrange Allow for quieter build with 'make -s' diff --git a/qemud/event.c b/qemud/event.c index 0887008b4df2a19a6ea91517868ea523ffcff9bd..65f548e44e4107d87fd226db396413243b42802f 100644 --- a/qemud/event.c +++ b/qemud/event.c @@ -30,7 +30,8 @@ #include #include -#include "qemud.h" +#include "threads.h" +#include "logging.h" #include "event.h" #include "memory.h" #include "util.h" @@ -597,10 +598,10 @@ int virEventInit(void) return -1; if (pipe(eventLoop.wakeupfd) < 0 || - qemudSetNonBlock(eventLoop.wakeupfd[0]) < 0 || - qemudSetNonBlock(eventLoop.wakeupfd[1]) < 0 || - qemudSetCloseExec(eventLoop.wakeupfd[0]) < 0 || - qemudSetCloseExec(eventLoop.wakeupfd[1]) < 0) + virSetNonBlock(eventLoop.wakeupfd[0]) < 0 || + virSetNonBlock(eventLoop.wakeupfd[1]) < 0 || + virSetCloseExec(eventLoop.wakeupfd[0]) < 0 || + virSetCloseExec(eventLoop.wakeupfd[1]) < 0) return -1; if (virEventAddHandleImpl(eventLoop.wakeupfd[0], diff --git a/qemud/qemud.c b/qemud/qemud.c index 829a4bc5f29ba54eac674324a284cf60bd6a198b..1847407911ce6cbccee08d29965f60c4100b91f7 100644 --- a/qemud/qemud.c +++ b/qemud/qemud.c @@ -371,32 +371,6 @@ qemudDispatchSignalEvent(int watch ATTRIBUTE_UNUSED, virMutexUnlock(&server->lock); } -int qemudSetCloseExec(int fd) { - int flags; - if ((flags = fcntl(fd, F_GETFD)) < 0) - goto error; - flags |= FD_CLOEXEC; - if ((fcntl(fd, F_SETFD, flags)) < 0) - goto error; - return 0; - error: - VIR_ERROR0(_("Failed to set close-on-exec file descriptor flag")); - return -1; -} - - -int qemudSetNonBlock(int fd) { - int flags; - if ((flags = fcntl(fd, F_GETFL)) < 0) - goto error; - flags |= O_NONBLOCK; - if ((fcntl(fd, F_SETFL, flags)) < 0) - goto error; - return 0; - error: - VIR_ERROR0(_("Failed to set non-blocking file descriptor flag")); - return -1; -} static int qemudGoDaemon(void) { int pid = fork(); @@ -525,8 +499,8 @@ static int qemudListenUnix(struct qemud_server *server, goto cleanup; } - if (qemudSetCloseExec(sock->fd) < 0 || - qemudSetNonBlock(sock->fd) < 0) + if (virSetCloseExec(sock->fd) < 0 || + virSetNonBlock(sock->fd) < 0) goto cleanup; memset(&addr, 0, sizeof(addr)); @@ -687,8 +661,8 @@ remoteListenTCP (struct qemud_server *server, else sock->port = -1; - if (qemudSetCloseExec(sock->fd) < 0 || - qemudSetNonBlock(sock->fd) < 0) + if (virSetCloseExec(sock->fd) < 0 || + virSetNonBlock(sock->fd) < 0) goto cleanup; if (listen (sock->fd, 30) < 0) { @@ -1273,8 +1247,8 @@ static int qemudDispatchServer(struct qemud_server *server, struct qemud_socket setsockopt (fd, IPPROTO_TCP, TCP_NODELAY, (void *)&no_slow_start, sizeof no_slow_start); - if (qemudSetCloseExec(fd) < 0 || - qemudSetNonBlock(fd) < 0) { + if (virSetCloseExec(fd) < 0 || + virSetNonBlock(fd) < 0) { close(fd); return -1; } @@ -2872,10 +2846,10 @@ int main(int argc, char **argv) { goto error1; if (pipe(sigpipe) < 0 || - qemudSetNonBlock(sigpipe[0]) < 0 || - qemudSetNonBlock(sigpipe[1]) < 0 || - qemudSetCloseExec(sigpipe[0]) < 0 || - qemudSetCloseExec(sigpipe[1]) < 0) { + virSetNonBlock(sigpipe[0]) < 0 || + virSetNonBlock(sigpipe[1]) < 0 || + virSetCloseExec(sigpipe[0]) < 0 || + virSetCloseExec(sigpipe[1]) < 0) { char ebuf[1024]; VIR_ERROR(_("Failed to create pipe: %s"), virStrerror(errno, ebuf, sizeof ebuf)); diff --git a/qemud/qemud.h b/qemud/qemud.h index 4ddbc41576579f4161b7c0f302b9850a09994969..e3bae462486c5fe685a6c9ffb04ab9f872a752fc 100644 --- a/qemud/qemud.h +++ b/qemud/qemud.h @@ -198,9 +198,6 @@ void qemudLog(int priority, const char *fmt, ...) ATTRIBUTE_FORMAT(printf,2,3); -int qemudSetCloseExec(int fd); -int qemudSetNonBlock(int fd); - int remoteDispatchClientRequest (struct qemud_server *server, struct qemud_client *client,