#include <sys/stat.h>
#include <unistd.h>
+#include <fcntl.h>
#include "pipe/p_context.h"
#include "pipe/p_state.h"
#include "util/u_format.h"
* nouveau_device_wrap does not close the fd in case of a device
* creation error.
*/
- dupfd = dup(fd);
+ dupfd = fcntl(fd, F_DUPFD_CLOEXEC, 3);
ret = nouveau_drm_new(dupfd, &drm);
if (ret)
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
+#include <fcntl.h>
#include <radeon_surface.h>
#ifndef RADEON_INFO_ACTIVE_CU_COUNT
return NULL;
}
- ws->fd = dup(fd);
+ ws->fd = fcntl(fd, F_DUPFD_CLOEXEC, 3);
if (!do_winsys_init(ws))
goto fail1;
#endif
#include <sys/stat.h>
#include <unistd.h>
+#include <fcntl.h>
static struct util_hash_table *dev_hash = NULL;
vws->device = stat_buf.st_rdev;
vws->open_count = 1;
- vws->ioctl.drm_fd = dup(fd);
+ vws->ioctl.drm_fd = fcntl(fd, F_DUPFD_CLOEXEC, 3);
vws->base.have_gb_dma = TRUE;
vws->base.need_to_rebind_resources = FALSE;
*/
#include <unistd.h>
+#include <fcntl.h>
#include "vc4_drm_public.h"
struct pipe_screen *
vc4_drm_screen_create(int fd)
{
- return vc4_screen_create(dup(fd));
+ return vc4_screen_create(fcntl(fd, F_DUPFD_CLOEXEC, 3));
}
virgl_screen(pscreen)->refcnt++;
} else {
struct virgl_winsys *vws;
- int dup_fd = dup(fd);
+ int dup_fd = fcntl(fd, F_DUPFD_CLOEXEC, 3);
vws = virgl_drm_winsys_create(dup_fd);