etnaviv: replace all dup() with os_dupfd_cloexec()

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>
This commit is contained in:
Eric Engestrom
2020-06-05 10:22:29 +02:00
committed by Marge Bot
parent 419b446e1e
commit bd5cf70d3d
2 changed files with 5 additions and 3 deletions

View File

@@ -25,6 +25,7 @@
*/ */
#include "util/hash_table.h" #include "util/hash_table.h"
#include "util/os_file.h"
#include "etnaviv_priv.h" #include "etnaviv_priv.h"
#include "etnaviv_drmif.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. */ * which is close()d when the device is finalized. */
struct etna_device *etna_device_new_dup(int fd) 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); struct etna_device *dev = etna_device_new(dup_fd);
if (dev) if (dev)

View File

@@ -31,6 +31,7 @@
#include "etnaviv_context.h" #include "etnaviv_context.h"
#include "etnaviv_screen.h" #include "etnaviv_screen.h"
#include "util/os_file.h"
#include "util/u_inlines.h" #include "util/u_inlines.h"
#include "util/u_memory.h" #include "util/u_memory.h"
@@ -79,7 +80,7 @@ etna_create_fence_fd(struct pipe_context *pctx,
enum pipe_fd_type type) enum pipe_fd_type type)
{ {
assert(type == PIPE_FD_TYPE_NATIVE_SYNC); assert(type == PIPE_FD_TYPE_NATIVE_SYNC);
*pfence = etna_fence_create(pctx, dup(fd)); *pfence = etna_fence_create(pctx, os_dupfd_cloexec(fd));
} }
void void
@@ -96,7 +97,7 @@ static int
etna_screen_fence_get_fd(struct pipe_screen *pscreen, etna_screen_fence_get_fd(struct pipe_screen *pscreen,
struct pipe_fence_handle *pfence) struct pipe_fence_handle *pfence)
{ {
return dup(pfence->fence_fd); return os_dupfd_cloexec(pfence->fence_fd);
} }
struct pipe_fence_handle * struct pipe_fence_handle *