From 405bffefe15f867f77c34bd943b89629281b9cf6 Mon Sep 17 00:00:00 2001 From: Eric Engestrom Date: Fri, 5 Jun 2020 10:22:04 +0200 Subject: [PATCH] radv: replace all dup() with os_dupfd_cloexec() Signed-off-by: Eric Engestrom Reviewed-by: Kristian H. Kristensen Reviewed-by: Lionel Landwerlin Part-of: --- src/amd/vulkan/radv_android.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/amd/vulkan/radv_android.c b/src/amd/vulkan/radv_android.c index a9f39ec9e02..78c0ab48ea7 100644 --- a/src/amd/vulkan/radv_android.c +++ b/src/amd/vulkan/radv_android.c @@ -35,6 +35,8 @@ #endif #endif +#include "util/os_file.h" + #include "radv_private.h" #include "vk_util.h" @@ -137,7 +139,7 @@ radv_image_from_gralloc(VkDevice device_h, const VkImportMemoryFdInfoKHR import_info = { .sType = VK_STRUCTURE_TYPE_IMPORT_MEMORY_FD_INFO_KHR, .handleType = VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_FD_BIT, - .fd = dup(dma_buf), + .fd = os_dupfd_cloexec(dma_buf), }; /* Find the first VRAM memory type, or GART for PRIME images. */ @@ -389,7 +391,7 @@ radv_AcquireImageANDROID( VkResult semaphore_result = VK_SUCCESS, fence_result = VK_SUCCESS; if (semaphore != VK_NULL_HANDLE) { - int semaphore_fd = nativeFenceFd >= 0 ? dup(nativeFenceFd) : nativeFenceFd; + int semaphore_fd = nativeFenceFd >= 0 ? os_dupfd_cloexec(nativeFenceFd) : nativeFenceFd; semaphore_result = radv_ImportSemaphoreFdKHR(device, &(VkImportSemaphoreFdInfoKHR) { .sType = VK_STRUCTURE_TYPE_IMPORT_SEMAPHORE_FD_INFO_KHR, @@ -400,7 +402,7 @@ radv_AcquireImageANDROID( } if (fence != VK_NULL_HANDLE) { - int fence_fd = nativeFenceFd >= 0 ? dup(nativeFenceFd) : nativeFenceFd; + int fence_fd = nativeFenceFd >= 0 ? os_dupfd_cloexec(nativeFenceFd) : nativeFenceFd; fence_result = radv_ImportFenceFdKHR(device, &(VkImportFenceFdInfoKHR) { .sType = VK_STRUCTURE_TYPE_IMPORT_FENCE_FD_INFO_KHR, -- 2.30.2