freedreno: replace all dup() with os_dupfd_cloexec()
[mesa.git] / src / gallium / drivers / freedreno / freedreno_fence.c
index 71472da704a701b887294641cdabe3204bb919fb..59ea1896f45e6f384d9d9e288d573f076db5f808 100644 (file)
@@ -26,6 +26,7 @@
 
 #include <libsync.h>
 
+#include "util/os_file.h"
 #include "util/u_inlines.h"
 
 #include "freedreno_fence.h"
@@ -122,7 +123,7 @@ void fd_create_fence_fd(struct pipe_context *pctx,
                enum pipe_fd_type type)
 {
        assert(type == PIPE_FD_TYPE_NATIVE_SYNC);
-       *pfence = fence_create(fd_context(pctx), NULL, 0, dup(fd));
+       *pfence = fence_create(fd_context(pctx), NULL, 0, os_dupfd_cloexec(fd));
 }
 
 void fd_fence_server_sync(struct pipe_context *pctx,
@@ -146,7 +147,7 @@ int fd_fence_get_fd(struct pipe_screen *pscreen,
                struct pipe_fence_handle *fence)
 {
        fence_flush(fence);
-       return dup(fence->fence_fd);
+       return os_dupfd_cloexec(fence->fence_fd);
 }
 
 struct pipe_fence_handle * fd_fence_create(struct fd_batch *batch)