diff options
author | Ian Jackson <ian.jackson@eu.citrix.com> | 2012-01-27 17:01:23 +0000 |
---|---|---|
committer | Ian Jackson <ian.jackson@eu.citrix.com> | 2012-01-27 17:01:23 +0000 |
commit | 705fdc03cd7d78643c4dece8564d0bba04eb2c0f (patch) | |
tree | d892aa2ba7d71d68c2ef559704e64cb24cf53013 /tools/libxl/libxl_qmp.c | |
parent | 328eb1ab8ac325ea58110b68ec866f0f2fa05625 (diff) | |
download | xen-705fdc03cd7d78643c4dece8564d0bba04eb2c0f.tar.gz xen-705fdc03cd7d78643c4dece8564d0bba04eb2c0f.tar.bz2 xen-705fdc03cd7d78643c4dece8564d0bba04eb2c0f.zip |
libxl: introduce libxl_fd_set_nonblock, rationalise _cloexec
We want a function for setting fds to nonblocking, so introduce one.
This is a very similar requirement to that for libxl_fd_set_cloexec,
so make it common with that.
While we're at it, fix a few deficiences that make this latter
function less desirable than it could be:
* Change the return from 0/-1 (like a syscall) to a libxl error code
* Take a boolean parameter for turning the flag on and off
* Log on error (and so, take a ctx for this purpose)
Change callers of libxl_fd_set_cloexec to notice errors. (Although,
such errors are highly unlikely.)
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
Diffstat (limited to 'tools/libxl/libxl_qmp.c')
-rw-r--r-- | tools/libxl/libxl_qmp.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/tools/libxl/libxl_qmp.c b/tools/libxl/libxl_qmp.c index 6d401b7a42..f125b17fe3 100644 --- a/tools/libxl/libxl_qmp.c +++ b/tools/libxl/libxl_qmp.c @@ -325,7 +325,8 @@ static int qmp_open(libxl__qmp_handler *qmp, const char *qmp_socket_path, if (fcntl(qmp->qmp_fd, F_SETFL, flags | O_NONBLOCK) == -1) { return -1; } - libxl_fd_set_cloexec(qmp->qmp_fd); + ret = libxl_fd_set_cloexec(qmp->ctx, qmp->qmp_fd, 1); + if (ret) return -1; memset(&qmp->addr, 0, sizeof (&qmp->addr)); qmp->addr.sun_family = AF_UNIX; |