Mesa (master): i965: 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: 62797c30edb3c200c531bced9d397aab54497931
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=62797c30edb3c200c531bced9d397aab54497931
Author: Eric Engestrom <eric at engestrom.ch>
Date: Fri Jun 5 10:55:03 2020 +0200
i965: 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/mesa/drivers/dri/i965/brw_bufmgr.c | 2 +-
src/mesa/drivers/dri/i965/brw_sync.c | 6 ++++--
2 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/src/mesa/drivers/dri/i965/brw_bufmgr.c b/src/mesa/drivers/dri/i965/brw_bufmgr.c
index ea505176aae..f0d69379f5f 100644
--- a/src/mesa/drivers/dri/i965/brw_bufmgr.c
+++ b/src/mesa/drivers/dri/i965/brw_bufmgr.c
@@ -1855,7 +1855,7 @@ brw_bufmgr_create(struct gen_device_info *devinfo, int fd, bool bo_reuse)
* Don't do this! Ensure that each library/bufmgr has its own device
* fd so that its namespace does not clash with another.
*/
- bufmgr->fd = dup(fd);
+ bufmgr->fd = os_dupfd_cloexec(fd);
if (bufmgr->fd < 0) {
free(bufmgr);
return NULL;
diff --git a/src/mesa/drivers/dri/i965/brw_sync.c b/src/mesa/drivers/dri/i965/brw_sync.c
index f44c4e08ccb..78b18443be6 100644
--- a/src/mesa/drivers/dri/i965/brw_sync.c
+++ b/src/mesa/drivers/dri/i965/brw_sync.c
@@ -40,6 +40,8 @@
#include <libsync.h> /* Requires Android or libdrm-2.4.72 */
+#include "util/os_file.h"
+
#include "brw_context.h"
#include "intel_batchbuffer.h"
@@ -501,7 +503,7 @@ brw_dri_create_fence_fd(__DRIcontext *dri_ctx, int fd)
goto fail;
} else {
/* Import the sync fd as an in-fence. */
- fence->sync_fd = dup(fd);
+ fence->sync_fd = os_dupfd_cloexec(fd);
}
assert(fence->sync_fd != -1);
@@ -518,7 +520,7 @@ static int
brw_dri_get_fence_fd_locked(struct brw_fence *fence)
{
assert(fence->type == BRW_FENCE_TYPE_SYNC_FD);
- return dup(fence->sync_fd);
+ return os_dupfd_cloexec(fence->sync_fd);
}
static int
More information about the mesa-commit
mailing list