etnaviv: replace all dup() with os_dupfd_cloexec()
authorEric Engestrom <eric@engestrom.ch>
Fri, 5 Jun 2020 08:22:29 +0000 (10:22 +0200)
committerMarge Bot <eric+marge@anholt.net>
Thu, 18 Jun 2020 02:09:56 +0000 (02:09 +0000)
Signed-off-by: Eric Engestrom <eric@engestrom.ch>
Reviewed-by: Kristian H. Kristensen <hoegsberg@google.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5369>

src/etnaviv/drm/etnaviv_device.c
src/gallium/drivers/etnaviv/etnaviv_fence.c

index b1fc6b91c89a070b73f87cf1ba03d575e986a983..8d56e9a4f1b9f0877caa935ea027f2f594b09c91 100644 (file)
@@ -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)
index b2400b6aca3d0e3a01c78138990bcc6526a3dd82..c0f451fac2d3ab3cee1960bfa5da5307eb7403a6 100644 (file)
@@ -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 *