From bd5cf70d3db711c31a2f2fca4eb05e20c185e38c Mon Sep 17 00:00:00 2001 From: Eric Engestrom Date: Fri, 5 Jun 2020 10:22:29 +0200 Subject: [PATCH] etnaviv: replace all dup() with os_dupfd_cloexec() Signed-off-by: Eric Engestrom Reviewed-by: Kristian H. Kristensen Reviewed-by: Lionel Landwerlin Part-of: --- src/etnaviv/drm/etnaviv_device.c | 3 ++- src/gallium/drivers/etnaviv/etnaviv_fence.c | 5 +++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/etnaviv/drm/etnaviv_device.c b/src/etnaviv/drm/etnaviv_device.c index b1fc6b91c89..8d56e9a4f1b 100644 --- a/src/etnaviv/drm/etnaviv_device.c +++ b/src/etnaviv/drm/etnaviv_device.c @@ -25,6 +25,7 @@ */ #include "util/hash_table.h" +#include "util/os_file.h" #include "etnaviv_priv.h" #include "etnaviv_drmif.h" @@ -63,7 +64,7 @@ struct etna_device *etna_device_new(int fd) * which is close()d when the device is finalized. */ struct etna_device *etna_device_new_dup(int fd) { - int dup_fd = dup(fd); + int dup_fd = os_dupfd_cloexec(fd); struct etna_device *dev = etna_device_new(dup_fd); if (dev) diff --git a/src/gallium/drivers/etnaviv/etnaviv_fence.c b/src/gallium/drivers/etnaviv/etnaviv_fence.c index b2400b6aca3..c0f451fac2d 100644 --- a/src/gallium/drivers/etnaviv/etnaviv_fence.c +++ b/src/gallium/drivers/etnaviv/etnaviv_fence.c @@ -31,6 +31,7 @@ #include "etnaviv_context.h" #include "etnaviv_screen.h" +#include "util/os_file.h" #include "util/u_inlines.h" #include "util/u_memory.h" @@ -79,7 +80,7 @@ etna_create_fence_fd(struct pipe_context *pctx, enum pipe_fd_type type) { assert(type == PIPE_FD_TYPE_NATIVE_SYNC); - *pfence = etna_fence_create(pctx, dup(fd)); + *pfence = etna_fence_create(pctx, os_dupfd_cloexec(fd)); } void @@ -96,7 +97,7 @@ static int etna_screen_fence_get_fd(struct pipe_screen *pscreen, struct pipe_fence_handle *pfence) { - return dup(pfence->fence_fd); + return os_dupfd_cloexec(pfence->fence_fd); } struct pipe_fence_handle * -- 2.30.2