Mesa (master): etnaviv: replace all dup() with os_dupfd_cloexec()

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Thu Jun 18 02:25:51 UTC 2020


Module: Mesa
Branch: master
Commit: bd5cf70d3db711c31a2f2fca4eb05e20c185e38c
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=bd5cf70d3db711c31a2f2fca4eb05e20c185e38c

Author: Eric Engestrom <eric at engestrom.ch>
Date:   Fri Jun  5 10:22:29 2020 +0200

etnaviv: replace all dup() with os_dupfd_cloexec()

Signed-off-by: Eric Engestrom <eric at engestrom.ch>
Reviewed-by: Kristian H. Kristensen <hoegsberg at google.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin at intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5369>

---

 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 *



More information about the mesa-commit mailing list