mirror of
https://github.com/xen-project/xen.git
synced 2026-10-28 10:11:27 +01:00
libxl: Introduce libxl__fd_set_cloexec
Signed-off-by: Anthony PERARD <anthony.perard@citrix.com> Acked-by: Ian Jackson <ian.jackson@eu.citrix.com> Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
This commit is contained in:
1 parent
0c49cf7d49
commit
acb8458e25
2 files changed
+14
No files matched your search
@@ -242,3 +242,16 @@ int libxl__file_reference_unmap(libxl_file_reference *f)
|
||||
|
||||
return ERROR_FAIL;
|
||||
}
|
||||
|
||||
int libxl__fd_set_cloexec(int fd)
|
||||
{
|
||||
int flags = 0;
|
||||
|
||||
if ((flags = fcntl(fd, F_GETFD)) == -1) {
|
||||
flags = 0;
|
||||
}
|
||||
if ((flags & FD_CLOEXEC)) {
|
||||
return 0;
|
||||
}
|
||||
return fcntl(fd, F_SETFD, flags | FD_CLOEXEC);
|
||||
}
|
||||
@@ -384,6 +384,7 @@ _hidden int libxl__error_set(libxl__gc *gc, int code);
|
||||
|
||||
_hidden int libxl__file_reference_map(libxl_file_reference *f);
|
||||
_hidden int libxl__file_reference_unmap(libxl_file_reference *f);
|
||||
_hidden int libxl__fd_set_cloexec(int fd);
|
||||
|
||||
_hidden int libxl__e820_alloc(libxl_ctx *ctx, uint32_t domid, libxl_domain_config *d_config);
|
||||
|
||||
|
||||